From 81ae72224fcea448ebff4ae44dbacda7d69b35cb Mon Sep 17 00:00:00 2001 From: MaheshtheDev <38828053+MaheshtheDev@users.noreply.github.com> Date: Fri, 12 Jun 2026 20:51:37 +0000 Subject: [PATCH] feat(spaces): per-space entity context + edit-space modal (#1078) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - "What to remember" per-space context β€” set on create, on edit, and in the space profile; steers what gets extracted into memory - Edit-space modal (name + context) from the space pill's hover edit, mirroring the create modal - Manual saves respect a space's configured context instead of overwriting it with the generic default --- apps/web/components/add-space-modal.tsx | 118 +++++++++-- apps/web/components/edit-space-modal.tsx | 206 ++++++++++++++++++++ apps/web/components/header.tsx | 1 + apps/web/components/space-profile-panel.tsx | 117 +++++++++-- apps/web/components/space-selector.tsx | 198 ++++++++++++------- apps/web/hooks/use-document-mutations.ts | 30 ++- apps/web/hooks/use-space-context.ts | 115 +++++++++++ 7 files changed, 681 insertions(+), 104 deletions(-) create mode 100644 apps/web/components/edit-space-modal.tsx create mode 100644 apps/web/hooks/use-space-context.ts diff --git a/apps/web/components/add-space-modal.tsx b/apps/web/components/add-space-modal.tsx index 7c9f3cf3..9f09da7c 100644 --- a/apps/web/components/add-space-modal.tsx +++ b/apps/web/components/add-space-modal.tsx @@ -2,7 +2,7 @@ import { useState } from "react" import { dmSans125ClassName, dmSansClassName } from "@/lib/fonts" -import { Dialog, DialogContent } from "@repo/ui/components/dialog" +import { Dialog, DialogContent, DialogTitle } from "@repo/ui/components/dialog" import { cn } from "@lib/utils" import * as DialogPrimitive from "@radix-ui/react-dialog" import { XIcon, Loader2 } from "lucide-react" @@ -10,6 +10,7 @@ import { Button } from "@ui/components/button" import { useProjectMutations } from "@/hooks/use-project-mutations" import { Popover, PopoverContent, PopoverTrigger } from "@ui/components/popover" import { analytics } from "@/lib/analytics" +import { $fetch } from "@lib/api" const EMOJI_LIST = [ "πŸ“", @@ -62,6 +63,25 @@ const EMOJI_LIST = [ "🀍", ] +export const CONTEXT_PRESETS: { label: string; text: string }[] = [ + { + label: "Work project", + text: "Tracks a work project β€” decisions, owners, deadlines, and current status.", + }, + { + label: "Client", + text: "About a client β€” meetings, requirements, and account context.", + }, + { + label: "Research", + text: "Research notes β€” sources, key findings, and open questions.", + }, + { + label: "Personal", + text: "My personal space β€” notes, ideas, and things to remember.", + }, +] + export function AddSpaceModal({ isOpen, onClose, @@ -72,6 +92,8 @@ export function AddSpaceModal({ onCreated?: (containerTag: string) => void }) { const [spaceName, setSpaceName] = useState("") + const [spaceContext, setSpaceContext] = useState("") + const [showContext, setShowContext] = useState(false) const [emoji, setEmoji] = useState("πŸ“") const [isEmojiOpen, setIsEmojiOpen] = useState(false) const { createProjectMutation } = useProjectMutations() @@ -79,6 +101,8 @@ export function AddSpaceModal({ const handleClose = () => { onClose() setSpaceName("") + setSpaceContext("") + setShowContext(false) setEmoji("πŸ“") } @@ -89,11 +113,18 @@ export function AddSpaceModal({ createProjectMutation.mutate( { name: trimmedName, emoji: emoji || undefined }, { - onSuccess: (data) => { + onSuccess: async (data) => { analytics.spaceCreated() - if (data?.containerTag) { - onCreated?.(data.containerTag) + const tag = data?.containerTag + const context = showContext ? spaceContext.trim() : "" + if (tag && context) { + try { + await $fetch(`@patch/container-tags/${tag}`, { + body: { entityContext: context }, + }) + } catch {} } + if (tag) onCreated?.(tag) handleClose() }, }, @@ -132,21 +163,21 @@ export function AddSpaceModal({
-

- Create new space -

+ New space +

- Create spaces to organize your memories and documents and create - a context rich environment + Group related memories and give Nova context for this space.

+ {!showContext ? ( + + ) : ( +
+
+ + What to remember + + + Optional + +
+