From e0705ece4f97fe622064aff55ca605b6c2bc671b Mon Sep 17 00:00:00 2001 From: Isaac Wise Date: Sat, 10 Feb 2024 02:34:52 -0600 Subject: [PATCH] Fixed builds failing --- components/LinkViews/LinkCard.tsx | 4 +++- components/LinkViews/LinkList.tsx | 4 +++- lib/client/generateLinkHref.ts | 6 ++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/LinkViews/LinkCard.tsx b/components/LinkViews/LinkCard.tsx index 20694b3..fc3060d 100644 --- a/components/LinkViews/LinkCard.tsx +++ b/components/LinkViews/LinkCard.tsx @@ -16,6 +16,7 @@ import Link from "next/link"; import LinkIcon from "./LinkComponents/LinkIcon"; import useOnScreen from "@/hooks/useOnScreen"; import { generateLinkHref } from "@/lib/client/generateLinkHref"; +import useAccountStore from "@/store/account"; type Props = { link: LinkIncludingShortenedCollectionAndTags; @@ -29,6 +30,7 @@ export default function LinkGrid({ flipDropdown, }: Props) { const { collections } = useCollectionStore(); + const { account } = useAccountStore(); const { links, getLink } = useLinkStore(); @@ -86,7 +88,7 @@ export default function LinkGrid({ className="border border-solid border-neutral-content bg-base-200 shadow-md hover:shadow-none duration-100 rounded-2xl relative" > diff --git a/components/LinkViews/LinkList.tsx b/components/LinkViews/LinkList.tsx index 0ab489a..f4e4500 100644 --- a/components/LinkViews/LinkList.tsx +++ b/components/LinkViews/LinkList.tsx @@ -13,6 +13,7 @@ import LinkIcon from "@/components/LinkViews/LinkComponents/LinkIcon"; import Link from "next/link"; import { isPWA } from "@/lib/client/utils"; import { generateLinkHref } from "@/lib/client/generateLinkHref"; +import useAccountStore from "@/store/account"; type Props = { link: LinkIncludingShortenedCollectionAndTags; @@ -26,6 +27,7 @@ export default function LinkCardCompact({ flipDropdown, }: Props) { const { collections } = useCollectionStore(); + const { account } = useAccountStore(); const { links } = useLinkStore(); let shortendURL; @@ -60,7 +62,7 @@ export default function LinkCardCompact({ } duration-200 rounded-lg`} > diff --git a/lib/client/generateLinkHref.ts b/lib/client/generateLinkHref.ts index d122383..5911ae7 100644 --- a/lib/client/generateLinkHref.ts +++ b/lib/client/generateLinkHref.ts @@ -1,10 +1,8 @@ -import useAccountStore from "@/store/account"; -import { ArchivedFormat, LinkIncludingShortenedCollectionAndTags } from "@/types/global"; +import { AccountSettings, ArchivedFormat, LinkIncludingShortenedCollectionAndTags } from "@/types/global"; import { LinksRouteTo } from "@prisma/client"; import { pdfAvailable, readabilityAvailable, screenshotAvailable } from "../shared/getArchiveValidity"; -export const generateLinkHref = (link: LinkIncludingShortenedCollectionAndTags): string => { - const { account } = useAccountStore(); +export const generateLinkHref = (link: LinkIncludingShortenedCollectionAndTags, account: AccountSettings): string => { // Return the links href based on the account's preference // If the user's preference is not available, return the original link