From 015a0bb3b8e0f605e3612dd80981da7420a6f112 Mon Sep 17 00:00:00 2001 From: Wentao Date: Sun, 15 Feb 2026 14:48:26 -0800 Subject: [PATCH 1/3] feat(comments): add threaded conversations with soft-delete --- DevLog/DevLog-006-01-Comment-Conversations.md | 49 ++ src/components/comments/CommentPanel.svelte | 471 +++++++++++++++--- src/components/viewer/ViewerCanvas.svelte | 7 +- src/lib/collaboration/CommentSync.ts | 17 + src/lib/collaboration/types.ts | 10 +- src/lib/viewer/ViewerCommentController.ts | 5 + src/stores/commentStore.ts | 117 ++++- 7 files changed, 574 insertions(+), 102 deletions(-) create mode 100644 DevLog/DevLog-006-01-Comment-Conversations.md diff --git a/DevLog/DevLog-006-01-Comment-Conversations.md b/DevLog/DevLog-006-01-Comment-Conversations.md new file mode 100644 index 0000000..e705b0a --- /dev/null +++ b/DevLog/DevLog-006-01-Comment-Conversations.md @@ -0,0 +1,49 @@ +# DevLog-006-01: Comment Conversations (Threaded Replies) + +**Date**: 2026-02-15 +**Status**: In Progress +**Scope**: Implement conversation-style comments with arbitrary-depth replies, soft delete, host thread delete, and fold/unfold controls. + +## Requirements (Confirmed) + +1. Arbitrary-depth replies (forum-style). +2. No new canvas bubbles for replies (root bubble only). +3. Soft delete for comments; host can delete whole thread. +4. Single permission toggle controls both comments and replies. +5. Oldest-first ordering in threads. +6. Viewer comments enabled by default. + +## Plan + +- [x] Extend `Comment` model for threads (`parentId`, `rootId`, `deleted`, `deletedAt`). +- [x] Add normalization for backward compatibility with existing comments. +- [x] Add update/soft-delete primitives in `commentStore` and `CommentSync`. +- [x] Update `ViewerCommentController` to create thread-capable root comments. +- [x] Refactor `CommentPanel` to threaded tree view with: + - reply composer + - per-comment fold/unfold + - soft delete + - host delete thread +- [x] Keep reply comments out of canvas bubbles (root bubbles only). +- [x] Validate with `pnpm check` and `pnpm test --run`. + +## Progress Log + +### 2026-02-15 14:44 + +- Created DevLog and locked final behavior to the user-confirmed decisions above. +- Next: implement model + sync/store compatibility layer. + +### 2026-02-15 15:20 + +- Implemented threaded conversation panel: + - Oldest-first thread traversal. + - Arbitrary-depth replies with inline composer. + - Per-comment fold/unfold of descendants. + - Soft-delete comment action (author or host). + - Host-only "Delete Thread" action (soft-deletes all descendants in same root thread). +- Updated host permissions copy to clarify one toggle controls comment + reply rights. +- Updated canvas bubble rendering to root comments only (`parentId === null`) so replies do not spawn new bubbles. +- Validation complete: + - `pnpm check`: 0 errors, 0 warnings + - `pnpm test --run`: 109/109 passing diff --git a/src/components/comments/CommentPanel.svelte b/src/components/comments/CommentPanel.svelte index c7fd271..b592ac9 100644 --- a/src/components/comments/CommentPanel.svelte +++ b/src/components/comments/CommentPanel.svelte @@ -1,6 +1,8 @@