This commit is contained in:
Isaac Wise
2024-02-11 01:29:11 -06:00
parent e2c6993a6d
commit 0a77ee90a7
15 changed files with 186 additions and 129 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import { LinkIncludingShortenedCollectionAndTags } from "@/types/global";
export default function CardView({
links,
showCheckbox = true,
editMode
editMode,
}: {
links: LinkIncludingShortenedCollectionAndTags[];
showCheckbox?: boolean;
+1 -2
View File
@@ -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}
/>
);
})}
+3 -2
View File
@@ -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) && (
+16 -8
View File
@@ -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 (
<>
<div
className={`border-neutral-content relative items-center flex ${!showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
} duration-200 rounded-lg`}
className={`border-neutral-content relative items-center flex ${
!showInfo && !isPWA() ? "hover:bg-base-300 p-3" : "py-3"
} duration-200 rounded-lg`}
>
{showCheckbox && editMode &&
{showCheckbox &&
editMode &&
(permissions === true ||
permissions?.canCreate ||
permissions?.canDelete) && (
<input
type="checkbox"
className="checkbox checkbox-primary my-auto mr-2"
checked={selectedLinks.some(selectedLink => 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 ? (
<div>