diff --git a/apps/web/app/(dash)/dynamicisland.tsx b/apps/web/app/(dash)/dynamicisland.tsx deleted file mode 100644 index 8b1b4633..00000000 --- a/apps/web/app/(dash)/dynamicisland.tsx +++ /dev/null @@ -1,315 +0,0 @@ -"use client"; - -import { AddIcon } from "@repo/ui/icons"; -import Image from "next/image"; - -import { AnimatePresence, useMotionValueEvent, useScroll } from "framer-motion"; -import { useActionState, useEffect, useRef, useState } from "react"; -import { motion } from "framer-motion"; -import { Label } from "@repo/ui/shadcn/label"; -import { Input } from "@repo/ui/shadcn/input"; -import { Textarea } from "@repo/ui/shadcn/textarea"; -import { createMemory, createSpace } from "../actions/doers"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@repo/ui/shadcn/select"; -import { Space } from "../actions/types"; -import { getSpaces } from "../actions/fetchers"; -import { toast } from "sonner"; -import { useFormStatus } from "react-dom"; - -export function DynamicIsland() { - const { scrollYProgress } = useScroll(); - const [visible, setVisible] = useState(true); - - useMotionValueEvent(scrollYProgress, "change", (current) => { - if (typeof current === "number") { - let direction = current! - scrollYProgress.getPrevious()!; - - if (direction < 0 || direction === 1) { - setVisible(true); - } else { - setVisible(false); - } - } - }); - - return ( -
- - - - - -
- ); -} - -export default DynamicIsland; - -function DynamicIslandContent() { - const [show, setshow] = useState(true); - function cancelfn() { - setshow(true); - } - - const lastBtn = useRef(); - - useEffect(() => { - document.addEventListener("keydown", (e) => { - if (e.key === "Escape") { - setshow(true); - } - - if (e.key === "a" && lastBtn.current === "Alt") { - setshow(false); - } - lastBtn.current = e.key; - }); - }, []); - return ( - <> - {show ? ( - - ) : ( - - )} - - ); -} - -const fakeitems = ["page", "spaces"]; - -function ToolBar({ cancelfn }: { cancelfn: () => void }) { - const [spaces, setSpaces] = useState([]); - - const [index, setIndex] = useState(0); - - useEffect(() => { - (async () => { - let spaces = await getSpaces(); - - if (!spaces.success || !spaces.data) { - toast.warning("Unable to get spaces", { - richColors: true, - }); - setSpaces([]); - return; - } - setSpaces(spaces.data); - })(); - }, []); - - return ( - - -
- setIndex(i)} - /> -
- {index === 1 ? ( - - ) : ( - - )} -
-
- ); -} - -export const HoverEffect = ({ - items, - index, - indexFn, -}: { - items: string[]; - index: number; - indexFn: (i: number) => void; -}) => { - return ( -
- {items.map((item, idx) => ( - - ))} -
- ); -}; - -function SpaceForm({ cancelfn }: { cancelfn: () => void }) { - return ( -
-
- - -
-
- {/* - pull from store - */} - {/*
- cancel -
*/} - -
-
- ); -} - -function PageForm({ - cancelfn, - spaces, -}: { - cancelfn: () => void; - spaces: Space[]; -}) { - const [loading, setLoading] = useState(false); - - const { pending } = useFormStatus(); - return ( -
{ - const content = e.get("content")?.toString(); - const space = e.get("space")?.toString(); - - toast.info("Creating memory..."); - - if (!content) { - toast.error("Content is required"); - return; - } - cancelfn(); - const cont = await createMemory({ - content: content, - spaces: space ? [space] : undefined, - }); - - if (cont.success) { - toast.success("Memory created"); - } else { - toast.error("Memory creation failed"); - } - }} - className="bg-secondary border border-muted-foreground px-4 py-3 rounded-2xl mt-2 flex flex-col gap-3 w-[100vw] md:w-[400px]" - > -
- - -
-
- -