feat: comment tool with canvas annotations and collab sync#26
Merged
trmquang93 merged 4 commits intomainfrom Apr 6, 2026
Merged
feat: comment tool with canvas annotations and collab sync#26trmquang93 merged 4 commits intomainfrom
trmquang93 merged 4 commits intomainfrom
Conversation
Add a custom SVG speech bubble cursor (accent blue) that appears whenever the comment tool is selected. The cursor persists over all child elements including screen nodes, hotspots, and resize handles. Space+drag panning still overrides to grab/grabbing as expected.
Introduces a full comment system: pin-based annotations on screens, hotspots, and connections; CommentComposer, CommentPin, and CommentsPanel UI components; useCommentManager CRUD hook with role-based permissions (host/editor/reviewer/viewer); collab broadcast sync for real-time comment updates; MCP server comment tools; and file format support (importFlow/exportFlow). Keyboard shortcut C activates the comment tool. User guide updated.
- Extract timeAgo/targetLabel from CommentsPanel into commentUtils.js and add 16 tests covering all branches and boundary conditions - Add 25 tests for useCommentManager covering CRUD, resolve/unresolve, and all cascade delete helpers with cross-type safety checks - Add 28 tests for FlowState comment operations (mcp-server/state.js), including listComments filters and getSummary counts - Add 15 tests for handleCommentTool dispatch layer using mock state - Extend buildPayload tests with comments passthrough + buildCollabPayload - Extend importFlow tests with backward compat for missing comments field
- Cascade-delete comments in MCP state.js when screen/hotspot/connection is deleted, matching the React-side commentCallbacksRef behaviour - Fix CommentPin popover position stale on first open: move getBoundingClientRect call into useLayoutEffect instead of render - Guard update_comment / resolve_comment return values in comment-tools.js against undefined (contracts diverged between FlowState and React hook) - Allow reviewers to reopen their own resolved comments in CommentsPanel (was gated on canModerate only, inconsistent with resolve permission) - Clamp CommentComposer vertically to prevent overflow at bottom of viewport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ckey) for placing anchored comment pins on screens, hotspots, and connections directly on the canvaslist_comments,create_comment,update_comment,resolve_comment,delete_comment, and cascade-aware delete on entity removal)Key files
src/hooks/useCommentManager.jssrc/components/CommentPin.jsxsrc/components/CommentComposer.jsxsrc/components/CommentsPanel.jsxmcp-server/src/tools/comment-tools.jssrc/utils/commentUtils.jsTest plan
C) on a screen — pin appears at click positioncreate_comment,list_comments,resolve_comment,delete_commentall work against a live.drawdfilenpm testpasses