Skip to content

feat: add memo copy to clipboard functionality (#321)#328

Merged
Kewton merged 3 commits intodevelopfrom
feature/321-worktree
Feb 20, 2026
Merged

feat: add memo copy to clipboard functionality (#321)#328
Kewton merged 3 commits intodevelopfrom
feature/321-worktree

Conversation

@Kewton
Copy link
Owner

@Kewton Kewton commented Feb 20, 2026

Summary

  • MemoCardコンポーネントにコピーボタンを追加し、メモのcontentをクリップボードにコピーできるようにした
  • FileViewer方式(Copy/Checkアイコン切替、2秒タイムアウト)を踏襲しつつ、useRefタイマークリーンアップを追加(S1-002対応)
  • 設計方針書・Issueレビュー・設計レビュー・作業計画・進捗報告を含むdev-reportsを追加

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

  • Issueレビュー(8ステージ): テンプレートのみだったIssue本文を完全な要件書に更新
  • 設計方針書: FileViewerパターンベースの改善版設計
  • 設計レビュー(4ステージ): 設計原則・整合性・影響分析・セキュリティ
  • 作業計画・TDD実装・受入テスト・リファクタリング・進捗報告

Quality

  • TypeScript: 0 errors
  • ESLint: 0 warnings/errors
  • Unit Tests: 3655/3655 passed (181 files)
  • Acceptance Criteria: 9/9 passed

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

Kewton and others added 3 commits February 20, 2026 21:03
- 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>
@Kewton Kewton merged commit dde56fa into develop Feb 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant