From 03dd3c093fc2ceef572a710953a6ee810f235ea1 Mon Sep 17 00:00:00 2001 From: Yash Date: Sat, 6 Apr 2024 05:03:16 +0000 Subject: add modal --- apps/web/src/components/Sidebar/FilterCombobox.tsx | 2 - apps/web/src/components/Sidebar/MemoriesBar.tsx | 130 +++++++++++++++++++-- apps/web/src/components/ui/dialog.tsx | 6 +- 3 files changed, 124 insertions(+), 14 deletions(-) (limited to 'apps/web/src/components') diff --git a/apps/web/src/components/Sidebar/FilterCombobox.tsx b/apps/web/src/components/Sidebar/FilterCombobox.tsx index ae433c95..89bea100 100644 --- a/apps/web/src/components/Sidebar/FilterCombobox.tsx +++ b/apps/web/src/components/Sidebar/FilterCombobox.tsx @@ -38,8 +38,6 @@ export function FilterCombobox({ className, ...props }: Props) { : 0, ); - console.log(sortedSpaces, values); - return ( diff --git a/apps/web/src/components/Sidebar/MemoriesBar.tsx b/apps/web/src/components/Sidebar/MemoriesBar.tsx index 88caec9c..95c6f095 100644 --- a/apps/web/src/components/Sidebar/MemoriesBar.tsx +++ b/apps/web/src/components/Sidebar/MemoriesBar.tsx @@ -5,12 +5,15 @@ import { MemoryWithImages2, } from "@/assets/MemoryWithImages"; import { type CollectedSpaces } from "../../../types/memory"; -import { InputWithIcon } from "../ui/input"; +import { Input, InputWithIcon } from "../ui/input"; import { ArrowUpRight, Edit3, MoreHorizontal, + Plus, Search, + Sparkles, + Text, Trash2, } from "lucide-react"; import { @@ -21,10 +24,28 @@ import { } from "../ui/dropdown-menu"; import { useState } from "react"; import { Variant, useAnimate, motion } from "framer-motion"; +import { useMemory } from "@/contexts/MemoryContext"; +import { SpaceIcon } from "@/assets/Memories"; +import { + Dialog, + DialogContent, + DialogTitle, + DialogDescription, + DialogHeader, + DialogFooter, + DialogClose, +} from "../ui/dialog"; +import { Label } from "../ui/label"; +import { DialogTrigger } from "@radix-ui/react-dialog"; -export function MemoriesBar({ spaces }: { spaces: CollectedSpaces[] }) { +export function MemoriesBar() { const [parent, enableAnimations] = useAutoAnimate(); - const [currentSpaces, setCurrentSpaces] = useState(spaces); + const { spaces, deleteSpace } = useMemory(); + + const [isDropdownOpen, setIsDropdownOpen] = useState(false); + const [addMemoryState, setAddMemoryState] = useState< + "page" | "note" | "space" | null + >(null); return (
@@ -36,15 +57,43 @@ export function MemoriesBar({ spaces }: { spaces: CollectedSpaces[] }) { className="bg-rgray-4 mt-2 w-full" />
+
+ + + + + + { + setIsDropdownOpen(false); + setAddMemoryState("page"); + }} + > + + Page to Memory + + + + Note + + + + Space + + + +
+
- {currentSpaces.map((space) => ( + {spaces.map((space) => ( - setCurrentSpaces((prev) => prev.filter((s) => s.id !== space.id)) - } + onDelete={() => deleteSpace(space.id)} key={space.id} {...space} /> @@ -66,7 +115,6 @@ const SpaceExitVariant: Variant = { export function SpaceItem({ title, - description, content, id, onDelete, @@ -191,7 +239,7 @@ export function SpaceMoreButton({ onDelete }: { onDelete?: () => void }) { @@ -220,3 +268,67 @@ export function SpaceMoreButton({ onDelete }: { onDelete?: () => void }) { ); } + +export function AddMemoryModal({ + state, +}: { + state: "page" | "note" | "space" | null; +}) { + return ( + <> + + + + Add a web page to memory + + This will take you the web page you are trying to add to memory, + where the extension will save the page to memory + + + + + + + Add + + + Cancel + + + + + + + + Add a web page to memory + + This will take you the web page you are trying to add to memory, + where the extension will save the page to memory + + + + + + + Add + + + Cancel + + + + + + + ); +} diff --git a/apps/web/src/components/ui/dialog.tsx b/apps/web/src/components/ui/dialog.tsx index ec19b41a..bc36e749 100644 --- a/apps/web/src/components/ui/dialog.tsx +++ b/apps/web/src/components/ui/dialog.tsx @@ -38,7 +38,7 @@ const DialogContent = React.forwardRef< ) => (