diff --git a/components/InputSelect/CollectionSelection.tsx b/components/InputSelect/CollectionSelection.tsx index 0d98bd65..cac9c46b 100644 --- a/components/InputSelect/CollectionSelection.tsx +++ b/components/InputSelect/CollectionSelection.tsx @@ -7,15 +7,16 @@ import CreatableSelect from "react-select/creatable"; type Props = { onChange: any; + showDefaultValue?: boolean; defaultValue?: - | { - label: string; - value?: number; - } - | undefined; + | { + label: string; + value?: number; + } + | undefined; }; -export default function CollectionSelection({ onChange, defaultValue }: Props) { +export default function CollectionSelection({ onChange, defaultValue, showDefaultValue = true }: Props) { const { collections } = useCollectionStore(); const router = useRouter(); @@ -50,8 +51,8 @@ export default function CollectionSelection({ onChange, defaultValue }: Props) { onChange={onChange} options={options} styles={styles} - defaultValue={defaultValue} - // menuPosition="fixed" + defaultValue={showDefaultValue ? defaultValue : null} + // menuPosition="fixed" /> ); } diff --git a/components/LinkViews/LinkList.tsx b/components/LinkViews/LinkList.tsx index 78f5cb78..df899def 100644 --- a/components/LinkViews/LinkList.tsx +++ b/components/LinkViews/LinkList.tsx @@ -35,11 +35,13 @@ export default function LinkCardCompact({ const { account } = useAccountStore(); const { links, setSelectedLinks, selectedLinks } = useLinkStore(); - const handleCheckboxClick = ( - link: LinkIncludingShortenedCollectionAndTags - ) => { - if (selectedLinks.includes(link)) { - setSelectedLinks(selectedLinks.filter((e) => e !== link)); + const handleCheckboxClick = (link: LinkIncludingShortenedCollectionAndTags) => { + const linkIndex = selectedLinks.findIndex(selectedLink => selectedLink.id === link.id); + + if (linkIndex !== -1) { + const updatedLinks = [...selectedLinks]; + updatedLinks.splice(linkIndex, 1); + setSelectedLinks(updatedLinks); } else { setSelectedLinks([...selectedLinks, link]); } @@ -85,7 +87,7 @@ export default function LinkCardCompact({ selectedLink.id === link.id)} onChange={() => handleCheckboxClick(link)} /> )} diff --git a/components/ModalContent/BulkEditLinksModal.tsx b/components/ModalContent/BulkEditLinksModal.tsx index c161f93e..f274f736 100644 --- a/components/ModalContent/BulkEditLinksModal.tsx +++ b/components/ModalContent/BulkEditLinksModal.tsx @@ -57,7 +57,7 @@ export default function BulkEditLinksModal({ onClose }: Props) {
Collection
-By {collectionOwner.name} - {activeCollection.members.length > 0 - ? ` and ${activeCollection.members.length} others` - : undefined} - . + {activeCollection.members.length > 0 && + ` and ${activeCollection.members.length} others`}.
{activeCollection?.description}
- ) : undefined} + )} {/* {collections.some((e) => e.parentId === activeCollection.id) ? (