From 1fd0aae0be8c8a4bf0e1766911102f9954812729 Mon Sep 17 00:00:00 2001 From: Dhravya Date: Sun, 14 Jul 2024 20:48:06 -0500 Subject: [PATCH] small UX fixes and multi space save actually works now --- .eslintrc.js | 5 - apps/web/app/(dash)/(memories)/content.tsx | 9 +- apps/web/app/(dash)/menu.tsx | 288 +++++++++---------- apps/web/app/actions/doers.ts | 16 +- apps/web/components/twitter/render-tweet.tsx | 6 +- package.json | 3 +- packages/shared-types/utils.ts | 15 +- packages/ui/shadcn/combobox.tsx | 34 +-- 8 files changed, 173 insertions(+), 203 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8c1f1f56..e928b868 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,9 +7,4 @@ module.exports = { parserOptions: { project: true, }, - // ignore some rules - rules: { - "@": "off", - "import/no-unresolved": "off", - }, }; diff --git a/apps/web/app/(dash)/(memories)/content.tsx b/apps/web/app/(dash)/(memories)/content.tsx index 9f84a6b6..879c0502 100644 --- a/apps/web/app/(dash)/(memories)/content.tsx +++ b/apps/web/app/(dash)/(memories)/content.tsx @@ -284,7 +284,10 @@ function LinkComponent({
Page
-
{title}
+ {/* remove `<---chunkId: ${vector.id}\n${content}\n---->` pattern from title */} +
+ {title.replace(/(<---chunkId: .*?\n.*?\n---->)/g, "")} +
{url.replace("https://supermemory.ai", "").split("#")[0] ?? "/"}
@@ -294,7 +297,9 @@ function LinkComponent({
Note
-
{title}
+
+ {title.replace(/(<---chunkId: .*?\n.*?\n---->)/g, "")} +
{content.replace(title, "")}
diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx index d9ba6c71..c807c579 100644 --- a/apps/web/app/(dash)/menu.tsx +++ b/apps/web/app/(dash)/menu.tsx @@ -17,34 +17,15 @@ import { } from "@repo/ui/shadcn/dialog"; import { Label } from "@repo/ui/shadcn/label"; import { Textarea } from "@repo/ui/shadcn/textarea"; -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, - SelectValue, -} from "@repo/ui/shadcn/select"; import { toast } from "sonner"; import { getSpaces } from "../actions/fetchers"; -import { Space } from "../actions/types"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "@repo/ui/shadcn/tooltip"; -import { InformationCircleIcon } from "@heroicons/react/24/outline"; import { HomeIcon } from "@heroicons/react/24/solid"; import { createMemory, createSpace } from "../actions/doers"; -import { Input } from "@repo/ui/shadcn/input"; import ComboboxWithCreate from "@repo/ui/shadcn/combobox"; import { StoredSpace } from "@/server/db/schema"; -import { revalidatePath } from "next/cache"; import useMeasure from "react-use-measure"; -import { motion } from "framer-motion"; function Menu() { - const [ref, bounds] = useMeasure(); const [spaces, setSpaces] = useState([]); useEffect(() => { @@ -109,7 +90,7 @@ function Menu() { [spaces], ); - const handleSubmit = async (content?: string, space?: string) => { + const handleSubmit = async (content?: string, spaces?: number[]) => { setDialogOpen(false); toast.info("Creating memory...", { @@ -122,12 +103,15 @@ function Menu() { return; } + console.log(spaces); + const cont = await createMemory({ content: content, - spaces: space ? [space] : undefined, + spaces: spaces ?? undefined, }); setContent(""); + setSelectedSpaces([]); if (cont.success) { toast.success("Memory created", { @@ -187,148 +171,138 @@ function Menu() { - -
{ - const content = e.get("content")?.toString(); - const space = e.get("space")?.toString(); + { + const content = e.get("content")?.toString(); - await handleSubmit(content, space); - }} - className="flex flex-col gap-4 " - > - - Add memory - - A "Memory" is a bookmark, something you want to remember. - - + await handleSubmit(content, selectedSpaces); + }} + className="flex flex-col gap-4 " + > + + Add memory + + A "Memory" is a bookmark, something you want to remember. + + + +
+ +