diff --git a/apps/web/src/app/ui/page.tsx b/apps/web/src/app/ui/page.tsx index 2fd44722..9c3b8df9 100644 --- a/apps/web/src/app/ui/page.tsx +++ b/apps/web/src/app/ui/page.tsx @@ -1,11 +1,15 @@ +"use client"; import Main from "@/components/Main"; import Sidebar from "@/components/Sidebar/index"; +import { useState } from "react"; + +export default function Home() { + const [selectedItem, setSelectedItem] = useState(null); -export default async function Home() { return (
- -
+ +
); } diff --git a/apps/web/src/components/Main.tsx b/apps/web/src/components/Main.tsx index 5ec10364..a9e09992 100644 --- a/apps/web/src/components/Main.tsx +++ b/apps/web/src/components/Main.tsx @@ -4,11 +4,14 @@ import { FilterCombobox } from "./Sidebar/FilterCombobox"; import { Textarea2 } from "./ui/textarea"; import { ArrowRight } from "lucide-react"; -export default function Main() { +export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) { const [value, setValue] = useState(""); return ( -
+
Nothing found + {/* bug: doesn't work on clicking with mouse only keyboard, weird */} {spaces.map((space) => ( { - console.log(val, "selected"); setValues((prev) => prev.includes(val) ? prev.filter((v) => v !== val) diff --git a/apps/web/src/components/Sidebar/index.tsx b/apps/web/src/components/Sidebar/index.tsx index dda95907..569fc353 100644 --- a/apps/web/src/components/Sidebar/index.tsx +++ b/apps/web/src/components/Sidebar/index.tsx @@ -1,11 +1,89 @@ -"use server"; +"use client"; import { StoredContent } from "@/server/db/schema"; -import { AddNewPagePopover, PageItem } from "./PagesItem"; -import { CategoryItem } from "./CategoryItem"; import { MemoryIcon } from "../../assets/Memories"; import { Trash2, User2 } from "lucide-react"; +import React, { useState } from "react"; -export default async function Sidebar() { +export type MenuItem = { + icon: React.ReactNode | React.ReactNode[]; + label: string; +}; + +const menuItemsTop: Array = [ + { + icon: , + label: "Memories", + }, +]; + +const menuItemsBottom: Array = [ + { + icon: , + label: "Trash", + }, + { + icon: , + label: "Profile", + }, +]; + +export default function Sidebar({ + onSelectChange, +}: { + onSelectChange?: (selectedItem: string | null) => void; +}) { + const [selectedItem, setSelectedItem] = useState(null); + + React.useEffect(() => { + onSelectChange?.(selectedItem); + }, [selectedItem]); + + return ( + <> + + {selectedItem && } + + ); +} + +const MenuItem = ({ + item: { icon, label }, + selectedItem, + setSelectedItem, +}: { + item: MenuItem; + selectedItem: string | null; + setSelectedItem: React.Dispatch>; +}) => ( + +); + +export function SubSidebar() { const pages: StoredContent[] = [ { id: 1, @@ -30,79 +108,6 @@ export default async function Sidebar() { ]; return ( - - ); -} - -export async function SubSidebar() { - const pages: StoredContent[] = [ - { - id: 1, - content: "", - title: "Visual Studio Code", - url: "https://code.visualstudio.com", - description: "", - image: "https://code.visualstudio.com/favicon.ico", - baseUrl: "https://code.visualstudio.com", - savedAt: new Date(), - }, - { - id: 2, - content: "", - title: "yxshv/vscode: An unofficial remake of vscode's landing page", - url: "https://github.com/yxshv/vscode", - description: "", - image: "https://github.com/favicon.ico", - baseUrl: "https://github.com", - savedAt: new Date(), - }, - ]; - - return ( - + ); }