From 8f7e0b8d0904b2082051e9261852a142d392a0ab Mon Sep 17 00:00:00 2001 From: Isaac Wise Date: Sat, 27 Jul 2024 20:01:51 -0500 Subject: [PATCH] Remove type assertions --- components/CollectionCard.tsx | 19 +++++++++---------- .../InputSelect/CollectionSelection.tsx | 14 +++++++------- .../ModalContent/PreservedFormatsModal.tsx | 12 ++++++------ hooks/useCollectivePermissions.ts | 1 - pages/collections/[id].tsx | 10 +++++----- 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/components/CollectionCard.tsx b/components/CollectionCard.tsx index 1da6d9e..208a7d5 100644 --- a/components/CollectionCard.tsx +++ b/components/CollectionCard.tsx @@ -15,12 +15,11 @@ import DeleteCollectionModal from "./ModalContent/DeleteCollectionModal"; import { dropdownTriggerer } from "@/lib/client/utils"; import { useTranslation } from "next-i18next"; -type Props = { +export default function CollectionCard({ + collection, +}: { collection: CollectionIncludingMembersAndLinkCount; - className?: string; -}; - -export default function CollectionCard({ collection, className }: Props) { +}) { const { t } = useTranslation(); const { settings } = useLocalSettingsStore(); const { account } = useAccountStore(); @@ -49,11 +48,11 @@ export default function CollectionCard({ collection, className }: Props) { setCollectionOwner({ id: account.id as number, name: account.name, - username: account.username as string, - image: account.image as string, - archiveAsScreenshot: account.archiveAsScreenshot as boolean, - archiveAsMonolith: account.archiveAsMonolith as boolean, - archiveAsPDF: account.archiveAsPDF as boolean, + username: account.username, + image: account.image, + archiveAsScreenshot: account.archiveAsScreenshot, + archiveAsMonolith: account.archiveAsMonolith, + archiveAsPDF: account.archiveAsPDF, }); } }; diff --git a/components/InputSelect/CollectionSelection.tsx b/components/InputSelect/CollectionSelection.tsx index 7b0666a..69e4473 100644 --- a/components/InputSelect/CollectionSelection.tsx +++ b/components/InputSelect/CollectionSelection.tsx @@ -10,11 +10,11 @@ type Props = { onChange: any; showDefaultValue?: boolean; defaultValue?: - | { - label: string; - value?: number; - } - | undefined; + | { + label: string; + value?: number; + } + | undefined; creatable?: boolean; }; @@ -107,7 +107,7 @@ export default function CollectionSelection({ components={{ Option: customOption, }} - // menuPosition="fixed" + // menuPosition="fixed" /> ); } else { @@ -123,7 +123,7 @@ export default function CollectionSelection({ components={{ Option: customOption, }} - // menuPosition="fixed" + // menuPosition="fixed" /> ); } diff --git a/components/ModalContent/PreservedFormatsModal.tsx b/components/ModalContent/PreservedFormatsModal.tsx index 4c9caec..9f8fbd1 100644 --- a/components/ModalContent/PreservedFormatsModal.tsx +++ b/components/ModalContent/PreservedFormatsModal.tsx @@ -51,13 +51,13 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) { setCollectionOwner(owner); } else if (link.collection.ownerId === account.id) { setCollectionOwner({ - id: account.id as number, + id: account.id, name: account.name, - username: account.username as string, - image: account.image as string, - archiveAsScreenshot: account.archiveAsScreenshot as boolean, - archiveAsMonolith: account.archiveAsScreenshot as boolean, - archiveAsPDF: account.archiveAsPDF as boolean, + username: account.username, + image: account.image, + archiveAsScreenshot: account.archiveAsScreenshot, + archiveAsMonolith: account.archiveAsScreenshot, + archiveAsPDF: account.archiveAsPDF, }); } }; diff --git a/hooks/useCollectivePermissions.ts b/hooks/useCollectivePermissions.ts index b1e3b7c..fa7e408 100644 --- a/hooks/useCollectivePermissions.ts +++ b/hooks/useCollectivePermissions.ts @@ -5,7 +5,6 @@ import { useEffect, useState } from "react"; export default function useCollectivePermissions(collectionIds: number[]) { const { collections } = useCollectionStore(); - const { account } = useAccountStore(); const [permissions, setPermissions] = useState(); diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx index baede3d..b3741de 100644 --- a/pages/collections/[id].tsx +++ b/pages/collections/[id].tsx @@ -69,11 +69,11 @@ export default function Index() { setCollectionOwner({ id: account.id as number, name: account.name, - username: account.username as string, - image: account.image as string, - archiveAsScreenshot: account.archiveAsScreenshot as boolean, - archiveAsMonolith: account.archiveAsScreenshot as boolean, - archiveAsPDF: account.archiveAsPDF as boolean, + username: account.username, + image: account.image, + archiveAsScreenshot: account.archiveAsScreenshot, + archiveAsMonolith: account.archiveAsScreenshot, + archiveAsPDF: account.archiveAsPDF, }); } };