aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src
diff options
context:
space:
mode:
authoryxshv <[email protected]>2024-04-14 00:31:53 +0530
committeryxshv <[email protected]>2024-04-14 00:31:53 +0530
commit19759394e40eeb4fcc04d9b8be70cbfa03360fdb (patch)
tree895ab39b1c4adc2eef2032ca2907caea1bca534c /apps/web/src
parentfix phone layout (diff)
downloadsupermemory-19759394e40eeb4fcc04d9b8be70cbfa03360fdb.tar.xz
supermemory-19759394e40eeb4fcc04d9b8be70cbfa03360fdb.zip
fix relaod bug
Diffstat (limited to 'apps/web/src')
-rw-r--r--apps/web/src/components/Main.tsx2
-rw-r--r--apps/web/src/components/Sidebar/AddMemoryDialog.tsx4
-rw-r--r--apps/web/src/components/Sidebar/FilterCombobox.tsx167
3 files changed, 84 insertions, 89 deletions
diff --git a/apps/web/src/components/Main.tsx b/apps/web/src/components/Main.tsx
index 67c73c2c..3c883b67 100644
--- a/apps/web/src/components/Main.tsx
+++ b/apps/web/src/components/Main.tsx
@@ -49,7 +49,7 @@ export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) {
if (search && search.trim().length > 0) {
setValue(search);
onSend();
- router.push("/");
+ //router.push("/");
}
}, []);
diff --git a/apps/web/src/components/Sidebar/AddMemoryDialog.tsx b/apps/web/src/components/Sidebar/AddMemoryDialog.tsx
index 90ac46fa..f21a9683 100644
--- a/apps/web/src/components/Sidebar/AddMemoryDialog.tsx
+++ b/apps/web/src/components/Sidebar/AddMemoryDialog.tsx
@@ -26,7 +26,7 @@ export function AddMemoryPage({ closeDialog }: { closeDialog: () => void }) {
const [selectedSpacesId, setSelectedSpacesId] = useState<number[]>([]);
return (
- <form className="md:w-[40vw]">
+ <div className="md:w-[40vw]">
<DialogHeader>
<DialogTitle>Add a web page to memory</DialogTitle>
<DialogDescription>
@@ -95,7 +95,7 @@ export function AddMemoryPage({ closeDialog }: { closeDialog: () => void }) {
Cancel
</DialogClose>
</DialogFooter>
- </form>
+ </div>
);
}
diff --git a/apps/web/src/components/Sidebar/FilterCombobox.tsx b/apps/web/src/components/Sidebar/FilterCombobox.tsx
index 88bb5a8c..de2d5fe8 100644
--- a/apps/web/src/components/Sidebar/FilterCombobox.tsx
+++ b/apps/web/src/components/Sidebar/FilterCombobox.tsx
@@ -63,92 +63,87 @@ export function FilterSpaces({
}, [open]);
return (
- <AnimatePresence mode="popLayout">
- <LayoutGroup>
- <Popover open={open} onOpenChange={setOpen}>
- <PopoverTrigger asChild>
- <button
- type={undefined}
- data-state-on={open}
- className={cn(
- "text-rgray-11/70 on:bg-rgray-3 focus-visible:ring-rgray-8 hover:bg-rgray-3 relative flex items-center justify-center gap-1 rounded-md px-3 py-1.5 ring-2 ring-transparent focus-visible:outline-none",
- className,
- )}
- {...props}
- >
- <SpaceIcon className="mr-1 h-5 w-5" />
- {name}
- <ChevronsUpDown className="h-4 w-4" />
- <div
- data-state-on={selectedSpaces.length > 0}
- className="on:flex text-rgray-11 border-rgray-6 bg-rgray-2 absolute left-0 top-0 hidden aspect-[1] h-4 w-4 -translate-x-1/3 -translate-y-1/3 items-center justify-center rounded-full border text-center text-[9px]"
- >
- {selectedSpaces.length}
- </div>
- </button>
- </PopoverTrigger>
- <PopoverContent
- onCloseAutoFocus={(e) => e.preventDefault()}
- align={align}
- side={side}
- className="w-[200px] p-0"
- >
- <Command
- filter={(val, search) =>
- spaces
- .find((s) => s.id.toString() === val)
- ?.name.toLowerCase()
- .includes(search.toLowerCase().trim())
- ? 1
- : 0
- }
- >
- <CommandInput placeholder="Filter spaces..." />
- <CommandList asChild>
- <motion.div layoutScroll>
- <CommandEmpty>Nothing found</CommandEmpty>
- <CommandGroup>
- {sortedSpaces.map((space) => (
- <CommandItem
- key={space.id}
- value={space.id.toString()}
- onSelect={(val) => {
- setSelectedSpaces((prev: number[]) =>
- prev.includes(parseInt(val))
- ? prev.filter((v) => v !== parseInt(val))
- : [...prev, parseInt(val)],
- );
- }}
- asChild
- >
- <motion.div
- initial={{ opacity: 0 }}
- animate={{ opacity: 1, transition: { delay: 0.05 } }}
- transition={{ duration: 0.15 }}
- layout
- layoutId={`space-combobox-${space.id}`}
- className="text-rgray-11"
- >
- <SpaceIcon className="mr-2 h-4 w-4" />
- {space.name}
- {selectedSpaces.includes(space.id)}
- <Check
- data-state-on={selectedSpaces.includes(space.id)}
- className={cn(
- "on:opacity-100 ml-auto h-4 w-4 opacity-0",
- )}
- />
- </motion.div>
- </CommandItem>
- ))}
- </CommandGroup>
- </motion.div>
- </CommandList>
- </Command>
- </PopoverContent>
- </Popover>
- </LayoutGroup>
- </AnimatePresence>
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverTrigger asChild>
+ <button
+ type={undefined}
+ data-state-on={open}
+ className={cn(
+ "text-rgray-11/70 on:bg-rgray-3 focus-visible:ring-rgray-8 hover:bg-rgray-3 relative flex items-center justify-center gap-1 rounded-md px-3 py-1.5 ring-2 ring-transparent focus-visible:outline-none",
+ className,
+ )}
+ {...props}
+ >
+ <SpaceIcon className="mr-1 h-5 w-5" />
+ {name}
+ <ChevronsUpDown className="h-4 w-4" />
+ <div
+ data-state-on={selectedSpaces.length > 0}
+ className="on:flex text-rgray-11 border-rgray-6 bg-rgray-2 absolute left-0 top-0 hidden aspect-[1] h-4 w-4 -translate-x-1/3 -translate-y-1/3 items-center justify-center rounded-full border text-center text-[9px]"
+ >
+ {selectedSpaces.length}
+ </div>
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ align={align}
+ side={side}
+ className="w-[200px] p-0"
+ >
+ <Command
+ filter={(val, search) =>
+ spaces
+ .find((s) => s.id.toString() === val)
+ ?.name.toLowerCase()
+ .includes(search.toLowerCase().trim())
+ ? 1
+ : 0
+ }
+ >
+ <CommandInput placeholder="Filter spaces..." />
+ <CommandList asChild>
+ <motion.div layoutScroll>
+ <CommandEmpty>Nothing found</CommandEmpty>
+ <CommandGroup>
+ {sortedSpaces.map((space) => (
+ <CommandItem
+ key={space.id}
+ value={space.id.toString()}
+ onSelect={(val) => {
+ setSelectedSpaces((prev: number[]) =>
+ prev.includes(parseInt(val))
+ ? prev.filter((v) => v !== parseInt(val))
+ : [...prev, parseInt(val)],
+ );
+ }}
+ asChild
+ >
+ <motion.div
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1, transition: { delay: 0.05 } }}
+ transition={{ duration: 0.15 }}
+ layout
+ layoutId={`space-combobox-${space.id}`}
+ className="text-rgray-11"
+ >
+ <SpaceIcon className="mr-2 h-4 w-4" />
+ {space.name}
+ {selectedSpaces.includes(space.id)}
+ <Check
+ data-state-on={selectedSpaces.includes(space.id)}
+ className={cn(
+ "on:opacity-100 ml-auto h-4 w-4 opacity-0",
+ )}
+ />
+ </motion.div>
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </motion.div>
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
);
}