- {unescapeString(link.name || link.description) || link.url}
-
+
+ {unescapeString(link.name || link.description) || link.url}
+
- {showInfo ? (
-
-
setShowInfo(!showInfo)}
- className=" float-right btn btn-sm outline-none btn-circle btn-ghost z-10"
- >
-
-
-
Description
-
-
-
- {link.description ? (
- unescapeString(link.description)
- ) : (
-
- No description provided.
-
- )}
-
- {link.tags[0] ? (
- <>
-
Tags
-
-
-
-
-
- {link.tags.map((e, i) => (
-
{
- e.stopPropagation();
- }}
- className="btn btn-xs btn-ghost truncate max-w-[19rem]"
- >
- #{e.name}
-
- ))}
+
- >
- ) : undefined}
-
- ) : undefined}
+
-
setShowInfo(!showInfo)}
- linkInfo={showInfo}
- flipDropdown={flipDropdown}
- />
+
+
+
+
+ {collection && (
+
+ )}
+
+
+
+
+
+ {showInfo && (
+
+
setShowInfo(!showInfo)}
+ className=" float-right btn btn-sm outline-none btn-circle btn-ghost z-10"
+ >
+
+
+
Description
+
+
+
+ {link.description ? (
+ unescapeString(link.description)
+ ) : (
+
+ No description provided.
+
+ )}
+
+ {link.tags[0] && (
+ <>
+
Tags
+
+
+
+
+
+ {link.tags.map((e, i) => (
+ {
+ e.stopPropagation();
+ }}
+ className="btn btn-xs btn-ghost truncate max-w-[19rem]"
+ >
+ #{e.name}
+
+ ))}
+
+
+ >
+ )}
+
+ )}
+
+ setShowInfo(!showInfo)}
+ linkInfo={showInfo}
+ flipDropdown={flipDropdown}
+ />
+ >
+ ) : (
+ <>
+
+
+ {previewAvailable(link) ? (
+
{
+ const target = e.target as HTMLElement;
+ target.style.display = "none";
+ }}
+ />
+ ) : link.preview === "unavailable" ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+
+ {unescapeString(link.name || link.description) || link.url}
+
+
+
+
+
+
+
+
+
+ {collection && (
+
+ )}
+
+
+
+
+
+ {showInfo && (
+
+
setShowInfo(!showInfo)}
+ className=" float-right btn btn-sm outline-none btn-circle btn-ghost z-10"
+ >
+
+
+
Description
+
+
+
+ {link.description ? (
+ unescapeString(link.description)
+ ) : (
+
+ No description provided.
+
+ )}
+
+ {link.tags[0] && (
+ <>
+
Tags
+
+
+
+
+
+ {link.tags.map((e, i) => (
+ {
+ e.stopPropagation();
+ }}
+ className="btn btn-xs btn-ghost truncate max-w-[19rem]"
+ >
+ #{e.name}
+
+ ))}
+
+
+ >
+ )}
+
+ )}
+
+ setShowInfo(!showInfo)}
+ linkInfo={showInfo}
+ flipDropdown={flipDropdown}
+ />
+ >
+ )}
);
}
diff --git a/components/LinkViews/LinkList.tsx b/components/LinkViews/LinkList.tsx
index 8467000..f359a2b 100644
--- a/components/LinkViews/LinkList.tsx
+++ b/components/LinkViews/LinkList.tsx
@@ -21,14 +21,12 @@ type Props = {
count: number;
className?: string;
flipDropdown?: boolean;
- showCheckbox?: boolean;
editMode?: boolean;
};
export default function LinkCardCompact({
link,
flipDropdown,
- showCheckbox = true,
editMode,
}: Props) {
const { collections } = useCollectionStore();
@@ -78,14 +76,20 @@ export default function LinkCardCompact({
const [showInfo, setShowInfo] = useState(false);
+ const selectedStyle = selectedLinks.some((selectedLink) => selectedLink.id === link.id) ? "border border-primary bg-base-300" : "border-transparent";
+ const selectable = editMode && (permissions === true || permissions?.canCreate || permissions?.canDelete);
+ const hoverStyles = !selectable ? "cursor-not-allowed" : "cursor-pointer";
+
return (
<>
selectable && handleCheckboxClick(link)}
>
- {showCheckbox &&
+ {/* {showCheckbox &&
editMode &&
(permissions === true ||
permissions?.canCreate ||
@@ -98,96 +102,142 @@ export default function LinkCardCompact({
)}
onChange={() => handleCheckboxClick(link)}
/>
- )}
-
-
-
-
-
-
-
- {unescapeString(link.name || link.description) || link.url}
-
-
-
-
- {collection ? (
-
- ) : undefined}
- {link.url ? (
-
- ) : (
-
- {link.type}
-
- )}
-
+ )} */}
+ {!editMode ? (
+ <>
+
+
+
-
-
-
-
setShowInfo(!showInfo)}
- // linkInfo={showInfo}
- />
- {showInfo ? (
-
-
-
Description
+
+
+ {unescapeString(link.name || link.description) || link.url}
+
-
-
- {link.description ? (
- unescapeString(link.description)
- ) : (
-
- No description provided.
-
- )}
-
- {link.tags[0] ? (
- <>
-
- Tags
-
+
+
+ {collection && (
+
+ )}
+ {link.url ? (
+
+ ) : (
+
+ {link.type}
+
+ )}
+
+
+
+
+
+
setShowInfo(!showInfo)}
+ // linkInfo={showInfo}
+ />
+ {showInfo && (
+
+
+
Description
+
+ {link.description ? (
+ unescapeString(link.description)
+ ) : (
+
+ No description provided.
+
+ )}
+
+ {link.tags[0] && (
+ <>
+
+ Tags
+
-
-
- {link.tags.map((e, i) => (
-
{
- e.stopPropagation();
- }}
- className="btn btn-xs btn-ghost truncate max-w-[19rem]"
- >
- #{e.name}
-
- ))}
+
+
+
+
+ {link.tags.map((e, i) => (
+ {
+ e.stopPropagation();
+ }}
+ className="btn btn-xs btn-ghost truncate max-w-[19rem]"
+ >
+ #{e.name}
+
+ ))}
+
+
+ >
+ )}
+
+
+ )}
+ >
+ ) :
+ (
+ <>
+
+
+
+
+
+
+
+ {unescapeString(link.name || link.description) || link.url}
+
+
+
+
+ {collection ? (
+
+ ) : undefined}
+ {link.url ? (
+
+ ) : (
+
+ {link.type}
+
+ )}
+
- >
- ) : undefined}
-
-
- ) : undefined}
+
+
+ setShowInfo(!showInfo)}
+ // linkInfo={showInfo}
+ />
+ >
+ )}
-
>
);
diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx
index 81398d7..2d58286 100644
--- a/pages/collections/[id].tsx
+++ b/pages/collections/[id].tsx
@@ -329,7 +329,7 @@ export default function Index() {
-
+
-
+
{links.length > 0 && editMode && (
link.collectionId as number)
+ links.map((link) => link.collectionId as number)
);
useLinks({ sort: sortBy });
@@ -44,8 +44,7 @@ export default function PinnedLinks() {
const bulkDeleteLinks = async () => {
const load = toast.loading(
- `Deleting ${selectedLinks.length} Link${
- selectedLinks.length > 1 ? "s" : ""
+ `Deleting ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : ""
}...`
);
@@ -57,8 +56,7 @@ export default function PinnedLinks() {
response.ok &&
toast.success(
- `Deleted ${selectedLinks.length} Link${
- selectedLinks.length > 1 ? "s" : ""
+ `Deleted ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : ""
}!`
);
};
@@ -82,18 +80,17 @@ export default function PinnedLinks() {
description={"Pinned Links from your Collections"}
/>
- {links.length > 0 && (
+ {!(links.length === 0) && (
{
setEditMode(!editMode);
setSelectedLinks([]);
}}
- className={`btn btn-square btn-sm btn-ghost ${
- editMode
- ? "bg-primary/20 hover:bg-primary/20"
- : "hover:bg-neutral/20"
- }`}
+ className={`btn btn-square btn-sm btn-ghost ${editMode
+ ? "bg-primary/20 hover:bg-primary/20"
+ : "hover:bg-neutral/20"
+ }`}
>
@@ -103,57 +100,53 @@ export default function PinnedLinks() {
- {editMode && (
-
- {links.length > 0 && (
-
- handleSelectAll()}
- checked={
- selectedLinks.length === links.length && links.length > 0
- }
- />
- {selectedLinks.length > 0 ? (
-
- {selectedLinks.length}{" "}
- {selectedLinks.length === 1 ? "link" : "links"} selected
-
- ) : (
- Nothing selected
- )}
-
- )}
-
- {selectedLinks.length > 0 &&
- (collectivePermissions === true ||
- collectivePermissions?.canUpdate) && (
-
- )}
- {selectedLinks.length > 0 &&
- (collectivePermissions === true ||
- collectivePermissions?.canDelete) && (
-
- )}
+
+ {links.length > 0 && editMode && (
+
+ handleSelectAll()}
+ checked={
+ selectedLinks.length === links.length && links.length > 0
+ }
+ />
+ {selectedLinks.length > 0 ? (
+
+ {selectedLinks.length}{" "}
+ {selectedLinks.length === 1 ? "link" : "links"} selected
+
+ ) : (
+ Nothing selected
+ )}
+ )}
+
+ {(collectivePermissions === true || collectivePermissions?.canUpdate) && (
+
+ )}
+ {(collectivePermissions === true || collectivePermissions?.canDelete) && (
+
+ )}
- )}
+
{links.some((e) => e.pinnedBy && e.pinnedBy[0]) ? (