diff --git a/apps/web/app/(dash)/layout.tsx b/apps/web/app/(dash)/layout.tsx index b2b27a4f..65a04a9b 100644 --- a/apps/web/app/(dash)/layout.tsx +++ b/apps/web/app/(dash)/layout.tsx @@ -3,7 +3,6 @@ import Menu from "./menu"; import { redirect } from "next/navigation"; import { auth } from "../../server/auth"; import { Toaster } from "@repo/ui/shadcn/sonner"; -import BackgroundPlus from "../(landing)/GridPatterns/PlusGrid"; async function Layout({ children }: { children: React.ReactNode }) { const info = await auth(); @@ -13,7 +12,7 @@ async function Layout({ children }: { children: React.ReactNode }) { } return ( -
+
@@ -24,7 +23,6 @@ async function Layout({ children }: { children: React.ReactNode }) { style={{ transform: "rotate(-30deg)" }} /> - diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx index 711b081c..8d8e77c1 100644 --- a/apps/web/app/(dash)/menu.tsx +++ b/apps/web/app/(dash)/menu.tsx @@ -1,359 +1,171 @@ -"use client"; - -import React, { useEffect, useMemo, useState } from "react"; +import React from "react"; import Image from "next/image"; import Link from "next/link"; -import { MemoriesIcon, ExploreIcon, CanvasIcon, AddIcon } from "@repo/ui/icons"; -import { Button } from "@repo/ui/shadcn/button"; -import { MinusIcon, PlusCircleIcon } from "lucide-react"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "@repo/ui/shadcn/dialog"; -import { Label } from "@repo/ui/shadcn/label"; -import { Textarea } from "@repo/ui/shadcn/textarea"; -import { toast } from "sonner"; -import { getSpaces } from "../actions/fetchers"; +import { MemoriesIcon, CanvasIcon, AddIcon } from "@repo/ui/icons"; +import { DialogTrigger } from "@repo/ui/shadcn/dialog"; + import { HomeIcon } from "@heroicons/react/24/solid"; -import { createMemory, createSpace } from "../actions/doers"; -import ComboboxWithCreate from "@repo/ui/shadcn/combobox"; -import { StoredSpace } from "@/server/db/schema"; -import useMeasure from "react-use-measure"; +import { + PencilSquareIcon, + PlusIcon, + PresentationChartLineIcon, + RectangleStackIcon, +} from "@heroicons/react/24/solid"; +import DialogTriggerWrapper, { DialogDesktopTrigger, DialogMobileTrigger } from "./dialogTriggerWrapper"; + +const menuItems = [ + { + icon: MemoriesIcon, + text: "Memories", + url: "/memories", + disabled: false, + }, + { + icon: CanvasIcon, + text: "Canvas", + url: "/canvas", + disabled: true, + }, +]; + +const items = [ + { + icon: , + name: "home", + url: "/home", + disabled: false, + }, + { + icon: , + name: "memories", + url: "/memories", + disabled: false, + }, + { + icon: , + name: "editor", + url: "/#", + disabled: true, + }, + { + icon: , + name: "thinkpad", + url: "/#", + disabled: true, + }, +]; function Menu() { - const [spaces, setSpaces] = useState([]); - - useEffect(() => { - (async () => { - let spaces = await getSpaces(); - - if (!spaces.success || !spaces.data) { - toast.warning("Unable to get spaces", { - richColors: true, - }); - setSpaces([]); - return; - } - setSpaces(spaces.data); - })(); - }, []); - - const menuItems = [ - { - icon: MemoriesIcon, - text: "Memories", - url: "/memories", - disabled: false, - }, - { - icon: CanvasIcon, - text: "Canvas", - url: "/canvas", - disabled: true, - }, - ]; - - const [content, setContent] = useState(""); - const [selectedSpaces, setSelectedSpaces] = useState([]); - - const autoDetectedType = useMemo(() => { - if (content.length === 0) { - return "none"; - } - - if ( - content.match(/https?:\/\/(x\.com|twitter\.com)\/[\w]+\/[\w]+\/[\d]+/) - ) { - return "tweet"; - } else if (content.match(/https?:\/\/[\w\.]+/)) { - return "page"; - } else if (content.match(/https?:\/\/www\.[\w\.]+/)) { - return "page"; - } else { - return "note"; - } - }, [content]); - - const [dialogOpen, setDialogOpen] = useState(false); - - const options = useMemo( - () => - spaces.map((x) => ({ - label: x.name, - value: x.id.toString(), - })), - [spaces], - ); - - const handleSubmit = async (content?: string, spaces?: number[]) => { - setDialogOpen(false); - - toast.info("Creating memory...", { - icon: , - duration: 7500, - }); - - if (!content || content.length === 0) { - toast.error("Content is required"); - return; - } - - console.log(spaces); - - const cont = await createMemory({ - content: content, - spaces: spaces ?? undefined, - }); - - setContent(""); - setSelectedSpaces([]); - - if (cont.success) { - toast.success("Memory created", { - richColors: true, - }); - } else { - toast.error(`Memory creation failed: ${cont.error}`); - } - }; - return ( <> {/* Desktop Menu */} - -
-
-
- - Logo -

- Add -

-
-
- {menuItems.map((item) => ( - - {`${item.text} -

- {item.text} -

- +
+
+
+ +
+ {items.map((v) => ( + ))}
+
- -
{ - const content = e.get("content")?.toString(); - - await handleSubmit(content, selectedSpaces); - }} - className="flex flex-col gap-4 " + {/* Mobile Menu */} +
+
+ - - Add memory - - A "Memory" is a bookmark, something you want to remember. - - + +

Home

+ -
- -