Merge pull request #463 from IsaacWise06/fix-building

Fixed builds failing
This commit is contained in:
Daniel 2024-02-10 12:07:20 +03:30 committed by GitHub
commit 9eaa106766
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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 LinkIcon from "./LinkComponents/LinkIcon";
import useOnScreen from "@/hooks/useOnScreen"; import useOnScreen from "@/hooks/useOnScreen";
import { generateLinkHref } from "@/lib/client/generateLinkHref"; import { generateLinkHref } from "@/lib/client/generateLinkHref";
import useAccountStore from "@/store/account";
type Props = { type Props = {
link: LinkIncludingShortenedCollectionAndTags; link: LinkIncludingShortenedCollectionAndTags;
@ -29,6 +30,7 @@ export default function LinkGrid({
flipDropdown, flipDropdown,
}: Props) { }: Props) {
const { collections } = useCollectionStore(); const { collections } = useCollectionStore();
const { account } = useAccountStore();
const { links, getLink } = useLinkStore(); 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" className="border border-solid border-neutral-content bg-base-200 shadow-md hover:shadow-none duration-100 rounded-2xl relative"
> >
<Link <Link
href={generateLinkHref(link)} href={generateLinkHref(link, account)}
target="_blank" target="_blank"
className="rounded-2xl cursor-pointer" className="rounded-2xl cursor-pointer"
> >

View File

@ -13,6 +13,7 @@ import LinkIcon from "@/components/LinkViews/LinkComponents/LinkIcon";
import Link from "next/link"; import Link from "next/link";
import { isPWA } from "@/lib/client/utils"; import { isPWA } from "@/lib/client/utils";
import { generateLinkHref } from "@/lib/client/generateLinkHref"; import { generateLinkHref } from "@/lib/client/generateLinkHref";
import useAccountStore from "@/store/account";
type Props = { type Props = {
link: LinkIncludingShortenedCollectionAndTags; link: LinkIncludingShortenedCollectionAndTags;
@ -26,6 +27,7 @@ export default function LinkCardCompact({
flipDropdown, flipDropdown,
}: Props) { }: Props) {
const { collections } = useCollectionStore(); const { collections } = useCollectionStore();
const { account } = useAccountStore();
const { links } = useLinkStore(); const { links } = useLinkStore();
let shortendURL; let shortendURL;
@ -60,7 +62,7 @@ export default function LinkCardCompact({
} duration-200 rounded-lg`} } duration-200 rounded-lg`}
> >
<Link <Link
href={generateLinkHref(link)} href={generateLinkHref(link, account)}
target="_blank" target="_blank"
className="flex items-start cursor-pointer" className="flex items-start cursor-pointer"
> >

View File

@ -1,10 +1,8 @@
import useAccountStore from "@/store/account"; import { AccountSettings, ArchivedFormat, LinkIncludingShortenedCollectionAndTags } from "@/types/global";
import { ArchivedFormat, LinkIncludingShortenedCollectionAndTags } from "@/types/global";
import { LinksRouteTo } from "@prisma/client"; import { LinksRouteTo } from "@prisma/client";
import { pdfAvailable, readabilityAvailable, screenshotAvailable } from "../shared/getArchiveValidity"; import { pdfAvailable, readabilityAvailable, screenshotAvailable } from "../shared/getArchiveValidity";
export const generateLinkHref = (link: LinkIncludingShortenedCollectionAndTags): string => { export const generateLinkHref = (link: LinkIncludingShortenedCollectionAndTags, account: AccountSettings): string => {
const { account } = useAccountStore();
// Return the links href based on the account's preference // Return the links href based on the account's preference
// If the user's preference is not available, return the original link // If the user's preference is not available, return the original link