From 155c77cbc4c26db54cc6e15e0504e4220651cfe3 Mon Sep 17 00:00:00 2001
From: daniel31x13
Date: Tue, 13 Feb 2024 05:54:18 -0500
Subject: [PATCH] final polishing
---
components/LinkViews/LinkCard.tsx | 40 ++++---
components/LinkViews/LinkList.tsx | 101 +++++++++---------
.../ModalContent/BulkDeleteLinksModal.tsx | 7 +-
.../ModalContent/BulkEditLinksModal.tsx | 15 +--
pages/collections/[id].tsx | 93 ++++++++--------
pages/links/index.tsx | 65 +++++------
pages/links/pinned.tsx | 65 ++++++-----
pages/tags/[id].tsx | 84 +++++++--------
8 files changed, 239 insertions(+), 231 deletions(-)
diff --git a/components/LinkViews/LinkCard.tsx b/components/LinkViews/LinkCard.tsx
index d5f6ada..3cbaf25 100644
--- a/components/LinkViews/LinkCard.tsx
+++ b/components/LinkViews/LinkCard.tsx
@@ -27,11 +27,7 @@ type Props = {
editMode?: boolean;
};
-export default function LinkCard({
- link,
- flipDropdown,
- editMode,
-}: Props) {
+export default function LinkCard({ link, flipDropdown, editMode }: Props) {
const { collections } = useCollectionStore();
const { account } = useAccountStore();
@@ -96,17 +92,21 @@ export default function LinkCard({
const [showInfo, setShowInfo] = useState(false);
- const selectedStyle = selectedLinks.some((selectedLink) => selectedLink.id === link.id) ? "border-primary bg-base-300" : "border-neutral-content";
- const selectable = editMode && (permissions === true || permissions?.canCreate || permissions?.canDelete);
- const hoverStyles = !selectable ? "cursor-not-allowed" : "cursor-pointer";
+ const selectedStyle = selectedLinks.some(
+ (selectedLink) => selectedLink.id === link.id
+ )
+ ? "border-primary bg-base-300"
+ : "border-neutral-content";
+ const selectable =
+ editMode &&
+ (permissions === true || permissions?.canCreate || permissions?.canDelete);
return (
selectable && handleCheckboxClick(link)}
>
-
{!editMode ? (
<>
)}
-
@@ -190,7 +188,9 @@ export default function LinkCard({
{link.tags[0] && (
<>
- Tags
+
+ Tags
+
@@ -226,9 +226,7 @@ export default function LinkCard({
>
) : (
<>
-
+
{previewAvailable(link) ? (
)}
-
@@ -305,7 +301,9 @@ export default function LinkCard({
{link.tags[0] && (
<>
-
Tags
+
+ Tags
+
diff --git a/components/LinkViews/LinkList.tsx b/components/LinkViews/LinkList.tsx
index f359a2b..9ea11e5 100644
--- a/components/LinkViews/LinkList.tsx
+++ b/components/LinkViews/LinkList.tsx
@@ -76,17 +76,21 @@ 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";
+ 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);
return (
<>
selectable && handleCheckboxClick(link)}
>
{/* {showCheckbox &&
@@ -144,13 +148,15 @@ export default function LinkCardCompact({
collection={collection}
position="top-3 right-3"
flipDropdown={flipDropdown}
- // toggleShowInfo={() => setShowInfo(!showInfo)}
- // linkInfo={showInfo}
+ // toggleShowInfo={() => setShowInfo(!showInfo)}
+ // linkInfo={showInfo}
/>
{showInfo && (
-
Description
+
+ Description
+
@@ -192,51 +198,50 @@ export default function LinkCardCompact({
)}
>
- ) :
- (
- <>
-
-
-
-
+ ) : (
+ <>
+
+
+
+
-
-
- {unescapeString(link.name || link.description) || link.url}
-
+
+
+ {unescapeString(link.name || link.description) || link.url}
+
-
-
- {collection ? (
-
- ) : undefined}
- {link.url ? (
-
- ) : (
-
- {link.type}
-
- )}
-
-
+
+
+ {collection ? (
+
+ ) : undefined}
+ {link.url ? (
+
+ ) : (
+
+ {link.type}
+
+ )}
+
-
+ setShowInfo(!showInfo)}
// linkInfo={showInfo}
- />
- >
- )}
+ />
+ >
+ )}
>
diff --git a/components/ModalContent/BulkDeleteLinksModal.tsx b/components/ModalContent/BulkDeleteLinksModal.tsx
index 3d76c4e..6de26cd 100644
--- a/components/ModalContent/BulkDeleteLinksModal.tsx
+++ b/components/ModalContent/BulkDeleteLinksModal.tsx
@@ -23,15 +23,16 @@ export default function BulkDeleteLinksModal({ onClose }: Props) {
toast.dismiss(load);
- response.ok &&
+ if (response.ok) {
toast.success(
`Deleted ${selectedLinks.length} Link${
selectedLinks.length > 1 ? "s" : ""
}`
);
- setSelectedLinks([]);
- onClose();
+ setSelectedLinks([]);
+ onClose();
+ } else toast.error(response.data as string);
};
return (
diff --git a/components/ModalContent/BulkEditLinksModal.tsx b/components/ModalContent/BulkEditLinksModal.tsx
index 7192a2b..e552746 100644
--- a/components/ModalContent/BulkEditLinksModal.tsx
+++ b/components/ModalContent/BulkEditLinksModal.tsx
@@ -44,24 +44,25 @@ export default function BulkEditLinksModal({ onClose }: Props) {
if (response.ok) {
toast.success(`Updated!`);
+ setSelectedLinks([]);
onClose();
} else toast.error(response.data as string);
- setSelectedLinks([]);
setSubmitLoader(false);
- onClose();
return response;
}
};
return (
- Edit Link
+
+ Edit {selectedLinks.length} Link{selectedLinks.length > 1 ? "s" : ""}
+
-
Collection
+
Move to Collection
-
-