Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 2 additions & 55 deletions src/@/components/BookmarkForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Toaster } from './ui/Toaster.tsx';
import { getCollections } from '../lib/actions/collections.ts';
import { getTags } from '../lib/actions/tags.ts';
import { X } from 'lucide-react';
import { Popover, PopoverContent, PopoverTrigger } from './ui/Popover.tsx';
import { Popover, PopoverTrigger } from './ui/Popover.tsx';
import { CaretSortIcon } from '@radix-ui/react-icons';
import {
Command,
Expand Down Expand Up @@ -233,7 +233,7 @@ const BookmarkForm = () => {
</FormControl>
</PopoverTrigger>

{!openOptions && openCollections ? (
{openCollections ? (
<div
className={`fade-up min-w-full p-0 overflow-y-auto ${
openCollections
Expand Down Expand Up @@ -301,59 +301,6 @@ const BookmarkForm = () => {
)}
</Command>
</div>
) : openOptions && openCollections ? (
<PopoverContent
className={`min-w-full p-0 overflow-y-auto max-h-[200px]`}
>
<Command className="flex-grow min-w-full dropdown-content">
<CommandInput
className="min-w-[280px]"
placeholder="Search collection..."
/>
<CommandEmpty>No Collection found.</CommandEmpty>
{Array.isArray(collections) && (
<CommandGroup className="w-full">
{isLoading ? (
<CommandItem
value="Getting collections..."
key="Getting collections..."
onSelect={() => {
form.setValue('collection', {
name: 'Unorganized',
});
setOpenCollections(false);
}}
>
Unorganized
</CommandItem>
) : (
collections?.map(
(collection: {
name: string;
id: number;
ownerId: number;
}) => (
<CommandItem
value={collection.name}
key={collection.id}
onSelect={() => {
form.setValue('collection', {
ownerId: collection.ownerId,
id: collection.id,
name: collection.name,
});
setOpenCollections(false);
}}
>
{collection.name}
</CommandItem>
)
)
)}
</CommandGroup>
)}
</Command>
</PopoverContent>
) : undefined}
</Popover>
</div>
Expand Down