Allow users to choose what clicking links opens

This commit is contained in:
Isaac Wise
2024-02-08 00:42:58 -06:00
parent 7d9cc1f1f0
commit cc915c8a64
6 changed files with 82 additions and 38 deletions
+7 -9
View File
@@ -1,4 +1,5 @@
import {
ArchivedFormat,
CollectionIncludingMembersAndLinkCount,
LinkIncludingShortenedCollectionAndTags,
} from "@/types/global";
@@ -12,6 +13,7 @@ import LinkCollection from "@/components/LinkViews/LinkComponents/LinkCollection
import LinkIcon from "@/components/LinkViews/LinkComponents/LinkIcon";
import Link from "next/link";
import { isPWA } from "@/lib/client/utils";
import { generateLinkHrefBasedOnUserPreference } from "@/lib/client/generateHrefBasedOnUserPreference ";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -22,12 +24,9 @@ type Props = {
export default function LinkCardCompact({
link,
count,
className,
flipDropdown,
}: Props) {
const { collections } = useCollectionStore();
const { links } = useLinkStore();
let shortendURL;
@@ -58,12 +57,11 @@ export default function LinkCardCompact({
return (
<>
<div
className={`border-neutral-content relative ${
!showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
} duration-200 rounded-lg`}
className={`border-neutral-content relative ${!showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
} duration-200 rounded-lg`}
>
<Link
href={link.url || ""}
href={generateLinkHrefBasedOnUserPreference(link)}
target="_blank"
className="flex items-start cursor-pointer"
>
@@ -102,8 +100,8 @@ export default function LinkCardCompact({
collection={collection}
position="top-3 right-3"
flipDropdown={flipDropdown}
// toggleShowInfo={() => setShowInfo(!showInfo)}
// linkInfo={showInfo}
// toggleShowInfo={() => setShowInfo(!showInfo)}
// linkInfo={showInfo}
/>
{showInfo ? (
<div>