@@ -67,8 +57,8 @@ export function MemoriesBar({ spaces }: { spaces: CollectedSpaces[] }) {
const SpaceExitVariant: Variant = {
opacity: 0,
scale: 0,
- borderRadius: '50%',
- background: 'var(--gray-1)',
+ borderRadius: "50%",
+ background: "var(--gray-1)",
transition: {
duration: 0.2,
},
@@ -93,22 +83,22 @@ export function SpaceItem({
{
if (!itemRef.current) return;
- const trash = document.querySelector('#trash')! as HTMLDivElement;
- const trashBin = document.querySelector('#trash-button')!;
+ const trash = document.querySelector("#trash")! as HTMLDivElement;
+ const trashBin = document.querySelector("#trash-button")!;
const trashRect = trashBin.getBoundingClientRect();
const scopeRect = itemRef.current.getBoundingClientRect();
- const el = document.createElement('div');
- el.style.position = 'fixed';
- el.style.top = '0';
- el.style.left = '0';
- el.style.width = '15px';
- el.style.height = '15px';
- el.style.backgroundColor = 'var(--gray-7)';
- el.style.zIndex = '60';
- el.style.borderRadius = '50%';
- el.style.transform = 'scale(5)';
- el.style.opacity = '0';
- trash.dataset['open'] = 'true';
+ const el = document.createElement("div");
+ el.style.position = "fixed";
+ el.style.top = "0";
+ el.style.left = "0";
+ el.style.width = "15px";
+ el.style.height = "15px";
+ el.style.backgroundColor = "var(--gray-7)";
+ el.style.zIndex = "60";
+ el.style.borderRadius = "50%";
+ el.style.transform = "scale(5)";
+ el.style.opacity = "0";
+ trash.dataset["open"] = "true";
const initial = {
x: scopeRect.left + scopeRect.width / 2,
y: scopeRect.top + scopeRect.height / 2,
@@ -133,35 +123,35 @@ export function SpaceItem({
animateItem(itemRef.current, SpaceExitVariant, {
duration: 0.2,
}).then(() => {
- itemRef.current.style.scale = '0';
+ itemRef.current.style.scale = "0";
onDelete();
});
document.body.appendChild(el);
el.animate(
{
- transform: ['scale(5)', 'scale(1)'],
+ transform: ["scale(5)", "scale(1)"],
opacity: [0, 0.3, 1],
},
{
duration: 200,
- easing: 'cubic-bezier(0.64, 0.57, 0.67, 1.53)',
- fill: 'forwards',
+ easing: "cubic-bezier(0.64, 0.57, 0.67, 1.53)",
+ fill: "forwards",
},
);
el.animate(
{
- offsetDistance: ['0%', '100%'],
+ offsetDistance: ["0%", "100%"],
},
{
duration: 2000,
- easing: 'cubic-bezier(0.64, 0.57, 0.67, 1.53)',
- fill: 'forwards',
+ easing: "cubic-bezier(0.64, 0.57, 0.67, 1.53)",
+ fill: "forwards",
delay: 200,
},
).onfinish = () => {
el.animate(
- { transform: 'scale(0)', opacity: 0 },
- { duration: 200, fill: 'forwards' },
+ { transform: "scale(0)", opacity: 0 },
+ { duration: 200, fill: "forwards" },
).onfinish = () => {
el.remove();
};
diff --git a/apps/web/src/components/Sidebar/PagesItem.tsx b/apps/web/src/components/Sidebar/PagesItem.tsx
deleted file mode 100644
index fea8bf33..00000000
--- a/apps/web/src/components/Sidebar/PagesItem.tsx
+++ /dev/null
@@ -1,189 +0,0 @@
-"use client";
-import { cleanUrl } from "@/lib/utils";
-import { StoredContent } from "@/server/db/schema";
-import {
- DropdownMenu,
- DropdownMenuTrigger,
- DropdownMenuContent,
- DropdownMenuItem,
-} from "../ui/dropdown-menu";
-import { Label } from "../ui/label";
-import {
- ArrowUpRight,
- MoreHorizontal,
- Edit3,
- Trash2,
- Save,
- ChevronRight,
- Plus,
-} from "lucide-react";
-import { useState } from "react";
-import {
- Drawer,
- DrawerContent,
- DrawerHeader,
- DrawerTitle,
- DrawerDescription,
- DrawerFooter,
- DrawerClose,
-} from "../ui/drawer";
-import { Input } from "../ui/input";
-import { Textarea } from "../ui/textarea";
-import { Popover, PopoverContent, PopoverTrigger } from "../ui/popover";
-
-export const PageItem: React.FC<{ item: StoredContent }> = ({ item }) => {
- const [isDropdownOpen, setIsDropdownOpen] = useState(false);
- const [isEditDrawerOpen, setIsEditDrawerOpen] = useState(false);
-
- return (
-
- );
-};
-
-export const AddNewPagePopover: React.FC<{
- addNewUrl?: (url: string) => Promise;
-}> = ({ addNewUrl }) => {
- const [isOpen, setIsOpen] = useState(false);
- const [url, setUrl] = useState("");
-
- return (
-
-
-
-
-
-
- Add a new page
-
-
- setUrl(e.target.value)}
- onKeyDown={(e) => {
- if (e.key === "Enter") {
- setIsOpen(false);
- addNewUrl?.(url);
- }
- }}
- placeholder="Enter the URL of the page"
- />
-
-
- );
-};
diff --git a/apps/web/src/components/Sidebar/index.tsx b/apps/web/src/components/Sidebar/index.tsx
index 88b7472d..52bab0f9 100644
--- a/apps/web/src/components/Sidebar/index.tsx
+++ b/apps/web/src/components/Sidebar/index.tsx
@@ -1,49 +1,54 @@
-'use client';
-import { StoredContent } from '@/server/db/schema';
-import { MemoryIcon } from '../../assets/Memories';
-import { Trash2, User2 } from 'lucide-react';
-import React, { ElementType, useEffect, useState } from 'react';
-import { MemoriesBar } from './MemoriesBar';
-import { AnimatePresence, motion } from 'framer-motion';
-import { Bin } from '@/assets/Bin';
-import { CollectedSpaces } from '../../../types/memory';
+"use client";
+import { StoredContent } from "@/server/db/schema";
+import { MemoryIcon } from "../../assets/Memories";
+import { Trash2, User2 } from "lucide-react";
+import React, { ElementType, useEffect, useState } from "react";
+import { MemoriesBar } from "./MemoriesBar";
+import { AnimatePresence, motion } from "framer-motion";
+import { Bin } from "@/assets/Bin";
+import { CollectedSpaces } from "../../../types/memory";
+import { useMemory } from "@/contexts/MemoryContext";
export type MenuItem = {
icon: React.ReactNode | React.ReactNode[];
label: string;
- content?: React.ReactElement;
+ content?: React.ReactNode;
};
const menuItemsBottom: Array
@@ -119,11 +120,11 @@ const MenuItem = ({
export function SubSidebar({ children }: { children?: React.ReactNode }) {
return (