From bc8c8aee95eabc78221ffff34f19cc1c577188ea Mon Sep 17 00:00:00 2001 From: Gabriel Hall Date: Mon, 27 May 2024 12:40:54 -0700 Subject: [PATCH] feat: fix location enum --- .../Dialogs/ConfirmUserDeletionDIalog.tsx | 51 ------------------- src/components/ItemHistory.tsx | 2 +- src/components/Layouts/ManageLayout.tsx | 2 - src/components/UserRow.tsx | 26 +--------- src/components/ValueIcons.tsx | 15 +----- src/lib/schemas.ts | 3 +- src/stores/DialogStore.ts | 3 -- 7 files changed, 7 insertions(+), 95 deletions(-) delete mode 100644 src/components/Dialogs/ConfirmUserDeletionDIalog.tsx diff --git a/src/components/Dialogs/ConfirmUserDeletionDIalog.tsx b/src/components/Dialogs/ConfirmUserDeletionDIalog.tsx deleted file mode 100644 index b52994d..0000000 --- a/src/components/Dialogs/ConfirmUserDeletionDIalog.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { toast } from 'react-toastify'; -import useDialogStore from 'stores/DialogStore'; -import useSelectedUserStore from 'stores/SelectedUserStore'; -import { trpc } from 'utils/trpc'; -import { Dialog } from './Dialog'; - -export default function ConfirmUserDeletionDialog() { - const { dialog, clearDialog } = useDialogStore(); - const context = trpc.useContext(); - const userDeleteMutation = trpc.account.delete.useMutation({ - onSuccess: (res) => { - context.user.search.invalidate(); - setSelectedUser(null); - clearDialog(); - toast.success(`Removed ${res.user.name}'s Account`); - }, - onError: (err) => { - toast.error(err.message); - } - }); - const { selectedUser, setSelectedUser } = useSelectedUserStore(); - - if (!selectedUser) return null; - - return ( - -
- User Deletion -

- This will remove{' '} - {selectedUser.name} permanently, as - well as any audits and subscriptions related to their account. This - action cannot be undone. -

-
- - -
-
-
- ); -} diff --git a/src/components/ItemHistory.tsx b/src/components/ItemHistory.tsx index 1dce645..62fed44 100644 --- a/src/components/ItemHistory.tsx +++ b/src/components/ItemHistory.tsx @@ -21,7 +21,7 @@ export function ItemHistory({ item }: ItemHistoryProps) {

- {auditLogQuery.data.map((audit) => audit.actor.name).join('\n')} + {auditLogQuery.data.map((audit) => audit.actor.clerkId).join('\n')}

diff --git a/src/components/Layouts/ManageLayout.tsx b/src/components/Layouts/ManageLayout.tsx index fb6ba33..2722aba 100644 --- a/src/components/Layouts/ManageLayout.tsx +++ b/src/components/Layouts/ManageLayout.tsx @@ -1,5 +1,4 @@ import ConfirmItemDeletionDialog from 'components/Dialogs/ConfirmItemDeletionDialog'; -import ConfirmUserDeletionDialog from 'components/Dialogs/ConfirmUserDeletionDIalog'; import MassArchiveDialog from 'components/Dialogs/MassArchiveDialog'; import EditUserDialog from 'components/Dialogs/UserEditDialog'; import Link from 'next/link'; @@ -12,7 +11,6 @@ export default function ManageLayout({ children }: PropsWithChildren) { <> -
diff --git a/src/components/UserRow.tsx b/src/components/UserRow.tsx index b6f0ddb..20a1c45 100644 --- a/src/components/UserRow.tsx +++ b/src/components/UserRow.tsx @@ -4,16 +4,9 @@ /* eslint-disable jsx-a11y/no-noninteractive-tabindex */ import { Menu, Transition } from '@headlessui/react'; -import clsx from 'clsx'; import Image from 'next/image'; import { Fragment } from 'react'; -import { - FaBell, - FaBellSlash, - FaEllipsisV, - FaTrash, - FaUserLock -} from 'react-icons/fa'; +import { FaBell, FaBellSlash, FaEllipsisV, FaUserLock } from 'react-icons/fa'; import { RouterOutputs } from 'server/trpc/router/_app'; import useDialogStore from 'stores/DialogStore'; import useSelectedUserStore from 'stores/SelectedUserStore'; @@ -23,7 +16,7 @@ export default function UserRow({ }: { data: RouterOutputs['user']['search'][number]; }) { - const { confirmUserDeletionDialog, editUserDialog } = useDialogStore(); + const { editUserDialog } = useDialogStore(); const { setSelectedUser } = useSelectedUserStore(); return ( @@ -107,21 +100,6 @@ export default function UserRow({
- - - diff --git a/src/components/ValueIcons.tsx b/src/components/ValueIcons.tsx index d92fa6e..87bcd66 100644 --- a/src/components/ValueIcons.tsx +++ b/src/components/ValueIcons.tsx @@ -4,19 +4,8 @@ import { Value } from '@prisma/client'; import { ReactNode } from 'react'; export const ValueIcons: Record = { - LOW: ( -
- -
- ), - MEDIUM: ( -
+ GENERAL: ( +
void; confirmItemDeletionDialog: () => void; massArchiveDialog: () => void; - confirmUserDeletionDialog: () => void; editUserDialog: () => void; clearDialog: () => void; }; @@ -26,8 +25,6 @@ export default create((set) => ({ confirmItemDeletionDialog: () => set(() => ({ dialog: 'confirmItemDeletion' })), massArchiveDialog: () => set(() => ({ dialog: 'massArchive' })), - confirmUserDeletionDialog: () => - set(() => ({ dialog: 'confirmUserDeletion' })), editUserDialog: () => set(() => ({ dialog: 'editUser' })), clearDialog: () => set(() => ({ dialog: null })) }));