rename function
This commit is contained in:
parent
cc915c8a64
commit
39261de45e
|
@ -15,7 +15,7 @@ import { previewAvailable } from "@/lib/shared/getArchiveValidity";
|
||||||
import Link from "next/link";
|
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 { generateHrefBasedOnUserPreference } from "@/lib/client/generateHrefBasedOnUserPreference ";
|
import { generateLinkHref } from "@/lib/client/generateLinkHref";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
link: LinkIncludingShortenedCollectionAndTags;
|
link: LinkIncludingShortenedCollectionAndTags;
|
||||||
|
@ -86,7 +86,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={generateHrefBasedOnUserPreference(link)}
|
href={generateLinkHref(link)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="rounded-2xl cursor-pointer"
|
className="rounded-2xl cursor-pointer"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {
|
import {
|
||||||
ArchivedFormat,
|
|
||||||
CollectionIncludingMembersAndLinkCount,
|
CollectionIncludingMembersAndLinkCount,
|
||||||
LinkIncludingShortenedCollectionAndTags,
|
LinkIncludingShortenedCollectionAndTags,
|
||||||
} from "@/types/global";
|
} from "@/types/global";
|
||||||
|
@ -13,7 +12,7 @@ import LinkCollection from "@/components/LinkViews/LinkComponents/LinkCollection
|
||||||
import LinkIcon from "@/components/LinkViews/LinkComponents/LinkIcon";
|
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 { generateLinkHrefBasedOnUserPreference } from "@/lib/client/generateHrefBasedOnUserPreference ";
|
import { generateLinkHref } from "@/lib/client/generateLinkHref";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
link: LinkIncludingShortenedCollectionAndTags;
|
link: LinkIncludingShortenedCollectionAndTags;
|
||||||
|
@ -61,7 +60,7 @@ export default function LinkCardCompact({
|
||||||
} duration-200 rounded-lg`}
|
} duration-200 rounded-lg`}
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
href={generateLinkHrefBasedOnUserPreference(link)}
|
href={generateLinkHref(link)}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="flex items-start cursor-pointer"
|
className="flex items-start cursor-pointer"
|
||||||
>
|
>
|
||||||
|
|
|
@ -2,7 +2,7 @@ import useAccountStore from "@/store/account";
|
||||||
import { ArchivedFormat, LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
import { ArchivedFormat, LinkIncludingShortenedCollectionAndTags } from "@/types/global";
|
||||||
import { LinksRouteTo } from "@prisma/client";
|
import { LinksRouteTo } from "@prisma/client";
|
||||||
|
|
||||||
export const generateLinkHrefBasedOnUserPreference = (link: LinkIncludingShortenedCollectionAndTags): string => {
|
export const generateLinkHref = (link: LinkIncludingShortenedCollectionAndTags): string => {
|
||||||
const { account } = useAccountStore();
|
const { account } = useAccountStore();
|
||||||
|
|
||||||
switch (account.linksRouteTo) {
|
switch (account.linksRouteTo) {
|
Ŝarĝante…
Reference in New Issue