minor improvement
This commit is contained in:
parent
2993347dc7
commit
cbf93dcf06
|
@ -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 (
|
||||
<div
|
||||
ref={ref}
|
||||
|
@ -220,7 +220,7 @@ export default function LinkCard({ link, columns, editMode }: Props) {
|
|||
<hr className="divider mt-2 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
|
||||
|
||||
<div className="flex justify-between items-center text-xs text-neutral px-3 pb-1 gap-2">
|
||||
{show.collection && (
|
||||
{show.collection && !isPublicRoute && (
|
||||
<div className="cursor-pointer truncate">
|
||||
<LinkCollection link={link} collection={collection} />
|
||||
</div>
|
||||
|
|
|
@ -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 ? (
|
||||
<>
|
||||
<Link
|
||||
href={`/collections/${link.collection.id}`}
|
||||
|
@ -40,7 +45,5 @@ export default function LinkCollection({
|
|||
<p className="truncate capitalize">{collection?.name}</p>
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
);
|
||||
) : null;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ export default function LinkMasonry({ link, editMode, columns }: Props) {
|
|||
<hr className="divider mt-2 mb-1 last:hidden border-t border-neutral-content h-[1px]" />
|
||||
|
||||
<div className="flex flex-wrap justify-between items-center text-xs text-neutral px-3 pb-1 w-full gap-x-2">
|
||||
{show.collection && (
|
||||
{!isPublic && show.collection && (
|
||||
<div className="cursor-pointer truncate">
|
||||
<LinkCollection link={link} collection={collection} />
|
||||
</div>
|
||||
|
|
Ŝarĝante…
Reference in New Issue