feat: add memo copy to clipboard functionality (#321)#328
Merged
Conversation
- Add copy button with Copy/Check icon toggle to MemoCard header - Implement clipboard copy using copyToClipboard utility - Add useRef + useEffect cleanup for timer to prevent memory leaks - Guard against empty/whitespace-only content - Handle rapid double-click with timer reset - Add 8 test cases for copy functionality (render, click, icon toggle, timer revert, empty content, whitespace, double-click, unmount safety) Resolves #321 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract COPY_FEEDBACK_DURATION_MS constant to eliminate magic number, simplify empty-content guard, and improve test structure. Improvements: - Extract copy feedback duration as named constant (KISS, no magic numbers) - Simplify empty content guard: `!content || content.trim().length === 0` -> `!content.trim()` - Improve JSDoc comments with design policy cross-references - Add test helper functions (getCopyButton, hasCheckIcon) for DRY - Group timer-based tests in nested describe with shared setup/teardown - Improve unmount safety test with console.error spy assertion Quality Metrics: - Tests: 25/25 passed (MemoCard), 20/20 passed (MemoPane) - ESLint errors: 0 - TypeScript errors: 0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add design policy, issue review reports, multi-stage design review results, work plan, and TDD progress reports for Issue #321 (memo copy feature). Update CLAUDE.md with MemoCard/MemoPane/MemoAddButton module descriptions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Changes
Implementation
src/components/worktree/MemoCard.tsx: コピーボタン追加(Copy/Checkアイコン切替、useRef+useEffectタイマークリーンアップ、サイレントエラー、COPY_FEEDBACK_DURATION_MS定数)tests/unit/components/worktree/MemoCard.test.tsx: コピー機能テスト8件追加(レンダリング、クリック、アイコン切替、空コンテンツ、高速ダブルクリック、アンマウント安全性)CLAUDE.md: MemoCard/MemoPane/MemoAddButtonのモジュール説明追加Design Reports
Quality
Test plan
npx vitest run tests/unit/components/worktree/MemoCard.test.tsx(25 tests passed)npx vitest run tests/unit/components/worktree/MemoPane.test.tsx(20 tests passed, no regression)npm run test:unit(3655 tests passed)npx tsc --noEmit(0 errors)npm run lint(0 errors)Closes #321
🤖 Generated with Claude Code