Commit Graph

4 Commits

Author SHA1 Message Date
鄭沛軒 184c84d944 refactor: 完成 Hook 和類型定義重構 + import 路徑更新
## Word 模組重構完成
- 📁 移動 useWordAnalysis Hook 到 hooks/word/
- 📄 移動 WordAnalysis 類型到 lib/types/word/
- 🧹 清理空目錄和錯放的文件
-  更新所有 import 路徑

## Import 路徑統一更新
-  WordPopup: 更新 Hook 和類型引用
-  ClickableTextV2: 更新 Hook 和類型引用
-  review/page.tsx: 更新重構後的組件路徑
-  review-design/page.tsx: 更新重構後的組件路徑

## 架構標準化完成
- 🎯 components/ 只放純組件
- 🪝 hooks/ 放自定義 Hook
- 📋 lib/types/ 放類型定義
-  符合 React 項目最佳實踐

功能驗證: 所有頁面正常編譯運行

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-03 16:30:35 +08:00
鄭沛軒 d742cf52f9 feat: BluePlayButton 內建 TTS 邏輯重構 + TypeScript 錯誤修復
重構亮點:
• BluePlayButton 內建完整 TTS 播放邏輯
• 移除 8 個組件中 97 行重複代碼
• 組件使用極度簡化:複雜配置 → 一行代碼

技術優化:
• 修復 TypeScript "Type 'never'" 錯誤
• 重新設計邏輯流程,清晰的條件分支
• 支援標準 TTS + 自定義播放兩種模式

使用簡化:
• 從: <BluePlayButton isPlaying={state} onToggle={handler} />
• 到: <BluePlayButton text="hello" />

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 16:51:45 +08:00
鄭沛軒 df1c2b92ef feat: 全應用播放按鈕統一為藍底漸層設計 + 架構簡化
組件統一:
• 創建 BluePlayButton 統一組件 - 支援 sm/md/lg 三種尺寸
• 替換 10 個組件中的播放按鈕為統一的藍底漸層設計
• 移除 AudioPlayer 中間層抽象,直接使用 BluePlayButton

清理優化:
• 刪除未使用的 TTSButton 和 AudioPlayer 組件
• 簡化組件架構,每個組件內建 TTS 播放邏輯
• 統一 speechSynthesis API 使用方式

視覺統一:
• 藍底漸層 + 綠色播放中狀態 + 波紋動畫
• 響應式尺寸適配不同使用場景
• 完整的播放/暫停/禁用狀態設計

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 15:11:02 +08:00
鄭沛軒 6600dbf33a feat: 完成ClickableTextV2組件重構 + 多頁面組件優化
重構成果:
1. ClickableTextV2: 413→114行 (減少72%)
2. Flashcards頁面: 305→277行 (減少9%)
3. 新建10個通用組件,大幅提升重用性

ClickableTextV2重構亮點:
- 建立word組件模組 (types.ts, useWordAnalysis Hook, WordPopup)
- 重用現有Modal + ContentBlock組件
- 業務邏輯與UI完全分離
- 編譯通過,功能完整

通用組件庫建立:
- LoadingState, ErrorState (全站通用狀態)
- StatisticsCard, ContentBlock (多色彩變體)
- ValidatedTextInput, TabNavigation (表單與導航)
- FlashcardActions, EditingControls等詞卡專用組件

Bundle優化:
- flashcards詳情頁: 8.62KB→6.36KB
- flashcards列表頁: 12.1KB→10.4KB

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 00:53:23 +08:00