From 323589f2815995873673e4975a83d72fa9842131 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Mon, 21 Sep 2026 11:04:08 -0600 Subject: [PATCH 01/10] Default markdown editors to preview mode - Open markdown editors in the rendered preview state instead of raw markdown by default. - Preserve edit and live views through the editor toolbar. - Keep the `preview` prop overridable by callers because it is spread after the default. --- components/markdown/markdown-widgets.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/markdown/markdown-widgets.tsx b/components/markdown/markdown-widgets.tsx index 8e3e15e..763b2d1 100644 --- a/components/markdown/markdown-widgets.tsx +++ b/components/markdown/markdown-widgets.tsx @@ -9,7 +9,16 @@ import type { RehypeRewriteOptions } from "rehype-rewrite"; // out of the initial board bundle. Shared here so every place that needs // markdown (group notes, to-do details) uses the exact same editor/preview // widgets instead of each declaring its own dynamic import. -export const MDEditor = dynamic(() => import("@uiw/react-md-editor"), { ssr: false }); +const RawMDEditor = dynamic(() => import("@uiw/react-md-editor"), { ssr: false }); + +// `preview` only seeds the editor's initial mode -- @uiw/react-md-editor +// owns it as internal state after that, flipped by the edit/live/preview +// toolbar buttons. Defaulting it to "preview" opens every editor rendered +// instead of raw markdown, while the toolbar still lets someone drop into +// "edit" (or the split "live" view) when they want granular control. +export function MDEditor(props: ComponentProps) { + return ; +} const RawMarkdownPreview = dynamic( () => import("@uiw/react-md-editor").then((mod) => mod.default.Markdown), From ddba8813800a1356e1d9df2062e8d13702d8dc52 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Mon, 21 Sep 2026 12:48:35 -0600 Subject: [PATCH 02/10] Replace notes dialog with group session dialog - Combine group notes and to-dos in one editing surface - Add debounced autosave with explicit save and flush-on-close - Preserve in-progress local edits against cross-device and AI updates --- components/board/group-card.tsx | 16 +- components/board/group-session-dialog.tsx | 481 ++++++++++++++++++++++ components/board/notes-dialog.tsx | 112 ----- hooks/use-autosave.ts | 64 +++ 4 files changed, 559 insertions(+), 114 deletions(-) create mode 100644 components/board/group-session-dialog.tsx delete mode 100644 components/board/notes-dialog.tsx create mode 100644 hooks/use-autosave.ts diff --git a/components/board/group-card.tsx b/components/board/group-card.tsx index ab405c3..ea367c7 100644 --- a/components/board/group-card.tsx +++ b/components/board/group-card.tsx @@ -9,6 +9,7 @@ import { ClipboardList, GripVertical, MoreVertical, + NotebookPen, Pencil, Plus, Sparkles, @@ -33,7 +34,7 @@ import { isDarkTheme, useGroupColor } from "@/components/theme/use-dark-theme"; import { useBoard } from "@/components/board/board-context"; import { useBoardView } from "@/components/board/board-view-provider"; import { NEW_GROUP_HOLD_MS, useHoldOnComplete } from "@/components/hold-on-complete"; -import { NotesDialog } from "@/components/board/notes-dialog"; +import { GroupSessionDialog } from "@/components/board/group-session-dialog"; import { TodoAiDialog } from "@/components/board/todo-ai-dialog"; import { TodoCreateDialog } from "@/components/board/todo-create-dialog"; import { TodoCreatePopover } from "@/components/board/todo-create-popover"; @@ -97,6 +98,7 @@ export function GroupCard({ group }: { group: GroupDTO }) { const [editingTodo, setEditingTodo] = useState(null); const [editOpen, setEditOpen] = useState(false); const [confirmOpen, setConfirmOpen] = useState(false); + const [sessionOpen, setSessionOpen] = useState(false); const [todoAiOpen, setTodoAiOpen] = useState(false); const [todoCreateOpen, setTodoCreateOpen] = useState(false); const [statusUpdateOpen, setStatusUpdateOpen] = useState(false); @@ -270,7 +272,15 @@ export function GroupCard({ group }: { group: GroupDTO }) {
- + + + ({ + id: t.id, + title: t.title, + details: t.details ?? "", + completed: t.completed, + isNew: false, + order: t.order, + })); +} + +/** + * Merges fresh server todos into the local draft list without clobbering + * anything the user has mid-edit: a draft whose id is in `dirtyIds` (still + * unsaved, or mid-save) is kept as-is; everything else is refreshed from + * the server, including dropping drafts the server no longer has and + * picking up server todos not yet represented locally. + */ +function reconcileTodoDrafts( + current: TodoDraft[], + serverTodos: TodoDTO[], + dirtyIds: Set +): TodoDraft[] { + const currentById = new Map(current.map((d) => [d.id, d])); + const merged: TodoDraft[] = []; + + for (const todo of serverTodos) { + const existing = currentById.get(todo.id); + if (existing && dirtyIds.has(todo.id)) { + merged.push(existing); + } else { + merged.push({ + id: todo.id, + title: todo.title, + details: todo.details ?? "", + completed: todo.completed, + isNew: false, + order: todo.order, + }); + } + } + + // Local-only new rows (not yet persisted) and any dirty draft the server + // list somehow doesn't have yet both survive untouched. + for (const draft of current) { + if (draft.isNew || (dirtyIds.has(draft.id) && !serverTodos.some((t) => t.id === draft.id))) { + if (!merged.some((d) => d.id === draft.id)) merged.push(draft); + } + } + + return merged; +} + +export function GroupSessionDialog({ + group, + open, + onOpenChange, +}: { + group: GroupDTO; + open: boolean; + onOpenChange: (open: boolean) => void; +}) { + const { saveNote, addTodo, editTodo, toggleTodoDone, removeTodo } = useBoard(); + const colorMode = colorModeFromTheme(); + const isDark = isDarkTheme(); + const color = useGroupColor(group.color); + const accentColor = isDark ? color.dark : color.light; + const todoTextColor = getBrighterColor(accentColor, isDark ? "dark" : "light"); + + const [noteDraft, setNoteDraft] = useState(group.noteContent); + const [todoDrafts, setTodoDrafts] = useState(() => toDrafts(group.todos)); + const [aiOpen, setAiOpen] = useState(false); + const [todoAiOpen, setTodoAiOpen] = useState(false); + const [savingAll, setSavingAll] = useState(false); + + const rowFlushersRef = useRef(new Map Promise>()); + const dirtyRowIdsRef = useRef(new Set()); + + const noteAutosave = useAutosave( + noteDraft, + useCallback((v: string) => saveNote(group.id, group.categoryId, v), [group.id, group.categoryId, saveNote]) + ); + + // Seed fresh drafts every time the session opens, so a prior open's + // leftover local-only "new" rows never leak into the next session. + function handleOpenChange(next: boolean) { + if (next) { + setNoteDraft(group.noteContent); + setTodoDrafts(toDrafts(group.todos)); + } else { + // Fire-and-forget: close immediately, flush any pending autosaves in + // the background. board-context's mutators already toast on failure, + // and their state lives above this dialog so it's safe to keep + // running after this component unmounts. + void handleSaveAll(); + } + onOpenChange(next); + } + + // Picks up remote changes (cross-device poll, an accepted "Ask AI" edit) + // while this session is open, but never while the corresponding field is + // dirty or mid-save -- otherwise a poll landing mid-keystroke would wipe + // out what the user just typed. + useEffect(() => { + if (!open) return; + if (!noteAutosave.isDirty && !noteAutosave.isSaving) { + // eslint-disable-next-line react-hooks/set-state-in-effect -- syncing from an external source (cross-device poll / accepted AI edit), same pattern as theme-provider.tsx + setNoteDraft(group.noteContent); + } + }, [group.noteContent, open, noteAutosave.isDirty, noteAutosave.isSaving]); + + useEffect(() => { + if (!open) return; + setTodoDrafts((prev) => reconcileTodoDrafts(prev, group.todos, dirtyRowIdsRef.current)); + }, [group.todos, open]); + + function updateTodoDraft(id: string, patch: Partial) { + setTodoDrafts((prev) => prev.map((d) => (d.id === id ? { ...d, ...patch } : d))); + } + + function removeTodoDraftLocalOnly(id: string) { + setTodoDrafts((prev) => prev.filter((d) => d.id !== id)); + dirtyRowIdsRef.current.delete(id); + rowFlushersRef.current.delete(id); + } + + function registerRowFlush(id: string, flush: () => Promise) { + rowFlushersRef.current.set(id, flush); + return () => { + rowFlushersRef.current.delete(id); + }; + } + + function setRowDirty(id: string, dirty: boolean) { + if (dirty) dirtyRowIdsRef.current.add(id); + else dirtyRowIdsRef.current.delete(id); + } + + async function handleAddTodoCreated(tempIdToRemove: string) { + removeTodoDraftLocalOnly(tempIdToRemove); + } + + function addEmptyTodoDraft() { + setTodoDrafts((prev) => [ + ...prev, + { id: tempId(), title: "", details: "", completed: false, isNew: true, order: prev.length }, + ]); + } + + async function handleSaveAll() { + setSavingAll(true); + try { + await Promise.all([ + noteAutosave.flush(), + ...Array.from(rowFlushersRef.current.values()).map((f) => f()), + ]); + } finally { + setSavingAll(false); + } + } + + return ( + <> + + +
+ {group.title} +
+ + {savingAll || noteAutosave.isSaving ? "Saving…" : "Saved"} + + } + > + + +
+
+ +
+
+ + setNoteDraft(v ?? "")} + height={280} + preview="edit" + /> +
+ +
+ +
+ {todoDrafts.map((draft) => ( + updateTodoDraft(draft.id, patch)} + onRemoveLocalOnly={() => removeTodoDraftLocalOnly(draft.id)} + onCreated={() => handleAddTodoCreated(draft.id)} + onDirtyChange={(dirty) => setRowDirty(draft.id, dirty)} + registerFlush={registerRowFlush} + addTodo={addTodo} + editTodo={editTodo} + toggleTodoDone={toggleTodoDone} + removeTodo={removeTodo} + /> + ))} + {todoDrafts.length === 0 && ( +

+ No to-dos yet. Add one below. +

+ )} +
+
+
+ +
+
+ + + +
+ +
+
+
+ + + + + ); +} + +function SessionTodoRow({ + draft, + groupId, + categoryId, + accentColor, + todoTextColor, + isDark, + onChangeLocal, + onRemoveLocalOnly, + onCreated, + onDirtyChange, + registerFlush, + addTodo, + editTodo, + toggleTodoDone, + removeTodo, +}: { + draft: TodoDraft; + groupId: string; + categoryId: string; + accentColor: string; + todoTextColor: string; + isDark: boolean; + onChangeLocal: (patch: Partial) => void; + onRemoveLocalOnly: () => void; + onCreated: () => void; + onDirtyChange: (dirty: boolean) => void; + registerFlush: (id: string, flush: () => Promise) => () => void; + addTodo: ReturnType["addTodo"]; + editTodo: ReturnType["editTodo"]; + toggleTodoDone: ReturnType["toggleTodoDone"]; + removeTodo: ReturnType["removeTodo"]; +}) { + const [editingDetails, setEditingDetails] = useState(false); + // Guards against creating the same new to-do twice if title/details both + // become dirty in the same tick (title autosave and details autosave + // would otherwise both try to create it). + const creatingRef = useRef | null>(null); + + const createIfNeeded = useCallback(async (): Promise => { + if (!draft.isNew) return; + const title = draft.title.trim(); + if (!title) return; + if (creatingRef.current) { + await creatingRef.current; + return; + } + creatingRef.current = (async () => { + const ok = await addTodo(groupId, categoryId, title, draft.details.trim() || undefined); + if (ok) onCreated(); + })(); + await creatingRef.current; + }, [draft.isNew, draft.title, draft.details, groupId, categoryId, addTodo, onCreated]); + + const saveTitle = useCallback( + async (title: string) => { + if (draft.isNew) { + await createIfNeeded(); + return; + } + if (!title.trim()) return; + await editTodo(draft.id, groupId, categoryId, { title: title.trim() }); + }, + [draft.isNew, draft.id, groupId, categoryId, editTodo, createIfNeeded] + ); + + const saveDetails = useCallback( + async (details: string) => { + if (draft.isNew) { + await createIfNeeded(); + return; + } + await editTodo(draft.id, groupId, categoryId, { details: details.trim() || null }); + }, + [draft.isNew, draft.id, groupId, categoryId, editTodo, createIfNeeded] + ); + + const titleAutosave = useAutosave(draft.title, saveTitle); + const detailsAutosave = useAutosave(draft.details, saveDetails); + + const dirty = titleAutosave.isDirty || titleAutosave.isSaving || detailsAutosave.isDirty || detailsAutosave.isSaving; + useEffect(() => { + onDirtyChange(dirty); + }, [dirty, onDirtyChange]); + + useEffect(() => { + const flush = async () => { + if (draft.isNew && draft.title.trim()) { + await createIfNeeded(); + return; + } + await Promise.all([titleAutosave.flush(), detailsAutosave.flush()]); + }; + return registerFlush(draft.id, flush); + }, [draft.id, draft.isNew, draft.title, createIfNeeded, titleAutosave, detailsAutosave, registerFlush]); + + function handleToggle(next: boolean) { + onChangeLocal({ completed: next }); + if (!draft.isNew) { + void toggleTodoDone(draft.id, groupId, categoryId, next); + } + } + + function handleDelete() { + if (draft.isNew) { + onRemoveLocalOnly(); + } else { + onRemoveLocalOnly(); + void removeTodo(draft.id, groupId, categoryId); + } + } + + const checkbox = ( + + ); + + return ( +
+
+ {draft.isNew ? ( + + } + > + {checkbox} + + Save a title first + + ) : ( + checkbox + )} + onChangeLocal({ title: e.target.value })} + style={draft.completed ? undefined : { color: todoTextColor }} + className={cn("flex-1", draft.completed && "text-muted-foreground line-through")} + /> + +
+ +
+ + +
+ + {editingDetails ? ( + onChangeLocal({ details: v ?? "" })} + height={160} + preview="edit" + /> + ) : draft.details ? ( +
+ +
+ ) : ( +

+ No details yet. +

+ )} +
+ ); +} diff --git a/components/board/notes-dialog.tsx b/components/board/notes-dialog.tsx deleted file mode 100644 index a95ffad..0000000 --- a/components/board/notes-dialog.tsx +++ /dev/null @@ -1,112 +0,0 @@ -"use client"; - -import { useEffect, useState } from "react"; -import { NotebookPen, Pencil, Sparkles } from "lucide-react"; - -import { Button } from "@/components/ui/button"; -import { colorModeFromTheme } from "@/components/theme/use-dark-theme"; -import { - Dialog, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, -} from "@/components/ui/dialog"; -import { MDEditor, MarkdownPreview } from "@/components/markdown/markdown-widgets"; -import { useBoard } from "@/components/board/board-context"; -import { GroupAiDialog } from "@/components/board/group-ai-dialog"; -import type { GroupDTO } from "@/types/board"; - -export function NotesDialog({ group }: { group: GroupDTO }) { - const { saveNote } = useBoard(); - const colorMode = colorModeFromTheme(); - - const [open, setOpen] = useState(false); - const [editing, setEditing] = useState(false); - const [draft, setDraft] = useState(group.noteContent); - const [pending, setPending] = useState(false); - const [aiOpen, setAiOpen] = useState(false); - - function handleOpenChange(next: boolean) { - setOpen(next); - if (next) { - setDraft(group.noteContent); - setEditing(false); - } - } - - // The "Ask AI" dialog can update this group's notes (via saveNote) while - // this dialog stays open behind it. Pick up that change so the accepted - // AI notes show up here immediately instead of the stale pre-AI draft. - useEffect(() => { - if (open && !editing) { - setDraft(group.noteContent); - } - }, [group.noteContent, open, editing]); - - async function handleSave() { - setPending(true); - const ok = await saveNote(group.id, group.categoryId, draft); - setPending(false); - if (ok) setEditing(false); - } - - return ( - <> - - - - - {group.title} — Notes - - - {editing ? ( - setDraft(v ?? "")} height={360} /> - ) : draft ? ( -
- -
- ) : ( -

- No notes yet. Click Edit to add some. -

- )} - - - {editing ? ( - <> - - - - ) : ( - <> - - - - )} - -
-
- - - - ); -} diff --git a/hooks/use-autosave.ts b/hooks/use-autosave.ts new file mode 100644 index 0000000..8d95337 --- /dev/null +++ b/hooks/use-autosave.ts @@ -0,0 +1,64 @@ +import { useCallback, useEffect, useRef, useState } from "react"; + +// "A few seconds" per the group session's live-editing requirement -- +// short enough to feel live, long enough not to fire a save on every +// keystroke. Deliberately well under board-context's 30s cross-device +// poll interval, so a local edit always settles before the poll could +// otherwise consider overwriting it. +export const AUTOSAVE_DELAY_MS = 2500; + +/** + * Debounced autosave for a single field's value. Call `onSave` a beat + * after `value` stops changing, and again immediately via `flush()` (used + * by a manual "Save" button and by flush-on-close) -- both paths funnel + * through the same `runSave`, so there's no separate "save now" logic to + * keep in sync with the debounced one. + * + * `onSave` must be one of the board-context mutators (e.g. `saveNote`, + * `editTodo`), never a raw server action directly -- those mutators already + * mark the write as in-flight (see `track()` in board-context.tsx) so the + * app's cross-device poll doesn't clobber it mid-save. + */ +export function useAutosave( + value: T, + onSave: (value: T) => Promise, + delayMs = AUTOSAVE_DELAY_MS +): { flush: () => Promise; isDirty: boolean; isSaving: boolean } { + const [savedValue, setSavedValue] = useState(value); + const [isSaving, setIsSaving] = useState(false); + const onSaveRef = useRef(onSave); + const savingPromiseRef = useRef | null>(null); + + useEffect(() => { + onSaveRef.current = onSave; + }, [onSave]); + + const runSave = useCallback((v: T) => { + setIsSaving(true); + const promise = (async () => { + await onSaveRef.current(v); + setSavedValue(v); + setIsSaving(false); + })(); + savingPromiseRef.current = promise; + return promise; + }, []); + + useEffect(() => { + if (value === savedValue) return; + const timer = setTimeout(() => { + void runSave(value); + }, delayMs); + return () => clearTimeout(timer); + }, [value, savedValue, delayMs, runSave]); + + const flush = useCallback(async () => { + if (value !== savedValue) { + await runSave(value); + } else if (savingPromiseRef.current) { + await savingPromiseRef.current; + } + }, [value, savedValue, runSave]); + + return { flush, isDirty: value !== savedValue, isSaving }; +} From 661a1bfab695d5a07c52e008cd41394aa1eae39f Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Mon, 21 Sep 2026 16:18:09 -0600 Subject: [PATCH 03/10] Collapse completed to-dos in group session dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move completed drafts out of the active list to reduce clutter. - Add a collapsible “Completed” section with per-row expansion controls. --- components/board/group-session-dialog.tsx | 85 ++++++++++++++++++++++- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/components/board/group-session-dialog.tsx b/components/board/group-session-dialog.tsx index 8d3d2d1..d43f01c 100644 --- a/components/board/group-session-dialog.tsx +++ b/components/board/group-session-dialog.tsx @@ -1,7 +1,7 @@ "use client"; import { useCallback, useEffect, useRef, useState } from "react"; -import { Pencil, Plus, Sparkles, Trash2, X, XIcon } from "lucide-react"; +import { ChevronDown, ChevronRight, Pencil, Plus, Sparkles, Trash2, X, XIcon } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; @@ -108,6 +108,8 @@ export function GroupSessionDialog({ const [aiOpen, setAiOpen] = useState(false); const [todoAiOpen, setTodoAiOpen] = useState(false); const [savingAll, setSavingAll] = useState(false); + const [completedOpen, setCompletedOpen] = useState(false); + const [expandedCompletedIds, setExpandedCompletedIds] = useState>(new Set()); const rowFlushersRef = useRef(new Map Promise>()); const dirtyRowIdsRef = useRef(new Set()); @@ -150,6 +152,9 @@ export function GroupSessionDialog({ setTodoDrafts((prev) => reconcileTodoDrafts(prev, group.todos, dirtyRowIdsRef.current)); }, [group.todos, open]); + const activeTodoDrafts = todoDrafts.filter((d) => !d.completed); + const completedTodoDrafts = todoDrafts.filter((d) => d.completed); + function updateTodoDraft(id: string, patch: Partial) { setTodoDrafts((prev) => prev.map((d) => (d.id === id ? { ...d, ...patch } : d))); } @@ -176,6 +181,15 @@ export function GroupSessionDialog({ removeTodoDraftLocalOnly(tempIdToRemove); } + function toggleCompletedExpanded(id: string) { + setExpandedCompletedIds((prev) => { + const next = new Set(prev); + if (next.has(id)) next.delete(id); + else next.add(id); + return next; + }); + } + function addEmptyTodoDraft() { setTodoDrafts((prev) => [ ...prev, @@ -231,7 +245,7 @@ export function GroupSessionDialog({
- {todoDrafts.map((draft) => ( + {activeTodoDrafts.map((draft) => ( )}
+ + {completedTodoDrafts.length > 0 && ( +
+ + {completedOpen && ( +
+ {completedTodoDrafts.map((draft) => + expandedCompletedIds.has(draft.id) ? ( + updateTodoDraft(draft.id, patch)} + onRemoveLocalOnly={() => removeTodoDraftLocalOnly(draft.id)} + onCreated={() => handleAddTodoCreated(draft.id)} + onDirtyChange={(dirty) => setRowDirty(draft.id, dirty)} + registerFlush={registerRowFlush} + addTodo={addTodo} + editTodo={editTodo} + toggleTodoDone={toggleTodoDone} + removeTodo={removeTodo} + onCollapse={() => toggleCompletedExpanded(draft.id)} + /> + ) : ( + + ) + )} +
+ )} +
+ )}
@@ -304,6 +372,7 @@ function SessionTodoRow({ editTodo, toggleTodoDone, removeTodo, + onCollapse, }: { draft: TodoDraft; groupId: string; @@ -320,6 +389,7 @@ function SessionTodoRow({ editTodo: ReturnType["editTodo"]; toggleTodoDone: ReturnType["toggleTodoDone"]; removeTodo: ReturnType["removeTodo"]; + onCollapse?: () => void; }) { const [editingDetails, setEditingDetails] = useState(false); // Guards against creating the same new to-do twice if title/details both @@ -435,6 +505,17 @@ function SessionTodoRow({ style={draft.completed ? undefined : { color: todoTextColor }} className={cn("flex-1", draft.completed && "text-muted-foreground line-through")} /> + {onCollapse && ( + + )} {onCollapse && ( - - {editingDetails ? ( - ) : ( -

- No details yet. -

- )} + ) : null} ); } From f204f41b6892e894a13b0627a32d0aa724469e77 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Tue, 29 Sep 2026 07:47:11 -0600 Subject: [PATCH 06/10] Style group session dialog with the group's accent color - Replace generic card/gray styling with the group's own tint, derived via color-mix so the dialog reads as a "window" version of the card - Add 3px colored border, tinted header/footer panels, and softened border rules on todo rows to tie the whole dialog to one hue - Give the Save button a solid accent background with theme-appropriate text color (white on light, dark on neon) for clear affordance --- components/board/group-session-dialog.tsx | 57 +++++++++++++++++++---- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/components/board/group-session-dialog.tsx b/components/board/group-session-dialog.tsx index 1e53f5c..38bb7ae 100644 --- a/components/board/group-session-dialog.tsx +++ b/components/board/group-session-dialog.tsx @@ -102,6 +102,14 @@ export function GroupSessionDialog({ const color = useGroupColor(group.color); const accentColor = isDark ? color.dark : color.light; const todoTextColor = getBrighterColor(accentColor, isDark ? "dark" : "light"); + // The group's card treatment, scaled to a window: the same hand-picked + // tint fill the card uses (blended into the theme's card surface), plus a + // softer version of the group's stroke for the header/footer rules so + // they read as the same hue without competing with the 3px border. + const dialogBackground = `color-mix(in srgb, ${isDark ? color.softDark : color.soft} 85%, var(--card))`; + const panelBackground = `color-mix(in srgb, ${isDark ? color.softDark : color.soft} 100%, var(--card))`; + const ruleColor = `color-mix(in srgb, ${accentColor} 40%, transparent)`; + const subtleRuleColor = `color-mix(in srgb, ${accentColor} 25%, transparent)`; const [noteDraft, setNoteDraft] = useState(group.noteContent); const [todoDrafts, setTodoDrafts] = useState(() => toDrafts(group.todos)); @@ -215,10 +223,16 @@ export function GroupSessionDialog({ -
- {group.title} +
+ + {group.title} +
{savingAll || noteAutosave.isSaving ? "Saving…" : "Saved"} @@ -273,7 +287,10 @@ export function GroupSessionDialog({
{completedTodoDrafts.length > 0 && ( -
+
-
+
-
@@ -482,7 +514,13 @@ function SessionTodoRow({ ); return ( -
+
{draft.isNew ? ( @@ -545,7 +583,10 @@ function SessionTodoRow({ preview="edit" /> ) : draft.details ? ( -
+
) : null} From 05a633458d4b68f4020052f0809f0bd62391ed0f Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Tue, 29 Sep 2026 07:48:58 -0600 Subject: [PATCH 07/10] Save button now closes dialog and update label to "Save and Close" The previous Save button only persisted data without dismissing the dialog, requiring a second click. Now it flushes the note and all dirty rows, then closes the dialog in the same interaction. The label change makes the combined action explicit to the user. --- components/board/group-session-dialog.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/board/group-session-dialog.tsx b/components/board/group-session-dialog.tsx index 38bb7ae..43d6133 100644 --- a/components/board/group-session-dialog.tsx +++ b/components/board/group-session-dialog.tsx @@ -364,7 +364,12 @@ export function GroupSessionDialog({
From ba4e7f3803c909eb7fa85a1ccabfa3a728c27f7d Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Tue, 29 Sep 2026 08:10:02 -0600 Subject: [PATCH 08/10] Fix markdown preview styling and delete button in session dialog - Bump `.wmde-markdown` specificity with an `html` prefix so globals.css wins the cascade over the library's lazy-loaded chunk, and make the preview background transparent so it blends into its container card. - Add destructive color/hover to the to-do delete button for clarity. - Indent the details editor and preview (`ml-6`) so their left edge aligns with the title text rather than the checkbox column. --- app/globals.css | 12 +++++++++++- components/board/group-session-dialog.tsx | 7 +++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/globals.css b/app/globals.css index f2892ce..e29fa82 100644 --- a/app/globals.css +++ b/app/globals.css @@ -2268,10 +2268,20 @@ html.theme-notebook [data-group-card] .line-through::after { the app's type scale so notes blend into dialogs instead of looking pasted in. --------------------------------------------------------------------------- */ -.wmde-markdown { +/* Prefixed with `html` so this out-specificity the library's own + `.wmde-markdown` rules regardless of stylesheet order -- its CSS ships in + a lazy chunk that injects after globals.css, and at equal specificity the + later sheet would win the cascade. `html.theme-cyberpunk .wmde-markdown` + (0,2,1) still overrides this (0,1,1) where the theme wants its own look. */ +html .wmde-markdown { font-family: var(--font-sans); font-size: 0.875rem; letter-spacing: -0.006em; + /* The library's GitHub-style palette paints a hard canvas background onto + the preview root; make it transparent so styled markdown sits flush with + whatever card/box it is rendered inside. */ + background-color: transparent; + color: var(--foreground); } .w-md-editor { --md-editor-font-family: var(--font-sans); diff --git a/components/board/group-session-dialog.tsx b/components/board/group-session-dialog.tsx index 43d6133..7de0abf 100644 --- a/components/board/group-session-dialog.tsx +++ b/components/board/group-session-dialog.tsx @@ -572,7 +572,7 @@ function SessionTodoRow({
{editingDetails ? ( + // ml-6 indents the details block (checkbox's 16px + the 8px gap) so + // its left edge lines up with the title above instead of the checkbox. onChangeLocal({ details: v ?? "" })} height={160} preview="edit" + className="ml-6" /> ) : draft.details ? (
From 0a8f3745061d8b06fe5e7af0e87e6170bb0d10f2 Mon Sep 17 00:00:00 2001 From: Brian Fertig Date: Tue, 29 Sep 2026 08:21:53 -0600 Subject: [PATCH 09/10] Add notes preview/edit toggle to group session dialog - Notes now default to a rendered markdown preview instead of the raw editor, reducing visual noise when scanning group context. - A pencil/eye icon button next to the label flips between the two modes. - Preview panel is styled with the group tint and a distinct border so it reads as group-level notes rather than another to-do row. - Todo row edit toggle also swaps to an Eye icon while editing for consistent affordance. --- components/board/group-session-dialog.tsx | 55 +++++++++++++++++++---- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/components/board/group-session-dialog.tsx b/components/board/group-session-dialog.tsx index 7de0abf..44bdd46 100644 --- a/components/board/group-session-dialog.tsx +++ b/components/board/group-session-dialog.tsx @@ -1,7 +1,7 @@ "use client"; import { useCallback, useEffect, useRef, useState } from "react"; -import { ChevronDown, ChevronRight, Pencil, Plus, Sparkles, Trash2, X, XIcon } from "lucide-react"; +import { ChevronDown, ChevronRight, Eye, Pencil, Plus, Sparkles, Trash2, X, XIcon } from "lucide-react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; @@ -113,6 +113,10 @@ export function GroupSessionDialog({ const [noteDraft, setNoteDraft] = useState(group.noteContent); const [todoDrafts, setTodoDrafts] = useState(() => toDrafts(group.todos)); + // Notes default to a rendered markdown preview; the pencil by the label + // flips into the full editor (and back). Kept out of the todo row state + // so it never collides with per-row edit toggles. + const [notesEditing, setNotesEditing] = useState(false); const [aiOpen, setAiOpen] = useState(false); const [todoAiOpen, setTodoAiOpen] = useState(false); const [savingAll, setSavingAll] = useState(false); @@ -133,6 +137,7 @@ export function GroupSessionDialog({ if (next) { setNoteDraft(group.noteContent); setTodoDrafts(toDrafts(group.todos)); + setNotesEditing(false); } else { // Fire-and-forget: close immediately, flush any pending autosaves in // the background. board-context's mutators already toast on failure, @@ -247,13 +252,45 @@ export function GroupSessionDialog({
- - setNoteDraft(v ?? "")} - height={280} - preview="edit" - /> +
+ + +
+ {notesEditing ? ( + setNoteDraft(v ?? "")} + height={280} + preview="edit" + /> + ) : ( + // Rendered as a distinct group-note panel -- full group tint, + // stronger rule, no indent -- so it reads as notes for the + // whole group rather than another to-do row. +
+ {noteDraft.trim() ? ( + + ) : ( +

+ No notes yet — use the pencil above to add some. +

+ )} +
+ )}
@@ -556,7 +593,7 @@ function SessionTodoRow({ onClick={() => setEditingDetails((v) => !v)} aria-label={`${editingDetails ? "Preview" : "Edit"} details for "${draft.title || "new to-do"}"`} > - + {editingDetails ? : } {onCollapse && (