From e950b84df5dc3d021f05bfc75f08674ddde54931 Mon Sep 17 00:00:00 2001 From: Yash Date: Tue, 2 Apr 2024 15:44:50 +0000 Subject: memory bar --- apps/web/src/assets/Memories.tsx | 2 + apps/web/src/assets/MemoryWithImages.tsx | 528 ++++++++++++++++++++++++ apps/web/src/components/Main.tsx | 1 + apps/web/src/components/Sidebar/MemoriesBar.tsx | 141 +++++++ apps/web/src/components/Sidebar/index.tsx | 19 +- apps/web/src/components/ui/input.tsx | 4 +- apps/web/src/components/ui/textarea.tsx | 6 +- apps/web/src/lib/utils.ts | 8 + 8 files changed, 688 insertions(+), 21 deletions(-) create mode 100644 apps/web/src/assets/MemoryWithImages.tsx create mode 100644 apps/web/src/components/Sidebar/MemoriesBar.tsx (limited to 'apps/web/src') diff --git a/apps/web/src/assets/Memories.tsx b/apps/web/src/assets/Memories.tsx index 3b1c177f..f8fd83b8 100644 --- a/apps/web/src/assets/Memories.tsx +++ b/apps/web/src/assets/Memories.tsx @@ -1,3 +1,5 @@ +import { svgId } from "@/lib/utils"; + export const MemoryIcon: React.FC> = ( props, ) => ( diff --git a/apps/web/src/assets/MemoryWithImages.tsx b/apps/web/src/assets/MemoryWithImages.tsx new file mode 100644 index 00000000..5cd6f8ca --- /dev/null +++ b/apps/web/src/assets/MemoryWithImages.tsx @@ -0,0 +1,528 @@ +import { svgId } from "@/lib/utils"; + +export const MemoryWithImage: React.FC< + { image: string; id: string } & React.SVGAttributes +> = ({ image, id: _id, ...props }) => { + const id = "space-1-" + _id; + + return ( + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export const MemoryWithImages2: React.FC< + { images: string[]; id: string } & React.SVGAttributes +> = ({ images, id: _id, ...props }) => { + const id = "space-2-" + _id; + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; + +export const MemoryWithImages3: React.FC< + { images: string[]; id: string } & React.SVGAttributes +> = ({ images, id: _id, ...props }) => { + const id = "space-3-" + _id; + + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ); +}; diff --git a/apps/web/src/components/Main.tsx b/apps/web/src/components/Main.tsx index a9e09992..15042e9a 100644 --- a/apps/web/src/components/Main.tsx +++ b/apps/web/src/components/Main.tsx @@ -18,6 +18,7 @@ export default function Main({ sidebarOpen }: { sidebarOpen: boolean }) { placeholder: "Ask your SuperMemory...", className: "text-lg p-2 text-rgray-11", value, + autoFocus: true, onChange: (e) => setValue(e.target.value), }} > diff --git a/apps/web/src/components/Sidebar/MemoriesBar.tsx b/apps/web/src/components/Sidebar/MemoriesBar.tsx new file mode 100644 index 00000000..e2adcd94 --- /dev/null +++ b/apps/web/src/components/Sidebar/MemoriesBar.tsx @@ -0,0 +1,141 @@ +import { + MemoryWithImage, + MemoryWithImages3, + MemoryWithImages2, +} from "@/assets/MemoryWithImages"; +import { type Space } from "../../../types/memory"; +import { InputWithIcon } from "../ui/input"; +import { Search } from "lucide-react"; + +export function MemoriesBar() { + const spaces: Space[] = [ + { + id: 1, + title: "Cool Tech", + description: "Really cool mind blowing tech", + content: [ + { + id: 1, + title: "Perplexity", + description: "A good ui", + content: "", + image: "https://perplexity.ai/favicon.ico", + url: "https://perplexity.ai", + savedAt: new Date(), + baseUrl: "https://perplexity.ai", + }, + { + id: 2, + title: "Pi.ai", + description: "A good ui", + content: "", + image: "https://pi.ai/pi-logo-192.png?v=2", + url: "https://pi.ai", + savedAt: new Date(), + baseUrl: "https://pi.ai", + }, + { + id: 3, + title: "Visual Studio Code", + description: "A good ui", + content: "", + image: "https://code.visualstudio.com/favicon.ico", + url: "https://code.visualstudio.com", + savedAt: new Date(), + baseUrl: "https://code.visualstudio.com", + }, + ], + }, + { + id: 2, + title: "Cool Courses", + description: "Amazng", + content: [ + { + id: 1, + title: "Animation on the web", + description: "A good ui", + content: "", + image: "https://animations.dev/favicon.ico", + url: "https://animations.dev", + savedAt: new Date(), + baseUrl: "https://animations.dev", + }, + { + id: 2, + title: "Tailwind Course", + description: "A good ui", + content: "", + image: + "https://tailwindcss.com/_next/static/media/tailwindcss-mark.3c5441fc7a190fb1800d4a5c7f07ba4b1345a9c8.svg", + url: "https://tailwindcss.com", + savedAt: new Date(), + baseUrl: "https://tailwindcss.com", + }, + ], + }, + { + id: 3, + title: "Cool Libraries", + description: "Really cool mind blowing tech", + content: [ + { + id: 1, + title: "Perplexity", + description: "A good ui", + content: "", + image: "https://yashverma.me/logo.jpg", + url: "https://perplexity.ai", + savedAt: new Date(), + baseUrl: "https://perplexity.ai", + }, + ], + }, + ]; + + return ( +
+
+

Your Memories

+ } + className="bg-rgray-4 mt-2 w-full" + /> +
+
+ {spaces.map((space) => ( + + ))} +
+
+ ); +} + +export function Space({ title, description, content, id }: Space) { + console.log(title, content.map((c) => c.image).reverse()); + return ( + + ); +} diff --git a/apps/web/src/components/Sidebar/index.tsx b/apps/web/src/components/Sidebar/index.tsx index a140a19c..214ba816 100644 --- a/apps/web/src/components/Sidebar/index.tsx +++ b/apps/web/src/components/Sidebar/index.tsx @@ -1,9 +1,9 @@ "use client"; import { StoredContent } from "@/server/db/schema"; import { MemoryIcon } from "../../assets/Memories"; -import { Search, Trash2, User2 } from "lucide-react"; +import { Trash2, User2 } from "lucide-react"; import React, { useState } from "react"; -import { InputWithIcon } from "../ui/input"; +import { MemoriesBar } from "./MemoriesBar"; export type MenuItem = { icon: React.ReactNode | React.ReactNode[]; @@ -96,21 +96,8 @@ const MenuItem = ({ export function SubSidebar({ children }: { children?: React.ReactNode }) { return ( -
+
{children}
); } - -export function MemoriesBar() { - return ( -
-

Your Memories

- } - className="mt-2" - /> -
- ); -} diff --git a/apps/web/src/components/ui/input.tsx b/apps/web/src/components/ui/input.tsx index deb877dd..cee654a8 100644 --- a/apps/web/src/components/ui/input.tsx +++ b/apps/web/src/components/ui/input.tsx @@ -11,7 +11,7 @@ const Input = React.forwardRef( ( return (
diff --git a/apps/web/src/components/ui/textarea.tsx b/apps/web/src/components/ui/textarea.tsx index 6c79b228..10a7ed75 100644 --- a/apps/web/src/components/ui/textarea.tsx +++ b/apps/web/src/components/ui/textarea.tsx @@ -10,7 +10,7 @@ const Textarea = React.forwardRef( return (