diff --git a/README.md b/README.md index c3f0bc2..e8651d4 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@
{t("you_have_no_collections")} diff --git a/components/FilterSearchDropdown.tsx b/components/FilterSearchDropdown.tsx index 68bb55b..a0adc37 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 0abffc9..745e96f 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")} +
{t("preserved_formats")}
{screenshotAvailable(link) || - pdfAvailable(link) || - readabilityAvailable(link) || - monolithAvailable(link) ? ( + pdfAvailable(link) || + readabilityAvailable(link) || + monolithAvailable(link) ? ({t("available_formats")}
) : ( "" @@ -159,7 +149,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) { name={t("webpage")} icon={"bi-filetype-html"} format={ArchivedFormat.monolith} - activeLink={link} + link={link} downloadable={true} /> )} @@ -173,7 +163,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) { ? ArchivedFormat.png : ArchivedFormat.jpeg } - activeLink={link} + link={link} downloadable={true} /> )} @@ -183,7 +173,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) { name={t("pdf")} icon={"bi-file-earmark-pdf"} format={ArchivedFormat.pdf} - activeLink={link} + link={link} downloadable={true} /> )} @@ -193,7 +183,7 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) { name={t("readable")} icon={"bi-file-earmark-text"} format={ArchivedFormat.readability} - activeLink={link} + link={link} /> )} @@ -224,9 +214,8 @@ export default function PreservedFormatsModal({ onClose, activeLink }: Props) { )}{title}
+{title}
{activeCollection.members.length > 0 && - activeCollection.members.length === 1 + activeCollection.members.length === 1 ? t("by_author_and_other", { + author: collectionOwner.name, + count: activeCollection.members.length, + }) + : activeCollection.members.length > 0 && + activeCollection.members.length !== 1 + ? t("by_author_and_others", { author: collectionOwner.name, count: activeCollection.members.length, }) - : activeCollection.members.length > 0 && - activeCollection.members.length !== 1 - ? t("by_author_and_others", { - author: collectionOwner.name, - count: activeCollection.members.length, - }) : t("by_author", { - author: collectionOwner.name, - })} + author: collectionOwner.name, + })}
{activeCollection?._count?.links === 1 ? t("showing_count_result", { - count: activeCollection?._count?.links, - }) + count: activeCollection?._count?.links, + }) : t("showing_count_results", { - count: activeCollection?._count?.links, - })} + count: activeCollection?._count?.links, + })}
- {links.some((e) => e.collectionId === Number(router.query.id)) ? ( -+ {decodeURIComponent(router.query.email)} +
+ )} +{t("verification_email_sent_desc")}
{t("import_links")}
{t("collection_is_empty")}
)} diff --git a/pages/public/preserved/[id].tsx b/pages/public/preserved/[id].tsx index fdb332a..2f415ae 100644 --- a/pages/public/preserved/[id].tsx +++ b/pages/public/preserved/[id].tsx @@ -1,5 +1,4 @@ import React, { useEffect, useState } from "react"; -import useLinkStore from "@/store/links"; import { useRouter } from "next/router"; import { ArchivedFormat, @@ -7,20 +6,20 @@ import { } from "@/types/global"; import ReadableView from "@/components/ReadableView"; import getServerSideProps from "@/lib/client/getServerSideProps"; +import { useGetLink, useLinks } from "@/hooks/store/links"; export default function Index() { - const { links, getLink } = useLinkStore(); + const { links } = useLinks(); + const getLink = useGetLink(); const [link, setLink] = useState{t("nothing_found")}
- ) : links[0] ? ( -{t("nothing_found")}
} +{t("language")}