Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

remove cmdk

daniel31x138bb97748eb62
diff --git a/apps/extension/package.json b/apps/extension/package.json
index 18cefdf5..bcf6b671 100644
--- a/apps/extension/package.json
+++ b/apps/extension/package.json
@@ -29,7 +29,6 @@
"axios": "^1.18.0",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
- "cmdk": "^1.1.1",
"lucide-react": "^0.511.0",
"query-string": "^9.5.0",
"react": "19.1.0",
diff --git a/apps/extension/src/@/components/BookmarkForm.tsx b/apps/extension/src/@/components/BookmarkForm.tsx
index 4aba8f0a..9dc019b5 100644
--- a/apps/extension/src/@/components/BookmarkForm.tsx
+++ b/apps/extension/src/@/components/BookmarkForm.tsx
@@ -14,7 +14,8 @@ import {
} from "./ui/Form.tsx";
import { Input } from "./ui/Input.tsx";
import { Button } from "./ui/Button.tsx";
-import { TagInput } from "./TagInput.tsx";
+import TagInput from "./TagInput.tsx";
+import CollectionInput from "./CollectionInput.tsx";
import { Textarea } from "./ui/Textarea.tsx";
import { getCurrentTabInfo, updateBadge } from "../lib/utils.ts";
import { useEffect, useMemo, useState } from "react";
@@ -26,16 +27,7 @@ import { toast } from "../../hooks/use-toast.ts";
import { Toaster } from "./ui/Toaster.tsx";
import { getCollections } from "../lib/actions/collections.ts";
import { getShouldUseTagSearch, getTags } from "../lib/actions/tags.ts";
-import { ExternalLink, X } from "lucide-react";
-import { Popover, PopoverContent, PopoverTrigger } from "./ui/Popover.tsx";
-import { CaretSortIcon } from "@radix-ui/react-icons";
-import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
-} from "./ui/Command.tsx";
+import { ExternalLink } from "lucide-react";
import { Checkbox } from "./ui/CheckBox.tsx";
import { Label } from "./ui/Label.tsx";
@@ -254,172 +246,15 @@ const BookmarkForm = () => {
render={({ field }) => (
<FormItem className={`my-2`}>
<FormLabel>Collection</FormLabel>
- <div className="min-w-full inset-x-0">
- <Popover
- open={openCollections}
- onOpenChange={setOpenCollections}
- >
- <PopoverTrigger asChild>
- <FormControl>
- <Button
- variant="outline"
- role="combobox"
- aria-expanded={openCollections}
- className={
- "w-full justify-between bg-neutral-100 dark:bg-neutral-900"
- }
- >
- {loadingCollections
- ? "Unorganized"
- : field.value?.name
- ? collections?.find(
- (collection: { name: string }) =>
- collection.name === field.value?.name
- )?.name || form.getValues("collection")?.name
- : "Select a collection..."}
- <CaretSortIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
- </Button>
- </FormControl>
- </PopoverTrigger>
-
- {!openOptions && openCollections ? (
- <div
- className={`fade-up min-w-full p-0 overflow-y-auto ${
- openCollections
- ? "fixed inset-0 w-full h-full z-50 bg-white"
- : ""
- }`}
- >
- <Button
- className="absolute top-1 right-1 bg-transparent hover:bg-transparent hover:opacity-50 transition-colors ease-in-out duration-200"
- onClick={() => setOpenCollections(false)}
- >
- <X className={`h-4 w-4 text-black dark:text-white`} />
- </Button>
- <Command className="flex-grow min-w-full dropdown-content rounded-none">
- <CommandInput
- className="min-w-[280px]"
- placeholder="Search Collection..."
- />
-
- {loadingCollections ? (
- <p className="w-full text-center my-auto">
- Loading...
- </p>
- ) : (
- <>
- <CommandEmpty>No Collection found.</CommandEmpty>
- {Array.isArray(collections) && (
- <CommandGroup className="w-full overflow-y-auto">
- {isPending ? (
- <CommandItem
- value="Loading collections..."
- key="Loading collections..."
- onSelect={() => {
- form.setValue("collection", {
- name: "Unorganized",
- });
- setOpenCollections(false);
- }}
- >
- Unorganized
- </CommandItem>
- ) : (
- collections?.map(
- (collection: {
- name: string;
- id: number;
- ownerId: number;
- pathname: string;
- }) => (
- <CommandItem
- value={collection.name}
- key={collection.id}
- className="cursor-pointer flex flex-col items-start justify-start"
- onSelect={() => {
- form.setValue("collection", {
- ownerId: collection.ownerId,
- id: collection.id,
- name: collection.name,
- });
- setOpenCollections(false);
- }}
- >
- <p>{collection.name}</p>
- <p className="text-xs text-neutral-500">
- {collection.pathname}
- </p>
- </CommandItem>
- )
- )
- )}
- </CommandGroup>
- )}
- </>
- )}
- </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">
- {isPending ? (
- <CommandItem
- value="Loading collections..."
- key="Loading collections..."
- onSelect={() => {
- form.setValue("collection", {
- name: "Unorganized",
- });
- setOpenCollections(false);
- }}
- >
- Unorganized
- </CommandItem>
- ) : (
- collections?.map(
- (collection: {
- name: string;
- id: number;
- ownerId: number;
- pathname: string;
- }) => (
- <CommandItem
- value={collection.name}
- key={collection.id}
- className="cursor-pointer flex flex-col items-start justify-start"
- onSelect={() => {
- form.setValue("collection", {
- ownerId: collection.ownerId,
- id: collection.id,
- name: collection.name,
- });
- setOpenCollections(false);
- }}
- >
- <p>{collection.name}</p>
- <p className="text-xs text-neutral-500">
- {collection.pathname}
- </p>
- </CommandItem>
- )
- )
- )}
- </CommandGroup>
- )}
- </Command>
- </PopoverContent>
- ) : undefined}
- </Popover>
- </div>
+ <CollectionInput
+ value={field.value}
+ onChange={field.onChange}
+ collections={collections}
+ isLoading={loadingCollections}
+ open={openCollections}
+ onOpenChange={setOpenCollections}
+ fullScreen={!openOptions}
+ />
<FormMessage />
</FormItem>
)}
diff --git a/apps/extension/src/@/components/CollectionInput.tsx b/apps/extension/src/@/components/CollectionInput.tsx
new file mode 100644
index 00000000..1f1c2f62
--- /dev/null
+++ b/apps/extension/src/@/components/CollectionInput.tsx
@@ -0,0 +1,133 @@
+import { useMemo, useState } from "react";
+import { CaretSortIcon } from "@radix-ui/react-icons";
+import { Search, X } from "lucide-react";
+import { Button } from "./ui/Button.tsx";
+import { FormControl } from "./ui/Form.tsx";
+import { Popover, PopoverContent, PopoverTrigger } from "./ui/Popover.tsx";
+import { Collection } from "../lib/actions/collections.ts";
+
+type Props = {
+ value?: { id?: number; ownerId?: number; name: string };
+ onChange: (collection: {
+ id?: number;
+ ownerId?: number;
+ name: string;
+ }) => void;
+ collections: Collection[] | undefined;
+ isLoading: boolean;
+ open: boolean;
+ onOpenChange: (open: boolean) => void;
+ fullScreen: boolean;
+};
+
+export default function CollectionInput({
+ value,
+ onChange,
+ collections,
+ isLoading,
+ open,
+ onOpenChange,
+ fullScreen,
+}: Props) {
+ const [search, setSearch] = useState("");
+
+ const filteredCollections = useMemo(() => {
+ if (!Array.isArray(collections)) return [];
+
+ const query = search.trim().toLowerCase();
+ if (!query) return collections;
+
+ return collections.filter((collection) =>
+ collection.name.toLowerCase().includes(query)
+ );
+ }, [search, collections]);
+
+ const handleSelect = (collection: Collection) => {
+ onChange({
+ id: collection.id,
+ ownerId: collection.ownerId,
+ name: collection.name,
+ });
+
+ onOpenChange(false);
+ };
+
+ const list = (
+ <div
+ className={`flex h-full w-full flex-col overflow-hidden bg-popover text-popover-foreground ${
+ fullScreen ? "rounded-none" : "rounded-md"
+ }`}
+ >
+ <div className="flex items-center border-b px-3">
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
+ <input
+ className="flex h-11 w-full min-w-[280px] bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground"
+ placeholder="Search Collection..."
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ // Without this, Enter submits the form this input is nested in.
+ onKeyDown={(e) => e.key === "Enter" && e.preventDefault()}
+ />
+ </div>
+
+ {isLoading ? (
+ <p className="w-full text-center my-auto">Loading...</p>
+ ) : filteredCollections.length === 0 ? (
+ <p className="py-6 text-center text-sm">No Collection found.</p>
+ ) : (
+ <div className="w-full overflow-hidden p-1 text-foreground">
+ {filteredCollections.map((collection) => (
+ <div
+ key={collection.id}
+ onClick={() => handleSelect(collection)}
+ className="relative flex cursor-pointer select-none flex-col items-start justify-start rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground"
+ >
+ <p>{collection.name}</p>
+ <p className="text-xs text-neutral-500">{collection.pathname}</p>
+ </div>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+
+ return (
+ <div className="min-w-full">
+ <Popover open={open} onOpenChange={onOpenChange}>
+ <PopoverTrigger asChild>
+ <FormControl>
+ <Button
+ variant="outline"
+ role="combobox"
+ aria-expanded={open}
+ className="w-full justify-between bg-neutral-100 dark:bg-neutral-900"
+ >
+ {isLoading
+ ? "Unorganized"
+ : value?.name || "Select a collection..."}
+ <CaretSortIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
+ </Button>
+ </FormControl>
+ </PopoverTrigger>
+
+ {open &&
+ (fullScreen ? (
+ <div className="fade-up fixed inset-0 z-50 h-full w-full overflow-y-auto bg-white">
+ <Button
+ type="button"
+ className="absolute top-1 right-1 bg-transparent hover:bg-transparent hover:opacity-50 transition-colors ease-in-out duration-200"
+ onClick={() => onOpenChange(false)}
+ >
+ <X className="h-4 w-4 text-black dark:text-white" />
+ </Button>
+ {list}
+ </div>
+ ) : (
+ <PopoverContent className="min-w-full p-0 overflow-y-auto max-h-[200px]">
+ {list}
+ </PopoverContent>
+ ))}
+ </Popover>
+ </div>
+ );
+}
diff --git a/apps/extension/src/@/components/TagInput.tsx b/apps/extension/src/@/components/TagInput.tsx
index b32a5d87..fec367e9 100644
--- a/apps/extension/src/@/components/TagInput.tsx
+++ b/apps/extension/src/@/components/TagInput.tsx
@@ -1,29 +1,20 @@
-import { FC, UIEvent, useMemo, useState } from 'react';
-import { Button } from './ui/Button.tsx';
-import { Popover, PopoverContent, PopoverTrigger } from './ui/Popover.tsx';
-import { Check, ChevronsUpDown } from 'lucide-react';
-import {
- Command,
- CommandEmpty,
- CommandGroup,
- CommandInput,
- CommandItem,
- CommandList,
-} from './ui/Command.tsx';
-import { cn } from '../lib/utils.ts';
-import { ResponseTags } from '../lib/actions/tags.ts';
-
-interface TagInputProps {
- onChange: (tags: { name: string }[]) => void;
+import { UIEvent, useMemo, useState } from "react";
+import { Check, ChevronsUpDown, Search } from "lucide-react";
+import { Button } from "./ui/Button.tsx";
+import { Popover, PopoverContent, PopoverTrigger } from "./ui/Popover.tsx";
+import { ResponseTags } from "../lib/actions/tags.ts";
+
+type Props = {
value: { name: string; id?: number }[];
- tags: Pick<ResponseTags, 'id' | 'name'>[] | undefined;
+ onChange: (tags: { name: string }[]) => void;
+ tags: Pick<ResponseTags, "id" | "name">[] | undefined;
hasNextPage?: boolean;
isFetchingNextPage?: boolean;
onReachEnd?: () => void;
onSearchChange?: (value: string) => void;
-}
+};
-export const TagInput: FC<TagInputProps> = ({
+export default function TagInput({
value,
onChange,
tags,
@@ -31,49 +22,48 @@ export const TagInput: FC<TagInputProps> = ({
isFetchingNextPage,
onReachEnd,
onSearchChange,
-}) => {
- const [open, setOpen] = useState<boolean>(false);
- const [inputValue, setInputValue] = useState<string>('');
+}: Props) {
+ const [open, setOpen] = useState(false);
+ const [search, setSearch] = useState("");
+
const filteredTags = useMemo(() => {
if (!Array.isArray(tags)) return [];
- const normalizedInputValue = inputValue.trim().toLowerCase();
+ const query = search.trim().toLowerCase();
+ if (!query) return tags;
- if (!normalizedInputValue) return tags;
+ return tags.filter((tag) => tag.name.toLowerCase().includes(query));
+ }, [search, tags]);
- return tags.filter((tag) =>
- tag.name.toLowerCase().includes(normalizedInputValue)
- );
- }, [inputValue, tags]);
+ const handleToggleTag = (tag: { name: string }) => {
+ if (value.some((v) => v.name === tag.name)) {
+ onChange(value.filter((v) => v.name !== tag.name));
+ } else {
+ onChange([...value, tag]);
+ }
- const handleListScroll = (event: UIEvent<HTMLDivElement>) => {
- if (!hasNextPage || isFetchingNextPage || !onReachEnd) return;
+ setOpen(false);
+ };
- const target = event.currentTarget;
- const reachedBottom =
- target.scrollTop + target.clientHeight >= target.scrollHeight - 16;
+ // Enter turns whatever is typed in the search box into a brand new tag.
+ const handleAddSearchAsTag = () => {
+ if (!search || value.some((v) => v.name === search)) return;
- if (reachedBottom) onReachEnd();
+ onChange([...value, { name: search }]);
+ setSearch("");
+ onSearchChange?.("");
};
- function handleAddTag() {
- if (inputValue && value.some((tagObj) => tagObj.name === inputValue))
- return;
- if (inputValue) {
- const newTags = [...value, { name: inputValue }];
- setInputValue('');
- onSearchChange?.('');
- onChange(newTags);
- }
- }
+ const handleScroll = (e: UIEvent<HTMLDivElement>) => {
+ if (!hasNextPage || isFetchingNextPage || !onReachEnd) return;
- function handleRemoveTag(tagName: string) {
- const newTags = value.filter((tagObj) => tagObj.name !== tagName);
- onChange(newTags);
- }
+ const { scrollTop, clientHeight, scrollHeight } = e.currentTarget;
+
+ if (scrollTop + clientHeight >= scrollHeight - 16) onReachEnd();
+ };
return (
- <div className="min-w-full inset-x-0">
+ <div className="min-w-full">
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
@@ -82,110 +72,67 @@ export const TagInput: FC<TagInputProps> = ({
aria-expanded={open}
className="w-full justify-between bg-neutral-100 dark:bg-neutral-900"
>
- {Array.isArray(value) && value.length > 0
- ? value.map((tag) => tag.name).join(', ')
- : 'Select tags...'}
+ {value.length > 0
+ ? value.map((tag) => tag.name).join(", ")
+ : "Select tags..."}
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
</PopoverTrigger>
- <div className="min-w-full inset-x-0">
- <PopoverContent className="min-w-full p-0">
- <Command className="flex-grow min-w-full" shouldFilter={false}>
- <CommandInput
- className="min-w-[280px]"
+
+ <PopoverContent className="min-w-full p-0">
+ <div className="flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground">
+ <div className="flex items-center border-b px-3">
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
+ <input
+ className="flex h-11 w-full min-w-[280px] bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground"
placeholder="Search tag or add tag (Enter)"
- value={inputValue}
- onValueChange={(value) => {
- setInputValue(value);
- onSearchChange?.(value);
+ value={search}
+ onChange={(e) => {
+ setSearch(e.target.value);
+ onSearchChange?.(e.target.value);
}}
onKeyDown={(e) => {
- if (e.key === 'Enter') {
- handleAddTag();
- }
+ if (e.key === "Enter") handleAddSearchAsTag();
}}
/>
- <CommandList
- className="max-h-[200px]"
- onScroll={handleListScroll}
- >
- <CommandEmpty>No tag found.</CommandEmpty>
- {Array.isArray(tags) && (
- <CommandGroup className="w-full">
- {filteredTags.map((tag: { name: string }) => (
- <CommandItem
- className="w-full"
- key={tag.name}
- value={tag.name}
- onSelect={() => {
- if (Array.isArray(value)) {
- if (value.some((v) => v.name === tag.name)) {
- handleRemoveTag(tag.name);
- } else {
- onChange([...value, tag]);
- }
- }
- setOpen(false);
- }}
- >
- <Check
- className={cn(
- 'mr-2 h-4 w-4',
- Array.isArray(value) &&
- value.some((v) => v.name === tag.name)
- ? 'opacity-100'
- : 'opacity-0'
- )}
- />
- {tag.name}
- </CommandItem>
- ))}
- {isFetchingNextPage ? (
- <CommandItem
- className="w-full"
- value="Loading more tags..."
- disabled
- >
- Loading more tags...
- </CommandItem>
- ) : null}
- </CommandGroup>
- )}
- </CommandList>
- </Command>
- </PopoverContent>
- </div>
+ </div>
+
+ <div
+ className="max-h-[200px] overflow-y-auto overflow-x-hidden"
+ onScroll={handleScroll}
+ >
+ {filteredTags.length === 0 && !isFetchingNextPage ? (
+ <p className="py-6 text-center text-sm">No tag found.</p>
+ ) : (
+ <div className="w-full overflow-hidden p-1 text-foreground">
+ {filteredTags.map((tag) => (
+ <div
+ key={tag.name}
+ onClick={() => handleToggleTag(tag)}
+ className="relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground"
+ >
+ <Check
+ className={`mr-2 h-4 w-4 ${
+ value.some((v) => v.name === tag.name)
+ ? "opacity-100"
+ : "opacity-0"
+ }`}
+ />
+ {tag.name}
+ </div>
+ ))}
+
+ {isFetchingNextPage && (
+ <div className="relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm opacity-50">
+ Loading more tags...
+ </div>
+ )}
+ </div>
+ )}
+ </div>
+ </div>
+ </PopoverContent>
</Popover>
</div>
);
-
- /*
- return (
- <div>
- <div className='flex space-x-2'>
- <Input value={inputValue} onChange={e => setInputValue(e.target.value)} />
- <Button type='button' onClick={handleAddTag} onKeyDown={handleAddTag}>Add</Button>
- </div>
- <div className='flex flex-wrap mt-2'>
- {tags.map(tagObj => (
- <span
- key={tagObj.name}
- className='inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 mr-2 mb-2'
- >
- {tagObj.name}
- <button
- type='button'
- className='flex-shrink-0 ml-1.5 h-4 w-4 rounded-full inline-flex items-center justify-center text-blue-400 hover:bg-blue-200 hover:text-blue-500 focus:outline-none focus:bg-blue-500 focus:text-white'
- onClick={() => handleRemoveTag(tagObj.name)}
- >
- <span className='sr-only'>Remove tag</span>
- <svg className='h-2 w-2' stroke='currentColor' fill='none' viewBox='0 0 8 8'>
- <path strokeLinecap='round' strokeWidth='1.5' d='M1 1l6 6m0-6L1 7' />
- </svg>
- </button>
- </span>
- ))}
- </div>
- </div>
- );*/
-};
+}
diff --git a/apps/extension/src/@/components/ui/Command.tsx b/apps/extension/src/@/components/ui/Command.tsx
deleted file mode 100644
index 0a4eff2c..00000000
--- a/apps/extension/src/@/components/ui/Command.tsx
+++ /dev/null
@@ -1,155 +0,0 @@
-import * as React from 'react';
-import { DialogProps } from '@radix-ui/react-dialog';
-import { Command as CommandPrimitive } from 'cmdk';
-import { Search } from 'lucide-react';
-
-import { cn } from '../../lib/utils.ts';
-import { Dialog, DialogContent } from './Dialog.tsx';
-
-const Command = React.forwardRef<
- React.ElementRef<typeof CommandPrimitive>,
- React.ComponentPropsWithoutRef<typeof CommandPrimitive>
->(({ className, ...props }, ref) => (
- <CommandPrimitive
- ref={ref}
- className={cn(
- 'flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground',
- className,
- )}
- {...props}
- />
-));
-Command.displayName = CommandPrimitive.displayName;
-
-interface CommandDialogProps extends DialogProps {
-}
-
-const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
- return (
- <Dialog {...props}>
- <DialogContent className='overflow-hidden p-0 shadow-lg'>
- <Command
- className='[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5'>
- {children}
- </Command>
- </DialogContent>
- </Dialog>
- );
-};
-
-const CommandInput = React.forwardRef<
- React.ElementRef<typeof CommandPrimitive.Input>,
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
->(({ className, ...props }, ref) => (
- <div className='flex items-center border-b px-3' cmdk-input-wrapper=''>
- <Search className='mr-2 h-4 w-4 shrink-0 opacity-50' />
- <CommandPrimitive.Input
- ref={ref}
- className={cn(
- 'flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',
- className,
- )}
- {...props}
- />
- </div>
-));
-
-CommandInput.displayName = CommandPrimitive.Input.displayName;
-
-const CommandList = React.forwardRef<
- React.ElementRef<typeof CommandPrimitive.List>,
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
->(({ className, ...props }, ref) => (
- <CommandPrimitive.List
- ref={ref}
- className={cn('max-h-[300px] overflow-y-auto overflow-x-hidden', className)}
- {...props}
- />
-));
-
-CommandList.displayName = CommandPrimitive.List.displayName;
-
-const CommandEmpty = React.forwardRef<
- React.ElementRef<typeof CommandPrimitive.Empty>,
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
->((props, ref) => (
- <CommandPrimitive.Empty
- ref={ref}
- className='py-6 text-center text-sm'
- {...props}
- />
-));
-
-CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
-
-const CommandGroup = React.forwardRef<
- React.ElementRef<typeof CommandPrimitive.Group>,
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
->(({ className, ...props }, ref) => (
- <CommandPrimitive.Group
- ref={ref}
- className={cn(
- 'overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground',
- className,
- )}
- {...props}
- />
-));
-
-CommandGroup.displayName = CommandPrimitive.Group.displayName;
-
-const CommandSeparator = React.forwardRef<
- React.ElementRef<typeof CommandPrimitive.Separator>,
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
->(({ className, ...props }, ref) => (
- <CommandPrimitive.Separator
- ref={ref}
- className={cn('-mx-1 h-px bg-border', className)}
- {...props}
- />
-));
-CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
-
-const CommandItem = React.forwardRef<
- React.ElementRef<typeof CommandPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
->(({ className, ...props }, ref) => (
- <CommandPrimitive.Item
- ref={ref}
- className={cn(
- 'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
- className,
- )}
- {...props}
- />
-));
-
-CommandItem.displayName = CommandPrimitive.Item.displayName;
-
-const CommandShortcut = ({
- className,
- ...props
- }: React.HTMLAttributes<HTMLSpanElement>) => {
- return (
- <span
- className={cn(
- 'ml-auto text-xs tracking-widest text-muted-foreground',
- className,
- )}
- {...props}
- />
- );
-};
-CommandShortcut.displayName = 'CommandShortcut';
-
-export {
- Command,
- CommandDialog,
- CommandInput,
- CommandList,
- CommandEmpty,
- CommandGroup,
- CommandItem,
- CommandShortcut,
- CommandSeparator,
-};
diff --git a/apps/extension/src/@/lib/actions/collections.ts b/apps/extension/src/@/lib/actions/collections.ts
index 27754a5f..cd03da4b 100644
--- a/apps/extension/src/@/lib/actions/collections.ts
+++ b/apps/extension/src/@/lib/actions/collections.ts
@@ -1,6 +1,6 @@
import axios from 'axios';
-interface ResponseCollections {
+export interface ResponseCollections {
color: string;
createdAt: string;
description: string;
@@ -17,6 +17,8 @@ interface ResponseCollections {
updatedAt: string;
}
+export type Collection = ResponseCollections & { pathname: string };
+
function buildFullPath(
collection: ResponseCollections,
collectionsMap: Map<number, ResponseCollections>