-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add accessible comment thread #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add accessible comment thread #13
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements a persistent CommentThread component with full CRUD operations, @mention support, thread resolution controls, and localStorage persistence.
- Adds complete comment lifecycle management (create, read, update, delete)
- Implements @mention highlighting and thread resolution/filtering functionality
- Adds comprehensive test coverage for comment operations and thread state management
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| package.json | Adds testing dependencies (@testing-library/react, @testing-library/user-event, jsdom) |
| apps/web/components/canvas/tests/CommentThread.test.tsx | New test file covering CRUD operations and thread resolution filtering |
| apps/web/components/canvas/CommentThread.tsx | Complete rewrite adding persistence, editing, deletion, @mentions, and resolution controls |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| t.split(/(@\w+)/g).map((part) => | ||
| part.startsWith('@') ? ( | ||
| <span | ||
| key={`mention-${part}-${nanoid()}`} | ||
| className="text-blue-600" | ||
| data-testid="mention" | ||
| > | ||
| {part} | ||
| </span> | ||
| ) : ( | ||
| <span key={`text-${part}-${nanoid()}`}>{part}</span> |
Copilot
AI
Sep 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using nanoid() in render functions creates new IDs on every render, causing unnecessary re-renders. Use the part content or index as the key instead.
| t.split(/(@\w+)/g).map((part) => | |
| part.startsWith('@') ? ( | |
| <span | |
| key={`mention-${part}-${nanoid()}`} | |
| className="text-blue-600" | |
| data-testid="mention" | |
| > | |
| {part} | |
| </span> | |
| ) : ( | |
| <span key={`text-${part}-${nanoid()}`}>{part}</span> | |
| t.split(/(@\w+)/g).map((part, idx) => | |
| part.startsWith('@') ? ( | |
| <span | |
| key={`mention-${part}-${idx}`} | |
| className="text-blue-600" | |
| data-testid="mention" | |
| > | |
| {part} | |
| </span> | |
| ) : ( | |
| <span key={`text-${part}-${idx}`}>{part}</span> |
| t.split(/(@\w+)/g).map((part) => | ||
| part.startsWith('@') ? ( | ||
| <span | ||
| key={`mention-${part}-${nanoid()}`} | ||
| className="text-blue-600" | ||
| data-testid="mention" | ||
| > | ||
| {part} | ||
| </span> | ||
| ) : ( | ||
| <span key={`text-${part}-${nanoid()}`}>{part}</span> |
Copilot
AI
Sep 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using nanoid() in render functions creates new IDs on every render, causing unnecessary re-renders. Use the part content or index as the key instead.
| t.split(/(@\w+)/g).map((part) => | |
| part.startsWith('@') ? ( | |
| <span | |
| key={`mention-${part}-${nanoid()}`} | |
| className="text-blue-600" | |
| data-testid="mention" | |
| > | |
| {part} | |
| </span> | |
| ) : ( | |
| <span key={`text-${part}-${nanoid()}`}>{part}</span> | |
| t.split(/(@\w+)/g).map((part, idx) => | |
| part.startsWith('@') ? ( | |
| <span | |
| key={`mention-${part}-${idx}`} | |
| className="text-blue-600" | |
| data-testid="mention" | |
| > | |
| {part} | |
| </span> | |
| ) : ( | |
| <span key={`text-${part}-${idx}`}>{part}</span> |
| {comments.map((c) => ( | ||
| <li key={c.id} className="text-sm"> | ||
| <span className="font-medium">{c.author}</span>: {c.text} | ||
| <li key={c.id} className="text-sm flex gap-2" > |
Copilot
AI
Sep 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra space before the closing bracket in the className prop.
| <li key={c.id} className="text-sm flex gap-2" > | |
| <li key={c.id} className="text-sm flex gap-2"> |
Summary
Testing
pnpm exec biome lint apps/web/components/canvas/CommentThread.tsxpnpm exec vitest run apps/web/components/canvas/__tests__/CommentThread.test.tsx --environment jsdompnpm lint(fails: repository lint errors)https://chatgpt.com/codex/tasks/task_e_68ba4fc63f3483329f4d84fa562186d2