Fixed builds failing

This commit is contained in:
Isaac Wise 2024-02-10 02:34:52 -06:00
parent c78aa2da0d
commit e0705ece4f
3 changed files with 8 additions and 6 deletions

View File

@ -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"
>
<Link
href={generateLinkHref(link)}
href={generateLinkHref(link, account)}
target="_blank"
className="rounded-2xl cursor-pointer"
>

View File

@ -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`}
>
<Link
href={generateLinkHref(link)}
href={generateLinkHref(link, account)}
target="_blank"
className="flex items-start cursor-pointer"
>

View File

@ -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