diff --git a/components/LinkViews/LinkComponents/LinkCard.tsx b/components/LinkViews/LinkComponents/LinkCard.tsx index d92a687..43331b1 100644 --- a/components/LinkViews/LinkComponents/LinkCard.tsx +++ b/components/LinkViews/LinkComponents/LinkCard.tsx @@ -113,8 +113,7 @@ export default function LinkCard({ link, columns, editMode }: Props) { const permissions = usePermissions(collection?.id as number); const router = useRouter(); - - let isPublic = router.pathname.startsWith("/public") ? true : undefined; + const isPublicRoute = router.pathname.startsWith("/public") ? true : false; useEffect(() => { let interval: NodeJS.Timeout | null = null; @@ -125,7 +124,10 @@ export default function LinkCard({ link, columns, editMode }: Props) { link.preview !== "unavailable" ) { interval = setInterval(async () => { - getLink.mutateAsync({ id: link.id as number, isPublicRoute: isPublic }); + getLink.mutateAsync({ + id: link.id as number, + isPublicRoute: isPublicRoute, + }); }, 5000); } @@ -146,8 +148,6 @@ export default function LinkCard({ link, columns, editMode }: Props) { editMode && (permissions === true || permissions?.canCreate || permissions?.canDelete); - const isPublicRoute = router.pathname.startsWith("/public") ? true : false; - return (
- {show.collection && ( + {show.collection && !isPublicRoute && (
diff --git a/components/LinkViews/LinkComponents/LinkCollection.tsx b/components/LinkViews/LinkComponents/LinkCollection.tsx index fdc2939..885a015 100644 --- a/components/LinkViews/LinkComponents/LinkCollection.tsx +++ b/components/LinkViews/LinkComponents/LinkCollection.tsx @@ -5,6 +5,7 @@ import { } from "@/types/global"; import { IconWeight } from "@phosphor-icons/react"; import Link from "next/link"; +import { useRouter } from "next/router"; import React from "react"; export default function LinkCollection({ @@ -14,7 +15,11 @@ export default function LinkCollection({ link: LinkIncludingShortenedCollectionAndTags; collection: CollectionIncludingMembersAndLinkCount; }) { - return collection?.name ? ( + const router = useRouter(); + + const isPublicRoute = router.pathname.startsWith("/public") ? true : false; + + return !isPublicRoute && collection?.name ? ( <> {collection?.name}

- ) : ( - <> - ); + ) : null; } diff --git a/components/LinkViews/LinkComponents/LinkMasonry.tsx b/components/LinkViews/LinkComponents/LinkMasonry.tsx index eba1779..2b501ea 100644 --- a/components/LinkViews/LinkComponents/LinkMasonry.tsx +++ b/components/LinkViews/LinkComponents/LinkMasonry.tsx @@ -232,7 +232,7 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
- {show.collection && ( + {!isPublic && show.collection && (