enh: user delete confirmation

This commit is contained in:
Timothy J. Baek 2024-06-15 04:04:29 -06:00
parent 91cec11500
commit 2abb6788fe

View File

@ -18,6 +18,7 @@
import Tooltip from '$lib/components/common/Tooltip.svelte'; import Tooltip from '$lib/components/common/Tooltip.svelte';
import UserChatsModal from '$lib/components/admin/UserChatsModal.svelte'; import UserChatsModal from '$lib/components/admin/UserChatsModal.svelte';
import AddUserModal from '$lib/components/admin/AddUserModal.svelte'; import AddUserModal from '$lib/components/admin/AddUserModal.svelte';
import ConfirmDialog from '$lib/components/common/ConfirmDialog.svelte';
const i18n = getContext('i18n'); const i18n = getContext('i18n');
@ -30,6 +31,7 @@
let page = 1; let page = 1;
let showDeleteConfirmDialog = false;
let showAddUserModal = false; let showAddUserModal = false;
let showUserChatsModal = false; let showUserChatsModal = false;
@ -77,6 +79,13 @@
}); });
</script> </script>
<ConfirmDialog
bind:show={showDeleteConfirmDialog}
on:confirm={() => {
deleteUserHandler(selectedUser.id);
}}
/>
{#key selectedUser} {#key selectedUser}
<EditUserModal <EditUserModal
bind:show={showEditUserModal} bind:show={showEditUserModal}
@ -256,7 +265,8 @@
<button <button
class="self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl" class="self-center w-fit text-sm px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5 rounded-xl"
on:click={async () => { on:click={async () => {
deleteUserHandler(user.id); showDeleteConfirmDialog = true;
selectedUser = user;
}} }}
> >
<svg <svg