diff --git a/components/CollectionCard.tsx b/components/CollectionCard.tsx index da634cc5..432425c2 100644 --- a/components/CollectionCard.tsx +++ b/components/CollectionCard.tsx @@ -5,12 +5,12 @@ import ProfilePhoto from "./ProfilePhoto"; import usePermissions from "@/hooks/usePermissions"; import useLocalSettingsStore from "@/store/localSettings"; import getPublicUserData from "@/lib/client/getPublicUserData"; -import useAccountStore from "@/store/account"; import EditCollectionModal from "./ModalContent/EditCollectionModal"; import EditCollectionSharingModal from "./ModalContent/EditCollectionSharingModal"; import DeleteCollectionModal from "./ModalContent/DeleteCollectionModal"; import { dropdownTriggerer } from "@/lib/client/utils"; import { useTranslation } from "next-i18next"; +import { useUser } from "@/hooks/store/user"; type Props = { collection: CollectionIncludingMembersAndLinkCount; @@ -20,7 +20,7 @@ type Props = { export default function CollectionCard({ collection, className }: Props) { const { t } = useTranslation(); const { settings } = useLocalSettingsStore(); - const { account } = useAccountStore(); + const { data: user = {} } = useUser(); const formattedDate = new Date(collection.createdAt as string).toLocaleString( "en-US", @@ -45,18 +45,18 @@ export default function CollectionCard({ collection, className }: Props) { useEffect(() => { const fetchOwner = async () => { - if (collection && collection.ownerId !== account.id) { + if (collection && collection.ownerId !== user.id) { const owner = await getPublicUserData(collection.ownerId as number); setCollectionOwner(owner); - } else if (collection && collection.ownerId === account.id) { + } else if (collection && collection.ownerId === user.id) { 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, + id: user.id as number, + name: user.name, + username: user.username as string, + image: user.image as string, + archiveAsScreenshot: user.archiveAsScreenshot as boolean, + archiveAsMonolith: user.archiveAsMonolith as boolean, + archiveAsPDF: user.archiveAsPDF as boolean, }); } }; @@ -80,7 +80,7 @@ export default function CollectionCard({ collection, className }: Props) { > -
{t("you_have_no_collections")} diff --git a/components/FilterSearchDropdown.tsx b/components/FilterSearchDropdown.tsx index 68bb55bd..a0adc371 100644 --- a/components/FilterSearchDropdown.tsx +++ b/components/FilterSearchDropdown.tsx @@ -29,7 +29,7 @@ export default function FilterSearchDropdown({ > -
{collection?.name}
- + <> + { + e.stopPropagation(); + }} + className="flex items-center gap-1 max-w-full w-fit hover:opacity-70 duration-100 select-none" + title={collection?.name} + > + +{collection?.name}
+ + > ); } diff --git a/components/LinkViews/LinkList.tsx b/components/LinkViews/LinkComponents/LinkList.tsx similarity index 91% rename from components/LinkViews/LinkList.tsx rename to components/LinkViews/LinkComponents/LinkList.tsx index 723c47e2..d3c8d402 100644 --- a/components/LinkViews/LinkList.tsx +++ b/components/LinkViews/LinkComponents/LinkList.tsx @@ -4,7 +4,6 @@ import { } from "@/types/global"; import { useEffect, useState } from "react"; import useLinkStore from "@/store/links"; -import useCollectionStore from "@/store/collections"; import unescapeString from "@/lib/client/unescapeString"; import LinkActions from "@/components/LinkViews/LinkComponents/LinkActions"; import LinkDate from "@/components/LinkViews/LinkComponents/LinkDate"; @@ -12,11 +11,13 @@ import LinkCollection from "@/components/LinkViews/LinkComponents/LinkCollection import LinkIcon from "@/components/LinkViews/LinkComponents/LinkIcon"; import { isPWA } from "@/lib/client/utils"; import { generateLinkHref } from "@/lib/client/generateLinkHref"; -import useAccountStore from "@/store/account"; import usePermissions from "@/hooks/usePermissions"; import toast from "react-hot-toast"; -import LinkTypeBadge from "./LinkComponents/LinkTypeBadge"; +import LinkTypeBadge from "./LinkTypeBadge"; import { useTranslation } from "next-i18next"; +import { useCollections } from "@/hooks/store/collections"; +import { useUser } from "@/hooks/store/user"; +import { useLinks } from "@/hooks/store/links"; type Props = { link: LinkIncludingShortenedCollectionAndTags; @@ -33,9 +34,12 @@ export default function LinkCardCompact({ }: Props) { const { t } = useTranslation(); - const { collections } = useCollectionStore(); - const { account } = useAccountStore(); - const { links, setSelectedLinks, selectedLinks } = useLinkStore(); + const { data: collections = [] } = useCollections(); + + const { data: user = {} } = useUser(); + const { setSelectedLinks, selectedLinks } = useLinkStore(); + + const { links } = useLinks(); useEffect(() => { if (!editMode) { @@ -119,7 +123,7 @@ export default function LinkCardCompact({{t("shift_key_tip")}
-+
{t("viewer")}
-{t("viewer_desc")}
++ {t("viewer_desc")} +
+
{t("contributor")}
-{t("contributor_desc")}
++ {t("contributor_desc")} +
+
{t("admin")}
-{t("admin_desc")}
++ {t("admin_desc")} +
{title}
+{title}
+ {decodeURIComponent(router.query.email)} +
+ )} +{t("verification_email_sent_desc")}
{t("import_links")}