From 67901f25329865f16057c6aa1a1ea372056e92e9 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Sun, 21 Jul 2024 10:39:34 -0500 Subject: [PATCH 01/44] launch fixes: fix onboarding and no dead buttons --- apps/web/app/(auth)/onboarding/page.tsx | 9 +- apps/web/app/(dash)/menu.tsx | 298 ++++++++++++------------ 2 files changed, 157 insertions(+), 150 deletions(-) diff --git a/apps/web/app/(auth)/onboarding/page.tsx b/apps/web/app/(auth)/onboarding/page.tsx index 1912a8e8..c402c560 100644 --- a/apps/web/app/(auth)/onboarding/page.tsx +++ b/apps/web/app/(auth)/onboarding/page.tsx @@ -9,7 +9,7 @@ import { } from "@heroicons/react/24/solid"; import { CheckIcon, PlusCircleIcon } from "@heroicons/react/24/outline"; import { motion } from "framer-motion"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { toast } from "sonner"; import { createMemory } from "@repo/web/app/actions/doers"; import { useRouter } from "next/navigation"; @@ -20,6 +20,13 @@ import gradientStyle from "../signin/_components/TextGradient/gradient.module.cs export default function Home() { const [currStep, setCurrStep] = useState(0); + const { push } = useRouter(); + + useEffect(() => { + if (currStep > 3) { + push("/home?q=what%20is%20supermemory"); + } + }, [currStep]); return (
diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx index 0b487e61..e5501958 100644 --- a/apps/web/app/(dash)/menu.tsx +++ b/apps/web/app/(dash)/menu.tsx @@ -1,176 +1,176 @@ -import React from 'react'; -import Image from 'next/image'; -import Link from 'next/link'; -import { MemoriesIcon, CanvasIcon, AddIcon } from '@repo/ui/icons'; -import { DialogTrigger } from '@repo/ui/shadcn/dialog'; +import React from "react"; +import Image from "next/image"; +import Link from "next/link"; +import { MemoriesIcon, CanvasIcon, AddIcon } from "@repo/ui/icons"; +import { DialogTrigger } from "@repo/ui/shadcn/dialog"; -import { HomeIcon } from '@heroicons/react/24/solid'; +import { HomeIcon } from "@heroicons/react/24/solid"; import { - PencilSquareIcon, - PlusIcon, - PresentationChartLineIcon, - RectangleStackIcon, -} from '@heroicons/react/24/solid'; + PencilSquareIcon, + PlusIcon, + PresentationChartLineIcon, + RectangleStackIcon, +} from "@heroicons/react/24/solid"; import DialogTriggerWrapper, { - DialogDesktopTrigger, - DialogMobileTrigger, -} from './dialogTriggerWrapper'; + DialogDesktopTrigger, + DialogMobileTrigger, +} from "./dialogTriggerWrapper"; const menuItems = [ - { - icon: MemoriesIcon, - text: 'Memories', - url: '/memories', - disabled: false, - }, - { - icon: CanvasIcon, - text: 'Canvas', - url: '/canvas', - disabled: true, - }, + { + icon: MemoriesIcon, + text: "Memories", + url: "/memories", + disabled: false, + }, + { + icon: CanvasIcon, + text: "Canvas", + url: "/canvas", + disabled: true, + }, ]; const items = [ - { - icon: , - name: 'home', - url: '/home', - disabled: false, - }, - { - icon: , - name: 'memories', - url: '/memories', - disabled: false, - }, - { - icon: , - name: 'editor', - url: '/#', - disabled: true, - }, - { - icon: , - name: 'thinkpad', - url: '/#', - disabled: true, - }, + { + icon: , + name: "home", + url: "/home", + disabled: false, + }, + { + icon: , + name: "memories", + url: "/memories", + disabled: false, + }, + // { + // icon: , + // name: 'editor', + // url: '/#', + // disabled: true, + // }, + // { + // icon: , + // name: 'thinkpad', + // url: '/#', + // disabled: true, + // }, ]; function Menu() { - return ( - <> - {/* Desktop Menu */} -
-
-
- -
- {items.map((v) => ( - - ))} -
-
-
+ return ( + <> + {/* Desktop Menu */} +
+
+
+ +
+ {items.map((v) => ( + + ))} +
+
+
- {/* Mobile Menu */} -
-
- - -

Home

- + {/* Mobile Menu */} +
+
+ + +

Home

+ - - {menuItems.map((item) => ( - - {`${item.text} -

{item.text}

- - ))} -
-
- - ); + + {menuItems.map((item) => ( + + {`${item.text} +

{item.text}

+ + ))} +
+
+ + ); } export function Navbar() { - return ( -
-
-
-
- - {items.map((v) => ( - - ))} -
-
-
- ); + return ( +
+
+
+
+ + {items.map((v) => ( + + ))} +
+
+
+ ); } function Top() { - return ( - - -
-
- -
-
-
- Add Memories -
-
-
-
- ); + return ( + + +
+
+ +
+
+
+ Add Memories +
+
+
+
+ ); } function NavItem({ - disabled, - icon, - url, - name, + disabled, + icon, + url, + name, }: { - disabled: boolean; - icon: React.JSX.Element; - name: string; - url: string; + disabled: boolean; + icon: React.JSX.Element; + name: string; + url: string; }) { - return ( -
- -
- {icon} -
- -
- {name} -
-
- ); + return ( +
+ +
+ {icon} +
+ +
+ {name} +
+
+ ); } export default Menu; From c24e9de8f214a76a70ece0716651ebab0b18ff90 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Sun, 21 Jul 2024 10:41:19 -0500 Subject: [PATCH 02/44] /chat page redirects back to home --- apps/web/app/(dash)/chat/route.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 apps/web/app/(dash)/chat/route.ts diff --git a/apps/web/app/(dash)/chat/route.ts b/apps/web/app/(dash)/chat/route.ts new file mode 100644 index 00000000..6599590c --- /dev/null +++ b/apps/web/app/(dash)/chat/route.ts @@ -0,0 +1,5 @@ +import { redirect } from "next/navigation"; + +export default async function GET() { + return redirect("/home"); +} From 2dca0d0a7963343c27a4d494fc78df5e7abfa337 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Sun, 21 Jul 2024 10:43:00 -0500 Subject: [PATCH 03/44] fix: oopsies, not default function --- apps/web/app/(dash)/chat/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/app/(dash)/chat/route.ts b/apps/web/app/(dash)/chat/route.ts index 6599590c..94f250ff 100644 --- a/apps/web/app/(dash)/chat/route.ts +++ b/apps/web/app/(dash)/chat/route.ts @@ -1,5 +1,5 @@ import { redirect } from "next/navigation"; -export default async function GET() { +export async function GET() { return redirect("/home"); } From 4078d2dd6bbe07bf310379edb49918f744afa1ad Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Sun, 21 Jul 2024 11:26:05 -0500 Subject: [PATCH 04/44] producthunt link --- apps/web/app/(quicklinks)/ph/route.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 apps/web/app/(quicklinks)/ph/route.ts diff --git a/apps/web/app/(quicklinks)/ph/route.ts b/apps/web/app/(quicklinks)/ph/route.ts new file mode 100644 index 00000000..7355c24c --- /dev/null +++ b/apps/web/app/(quicklinks)/ph/route.ts @@ -0,0 +1,5 @@ +import { redirect } from "next/navigation"; + +export async function GET() { + return redirect("https://www.producthunt.com/posts/supermemory"); +} From 99c08602dfc30e8a0bd5efeb858514445f025d23 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Sun, 21 Jul 2024 21:05:37 -0500 Subject: [PATCH 05/44] revert menu --- apps/web/app/(dash)/menu.tsx | 489 ++++++++++++++++++++++---------- apps/web/app/(landing)/Hero.tsx | 12 + packages/ui/icons/index.ts | 2 + 3 files changed, 353 insertions(+), 150 deletions(-) diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx index e5501958..396623ff 100644 --- a/apps/web/app/(dash)/menu.tsx +++ b/apps/web/app/(dash)/menu.tsx @@ -1,176 +1,365 @@ -import React from "react"; +"use client"; + +import React, { useEffect, useMemo, useState } from "react"; import Image from "next/image"; import Link from "next/link"; -import { MemoriesIcon, CanvasIcon, AddIcon } from "@repo/ui/icons"; -import { DialogTrigger } from "@repo/ui/shadcn/dialog"; - -import { HomeIcon } from "@heroicons/react/24/solid"; import { - PencilSquareIcon, - PlusIcon, - PresentationChartLineIcon, - RectangleStackIcon, -} from "@heroicons/react/24/solid"; -import DialogTriggerWrapper, { - DialogDesktopTrigger, - DialogMobileTrigger, -} from "./dialogTriggerWrapper"; - -const menuItems = [ - { - icon: MemoriesIcon, - text: "Memories", - url: "/memories", - disabled: false, - }, - { - icon: CanvasIcon, - text: "Canvas", - url: "/canvas", - disabled: true, - }, -]; - -const items = [ - { - icon: , - name: "home", - url: "/home", - disabled: false, - }, - { - icon: , - name: "memories", - url: "/memories", - disabled: false, - }, - // { - // icon: , - // name: 'editor', - // url: '/#', - // disabled: true, - // }, - // { - // icon: , - // name: 'thinkpad', - // url: '/#', - // disabled: true, - // }, -]; + MemoriesIcon, + ExploreIcon, + CanvasIcon, + AddIcon, + HomeIcon as HomeIconWeb, +} from "@repo/ui/icons"; +import { Button } from "@repo/ui/shadcn/button"; +import { MinusIcon, PlusCircleIcon } from "lucide-react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@repo/ui/shadcn/dialog"; +import { Label } from "@repo/ui/shadcn/label"; +import { Textarea } from "@repo/ui/shadcn/textarea"; +import { toast } from "sonner"; +import { getSpaces } from "../actions/fetchers"; +import { HomeIcon } from "@heroicons/react/24/solid"; +import { createMemory, createSpace } from "../actions/doers"; +import ComboboxWithCreate from "@repo/ui/shadcn/combobox"; +import { StoredSpace } from "@/server/db/schema"; +import useMeasure from "react-use-measure"; function Menu() { + const [spaces, setSpaces] = useState([]); + + useEffect(() => { + (async () => { + let spaces = await getSpaces(); + + if (!spaces.success || !spaces.data) { + toast.warning("Unable to get spaces", { + richColors: true, + }); + setSpaces([]); + return; + } + setSpaces(spaces.data); + })(); + }, []); + + const menuItems = [ + { + icon: HomeIconWeb, + text: "Home", + url: "/home", + disabled: false, + }, + { + icon: MemoriesIcon, + text: "Memories", + url: "/memories", + disabled: false, + }, + ]; + + const [content, setContent] = useState(""); + const [selectedSpaces, setSelectedSpaces] = useState([]); + + const autoDetectedType = useMemo(() => { + if (content.length === 0) { + return "none"; + } + + if ( + content.match(/https?:\/\/(x\.com|twitter\.com)\/[\w]+\/[\w]+\/[\d]+/) + ) { + return "tweet"; + } else if (content.match(/https?:\/\/[\w\.]+/)) { + return "page"; + } else if (content.match(/https?:\/\/www\.[\w\.]+/)) { + return "page"; + } else { + return "note"; + } + }, [content]); + + const [dialogOpen, setDialogOpen] = useState(false); + + const options = useMemo( + () => + spaces.map((x) => ({ + label: x.name, + value: x.id.toString(), + })), + [spaces], + ); + + const handleSubmit = async (content?: string, spaces?: number[]) => { + setDialogOpen(false); + + toast.info("Creating memory...", { + icon: , + duration: 7500, + }); + + if (!content || content.length === 0) { + toast.error("Content is required"); + return; + } + + console.log(spaces); + + const cont = await createMemory({ + content: content, + spaces: spaces ?? undefined, + }); + + setContent(""); + setSelectedSpaces([]); + + if (cont.success) { + toast.success("Memory created", { + richColors: true, + }); + } else { + toast.error(`Memory creation failed: ${cont.error}`); + } + }; + return ( <> {/* Desktop Menu */} -
-
-
- -
- {items.map((v) => ( - + +
+
+
+ + Logo +

+ Add +

+
+
+ {menuItems.map((item) => ( + + {`${item.text} +

+ {item.text} +

+ ))}
-
- {/* Mobile Menu */} -
-
- +
{ + const content = e.get("content")?.toString(); + + await handleSubmit(content, selectedSpaces); + }} + className="flex flex-col gap-4 " > - -

Home

- + + Add memory + + A "Memory" is a bookmark, something you want to remember. + + - - {menuItems.map((item) => ( +
+ +