aboutsummaryrefslogtreecommitdiff
path: root/apps/web/src/components/Sidebar
diff options
context:
space:
mode:
authorYash <[email protected]>2024-04-05 08:21:58 +0000
committerYash <[email protected]>2024-04-05 08:21:58 +0000
commit324100852f9799b747e9cb7117a38d20e5c73f1f (patch)
tree5e05046b8d1ec90351cee74faf48ddde05ad1899 /apps/web/src/components/Sidebar
parentuse server in /ui (diff)
downloadsupermemory-324100852f9799b747e9cb7117a38d20e5c73f1f.tar.xz
supermemory-324100852f9799b747e9cb7117a38d20e5c73f1f.zip
context added
Diffstat (limited to 'apps/web/src/components/Sidebar')
-rw-r--r--apps/web/src/components/Sidebar/index.tsx38
1 files changed, 19 insertions, 19 deletions
diff --git a/apps/web/src/components/Sidebar/index.tsx b/apps/web/src/components/Sidebar/index.tsx
index 55211f84..9c2cfd63 100644
--- a/apps/web/src/components/Sidebar/index.tsx
+++ b/apps/web/src/components/Sidebar/index.tsx
@@ -1,11 +1,11 @@
-'use client';
-import { StoredContent } from '@/server/db/schema';
-import { MemoryIcon } from '../../assets/Memories';
-import { Trash2, User2 } from 'lucide-react';
-import React, { useEffect, useState } from 'react';
-import { MemoriesBar } from './MemoriesBar';
-import { AnimatePresence, motion } from 'framer-motion';
-import { Bin } from '@/assets/Bin';
+"use client";
+import { StoredContent } from "@/server/db/schema";
+import { MemoryIcon } from "../../assets/Memories";
+import { Trash2, User2 } from "lucide-react";
+import React, { useEffect, useState } from "react";
+import { MemoriesBar } from "./MemoriesBar";
+import { AnimatePresence, motion } from "framer-motion";
+import { Bin } from "@/assets/Bin";
export type MenuItem = {
icon: React.ReactNode | React.ReactNode[];
@@ -16,7 +16,7 @@ export type MenuItem = {
const menuItemsTop: Array<MenuItem> = [
{
icon: <MemoryIcon className="h-10 w-10" />,
- label: 'Memories',
+ label: "Memories",
content: MemoriesBar,
},
];
@@ -24,18 +24,18 @@ const menuItemsTop: Array<MenuItem> = [
const menuItemsBottom: Array<MenuItem> = [
{
icon: <Trash2 strokeWidth={1.3} className="h-6 w-6" />,
- label: 'Trash',
+ label: "Trash",
},
{
icon: <User2 strokeWidth={1.3} className="h-6 w-6" />,
- label: 'Profile',
+ label: "Profile",
},
];
export default function Sidebar({
- selectChange,
+ onSelectChange,
}: {
- selectChange?: (selectedItem: string | null) => Promise<void>;
+ onSelectChange?: (selectedItem: string | null) => void;
}) {
const menuItems = [...menuItemsTop, ...menuItemsBottom];
const [selectedItem, setSelectedItem] = useState<string | null>(null);
@@ -44,7 +44,7 @@ export default function Sidebar({
menuItems.find((i) => i.label === selectedItem)?.content ?? (() => <></>);
useEffect(() => {
- void selectChange?.(selectedItem);
+ void onSelectChange?.(selectedItem);
}, [selectedItem]);
return (
@@ -53,7 +53,7 @@ export default function Sidebar({
<div className="bg-rgray-2 border-r-rgray-6 relative z-[50] flex h-full w-full flex-col items-center justify-center border-r px-2 py-5 ">
<MenuItem
item={{
- label: 'Memories',
+ label: "Memories",
icon: <MemoryIcon className="h-10 w-10" />,
content: MemoriesBar,
}}
@@ -65,7 +65,7 @@ export default function Sidebar({
<MenuItem
item={{
- label: 'Trash',
+ label: "Trash",
icon: <Bin id="trash" className="z-[300] h-7 w-7" />,
}}
selectedItem={selectedItem}
@@ -74,7 +74,7 @@ export default function Sidebar({
/>
<MenuItem
item={{
- label: 'Profile',
+ label: "Profile",
icon: <User2 strokeWidth={1.3} className="h-7 w-7" />,
}}
selectedItem={selectedItem}
@@ -117,11 +117,11 @@ const MenuItem = ({
export function SubSidebar({ children }: { children?: React.ReactNode }) {
return (
<motion.div
- initial={{ opacity: 0, x: '-100%' }}
+ initial={{ opacity: 0, x: "-100%" }}
animate={{ opacity: 1, x: 0 }}
exit={{
opacity: 0,
- x: '-100%',
+ x: "-100%",
transition: { delay: 0.2 },
}}
transition={{