diff --git a/components/InputSelect/CollectionSelection.tsx b/components/InputSelect/CollectionSelection.tsx
index cac9c46..dcbbe0f 100644
--- a/components/InputSelect/CollectionSelection.tsx
+++ b/components/InputSelect/CollectionSelection.tsx
@@ -9,14 +9,18 @@ type Props = {
onChange: any;
showDefaultValue?: boolean;
defaultValue?:
- | {
- label: string;
- value?: number;
- }
- | undefined;
+ | {
+ label: string;
+ value?: number;
+ }
+ | undefined;
};
-export default function CollectionSelection({ onChange, defaultValue, showDefaultValue = true }: Props) {
+export default function CollectionSelection({
+ onChange,
+ defaultValue,
+ showDefaultValue = true,
+}: Props) {
const { collections } = useCollectionStore();
const router = useRouter();
@@ -52,7 +56,7 @@ export default function CollectionSelection({ onChange, defaultValue, showDefaul
options={options}
styles={styles}
defaultValue={showDefaultValue ? defaultValue : null}
- // menuPosition="fixed"
+ // menuPosition="fixed"
/>
);
}
diff --git a/components/LinkViews/Layouts/CardView.tsx b/components/LinkViews/Layouts/CardView.tsx
index dce29c0..0da91a4 100644
--- a/components/LinkViews/Layouts/CardView.tsx
+++ b/components/LinkViews/Layouts/CardView.tsx
@@ -4,7 +4,7 @@ import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
export default function CardView({
links,
showCheckbox = true,
- editMode
+ editMode,
}: {
links: LinkIncludingShortenedCollectionAndTags[];
showCheckbox?: boolean;
diff --git a/components/LinkViews/Layouts/ListView.tsx b/components/LinkViews/Layouts/ListView.tsx
index 7ff2ba0..c74b84e 100644
--- a/components/LinkViews/Layouts/ListView.tsx
+++ b/components/LinkViews/Layouts/ListView.tsx
@@ -4,7 +4,7 @@ import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
export default function ListView({
links,
showCheckbox = true,
- editMode
+ editMode,
}: {
links: LinkIncludingShortenedCollectionAndTags[];
showCheckbox?: boolean;
@@ -21,7 +21,6 @@ export default function ListView({
showCheckbox={showCheckbox}
flipDropdown={i === links.length - 1}
editMode={editMode}
-
/>
);
})}
diff --git a/components/LinkViews/LinkCard.tsx b/components/LinkViews/LinkCard.tsx
index 9cc1c62..2e9544b 100644
--- a/components/LinkViews/LinkCard.tsx
+++ b/components/LinkViews/LinkCard.tsx
@@ -32,7 +32,7 @@ export default function LinkCard({
link,
flipDropdown,
showCheckbox = true,
- editMode
+ editMode,
}: Props) {
const { collections } = useCollectionStore();
const { account } = useAccountStore();
@@ -103,7 +103,8 @@ export default function LinkCard({
ref={ref}
className="border border-solid border-neutral-content bg-base-200 shadow-md hover:shadow-none duration-100 rounded-2xl relative"
>
- {showCheckbox && editMode &&
+ {showCheckbox &&
+ editMode &&
(permissions === true ||
permissions?.canCreate ||
permissions?.canDelete) && (
diff --git a/components/LinkViews/LinkList.tsx b/components/LinkViews/LinkList.tsx
index df899de..8467000 100644
--- a/components/LinkViews/LinkList.tsx
+++ b/components/LinkViews/LinkList.tsx
@@ -35,8 +35,12 @@ export default function LinkCardCompact({
const { account } = useAccountStore();
const { links, setSelectedLinks, selectedLinks } = useLinkStore();
- const handleCheckboxClick = (link: LinkIncludingShortenedCollectionAndTags) => {
- const linkIndex = selectedLinks.findIndex(selectedLink => selectedLink.id === link.id);
+ const handleCheckboxClick = (
+ link: LinkIncludingShortenedCollectionAndTags
+ ) => {
+ const linkIndex = selectedLinks.findIndex(
+ (selectedLink) => selectedLink.id === link.id
+ );
if (linkIndex !== -1) {
const updatedLinks = [...selectedLinks];
@@ -77,17 +81,21 @@ export default function LinkCardCompact({
return (
<>
- {showCheckbox && editMode &&
+ {showCheckbox &&
+ editMode &&
(permissions === true ||
permissions?.canCreate ||
permissions?.canDelete) && (
selectedLink.id === link.id)}
+ checked={selectedLinks.some(
+ (selectedLink) => selectedLink.id === link.id
+ )}
onChange={() => handleCheckboxClick(link)}
/>
)}
@@ -131,8 +139,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 ? (
diff --git a/components/ModalContent/BulkEditLinksModal.tsx b/components/ModalContent/BulkEditLinksModal.tsx
index 4d576b8..7192a2b 100644
--- a/components/ModalContent/BulkEditLinksModal.tsx
+++ b/components/ModalContent/BulkEditLinksModal.tsx
@@ -34,7 +34,11 @@ export default function BulkEditLinksModal({ onClose }: Props) {
const load = toast.loading("Updating...");
- const response = await updateLinks(selectedLinks, removePreviousTags, updatedValues);
+ const response = await updateLinks(
+ selectedLinks,
+ removePreviousTags,
+ updatedValues
+ );
toast.dismiss(load);
@@ -58,7 +62,10 @@ export default function BulkEditLinksModal({ onClose }: Props) {
@@ -71,7 +78,6 @@ export default function BulkEditLinksModal({ onClose }: Props) {
setRemovePreviousTags(e.target.checked)}
/>
diff --git a/components/ViewDropdown.tsx b/components/ViewDropdown.tsx
index a04c0e2..5ab821e 100644
--- a/components/ViewDropdown.tsx
+++ b/components/ViewDropdown.tsx
@@ -26,20 +26,22 @@ export default function ViewDropdown({ viewMode, setViewMode }: Props) {
diff --git a/hooks/useCollectivePermissions.ts b/hooks/useCollectivePermissions.ts
index c989e60..b1e3b7c 100644
--- a/hooks/useCollectivePermissions.ts
+++ b/hooks/useCollectivePermissions.ts
@@ -4,31 +4,31 @@ import { Member } from "@/types/global";
import { useEffect, useState } from "react";
export default function useCollectivePermissions(collectionIds: number[]) {
- const { collections } = useCollectionStore();
+ const { collections } = useCollectionStore();
- const { account } = useAccountStore();
+ const { account } = useAccountStore();
- const [permissions, setPermissions] = useState
();
- useEffect(() => {
- for (const collectionId of collectionIds) {
- const collection = collections.find((e) => e.id === collectionId);
+ const [permissions, setPermissions] = useState();
+ useEffect(() => {
+ for (const collectionId of collectionIds) {
+ const collection = collections.find((e) => e.id === collectionId);
- if (collection) {
- let getPermission: Member | undefined = collection.members.find(
- (e) => e.userId === account.id
- );
+ if (collection) {
+ let getPermission: Member | undefined = collection.members.find(
+ (e) => e.userId === account.id
+ );
- if (
- getPermission?.canCreate === false &&
- getPermission?.canUpdate === false &&
- getPermission?.canDelete === false
- )
- getPermission = undefined;
+ if (
+ getPermission?.canCreate === false &&
+ getPermission?.canUpdate === false &&
+ getPermission?.canDelete === false
+ )
+ getPermission = undefined;
- setPermissions(account.id === collection.ownerId || getPermission);
- }
- }
- }, [account, collections, collectionIds]);
+ setPermissions(account.id === collection.ownerId || getPermission);
+ }
+ }
+ }, [account, collections, collectionIds]);
- return permissions;
+ return permissions;
}
diff --git a/hooks/useLinks.tsx b/hooks/useLinks.tsx
index fde8bbb..6a06c1b 100644
--- a/hooks/useLinks.tsx
+++ b/hooks/useLinks.tsx
@@ -18,7 +18,8 @@ export default function useLinks(
searchByTextContent,
}: LinkRequestQuery = { sort: 0 }
) {
- const { links, setLinks, resetLinks, selectedLinks, setSelectedLinks } = useLinkStore();
+ const { links, setLinks, resetLinks, selectedLinks, setSelectedLinks } =
+ useLinkStore();
const router = useRouter();
const { reachedBottom, setReachedBottom } = useDetectPageBottom();
@@ -70,7 +71,7 @@ export default function useLinks(
useEffect(() => {
// Save the selected links before resetting the links
// and then restore the selected links after resetting the links
- const previouslySelected = selectedLinks
+ const previouslySelected = selectedLinks;
resetLinks();
setSelectedLinks(previouslySelected);
diff --git a/hooks/usePermissions.tsx b/hooks/usePermissions.tsx
index 354e4cc..746897b 100644
--- a/hooks/usePermissions.tsx
+++ b/hooks/usePermissions.tsx
@@ -29,4 +29,4 @@ export default function usePermissions(collectionId: number) {
}, [account, collections, collectionId]);
return permissions;
-}
\ No newline at end of file
+}
diff --git a/pages/collections/[id].tsx b/pages/collections/[id].tsx
index 0b5d5bc..e4deaef 100644
--- a/pages/collections/[id].tsx
+++ b/pages/collections/[id].tsx
@@ -121,7 +121,8 @@ export default function Index() {
const bulkDeleteLinks = async () => {
const load = toast.loading(
- `Deleting ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : ""
+ `Deleting ${selectedLinks.length} Link${
+ selectedLinks.length > 1 ? "s" : ""
}...`
);
@@ -133,7 +134,8 @@ export default function Index() {
response.ok &&
toast.success(
- `Deleted ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : ""
+ `Deleted ${selectedLinks.length} Link${
+ selectedLinks.length > 1 ? "s" : ""
}!`
);
};
@@ -143,8 +145,9 @@ export default function Index() {
{activeCollection && (
@@ -268,7 +271,8 @@ export default function Index() {
By {collectionOwner.name}
{activeCollection.members.length > 0 &&
- ` and ${activeCollection.members.length} others`}.
+ ` and ${activeCollection.members.length} others`}
+ .
@@ -312,13 +316,14 @@ export default function Index() {
{
- setEditMode(!editMode)
- setSelectedLinks([])
+ 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"
+ }`}
>
@@ -416,17 +421,18 @@ export default function Index() {
{bulkDeleteLinksModal && (
{
- setBulkDeleteLinksModal(false)
- setEditMode(false)
+ setBulkDeleteLinksModal(false);
+ setEditMode(false);
}}
/>
)}
{bulkEditLinksModal && (
{
- setBulkEditLinksModal(false)
- setEditMode(false)
- }} />
+ setBulkEditLinksModal(false);
+ setEditMode(false);
+ }}
+ />
)}
>
)}
diff --git a/pages/links/index.tsx b/pages/links/index.tsx
index bfb1273..7222f87 100644
--- a/pages/links/index.tsx
+++ b/pages/links/index.tsx
@@ -16,18 +16,20 @@ import BulkEditLinksModal from "@/components/ModalContent/BulkEditLinksModal";
// import GridView from "@/components/LinkViews/Layouts/GridView";
export default function Links() {
- const { links, selectedLinks, deleteLinksById, setSelectedLinks } = useLinkStore();
+ const { links, selectedLinks, deleteLinksById, setSelectedLinks } =
+ useLinkStore();
const [viewMode, setViewMode] = useState(
localStorage.getItem("viewMode") || ViewMode.Card
);
const [sortBy, setSortBy] = useState(Sort.DateNewestFirst);
-
const [bulkDeleteLinksModal, setBulkDeleteLinksModal] = useState(false);
const [bulkEditLinksModal, setBulkEditLinksModal] = useState(false);
const [editMode, setEditMode] = useState(false);
- const collectivePermissions = useCollectivePermissions(selectedLinks.map((link) => link.collectionId as number));
+ const collectivePermissions = useCollectivePermissions(
+ selectedLinks.map((link) => link.collectionId as number)
+ );
useLinks({ sort: sortBy });
@@ -41,7 +43,8 @@ export default function Links() {
const bulkDeleteLinks = async () => {
const load = toast.loading(
- `Deleting ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : ""
+ `Deleting ${selectedLinks.length} Link${
+ selectedLinks.length > 1 ? "s" : ""
}...`
);
@@ -53,7 +56,8 @@ export default function Links() {
response.ok &&
toast.success(
- `Deleted ${selectedLinks.length} Link${selectedLinks.length > 1 ? "s" : ""
+ `Deleted ${selectedLinks.length} Link${
+ selectedLinks.length > 1 ? "s" : ""
}!`
);
};
@@ -82,13 +86,14 @@ export default function Links() {
{
- setEditMode(!editMode)
- setSelectedLinks([])
+ 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"
+ }`}
>
@@ -122,7 +127,8 @@ export default function Links() {
)}
{selectedLinks.length > 0 &&
- (collectivePermissions === true || collectivePermissions?.canUpdate) && (
+ (collectivePermissions === true ||
+ collectivePermissions?.canUpdate) && (
)}
{selectedLinks.length > 0 &&
- (collectivePermissions === true || collectivePermissions?.canDelete) && (
+ (collectivePermissions === true ||
+ collectivePermissions?.canDelete) && (