Skip to content

Dev#13

Merged
Retsomm merged 8 commits into
mainfrom
dev
Jul 13, 2026
Merged

Dev#13
Retsomm merged 8 commits into
mainfrom
dev

Conversation

@Retsomm

@Retsomm Retsomm commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added mobile Notes with wrong-question review, saved-question practice, quizzes, and detailed question explanations.
    • Added learning statistics, activity heatmaps, accuracy trends, and chapter progress.
    • Added profile dashboard with XP stages, growth history, streaks, account settings, avatar editing, and account deletion.
    • Added mascot progression indicators and improved vector icons.
  • Bug Fixes
    • Correctly answered questions are now removed from the wrong-question list immediately.
  • Style
    • Updated the app with a consistent dark theme.
  • Documentation
    • Updated migration documentation to reflect completed mobile features and validation status.

Retsomm and others added 7 commits July 13, 2026 12:01
RN 重構過程中淺色主題太刺眼,先把 useColorScheme 鎖死回傳 dark(不看裝置系統設定),
Colors.dark 改用柔和的 #121212/#e6e6e6 取代刺眼的純黑/純白。
Icon.tsx 原本用 react-native 原生 Text 顯示非 emoji 符號(✕←→›↺),預設黑字在深色背景
幾乎全隱形,改成從 Themed 匯入 Text 讓它跟著主題文字色走。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
對照 apps/web 的 Notes/QuestionBook/Stats 畫面與 QuestionReview 元件,複用
packages/core 既有的 getWrongQuestions/getWrongEntries/getSavedQuestions 等函式。
Notes tab 比照 Home tab 用 view 狀態機切換 notes/wrongbook/savedbook/review/
savedpractice,review 與 savedpractice 直接複用既有的 Quiz 元件。Stats tab 是
單一唯讀畫面,熱力圖改用 RN ScrollView horizontal。刪除不再使用的 ComingSoon.tsx。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
packages/core 的 applyAnswer 是 web/mobile 共用邏輯,直接改成正確就刪除錯題紀錄。
apps/web 登入時的伺服器端寫入(api/progress/answer/route.ts)是另外手刻同一套規則的
Prisma 交易,沒有共用 applyAnswer,這次一起同步改掉。GRADUATE_BOX 常數與 UI 上的
「熟練度 X/3」顯示已跟著移除(移出時機改成單次答對後,這個數字永遠停在 1,留著只會
誤導);WrongEntryMeta.box 型別欄位與 Prisma 資料庫欄位刻意保留不動,避免多一次 schema
migration,一律寫 1、不再遞增。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
把 apps/web/src/lib/stages.ts 的吉祥物成長階段資料搬進 packages/core(web/mobile 共用,
Phase 1 漏搬的部分)。新增 apps/mobile 的 Mascot/GrowthHistory/AccountHeader 三個元件,
AccountHeader 對照 web 版的頭像裁切換算公式整段照搬,互動層換成
react-native-gesture-handler 的 PanGestureHandler(拖曳)+ @react-native-community/slider
(縮放)+ expo-image-picker(選照片,URI 轉 Blob 交給 Clerk setProfileImage)。
app/_layout.tsx 加上 GestureHandlerRootView,app.json 補上 expo-image-picker 的
plugin 設定。profile.tsx 補齊帳號設定(登出/刪除帳號)與成長史展開/收合。

這是全計畫風險最高、完全沒有真機驗證過的一個 phase,需要重新原生建置才能測。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
回應真機測試後的三項設計回饋:AccountHeader 移除 USER.XXXXXXXX 顯示;profile.tsx
把成長史(吉祥物/XP/展開清單)拆成跟「個人資料」各自獨立的卡片,不再擠在同一張卡片裡;
Icon.tsx 從 emoji 換成 lucide-react-native(跟 apps/web Icons.tsx 同源的線型圖示),
用逐一深層匯入(lucide-react-native/icons/xxx)避免 barrel import 讓 Metro 把全部
3000+ 個圖示一起打包進 bundle。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
修復 AccountHeader.tsx 選照片上傳丟出的 RN Blob 例外:fetch(uri).blob() 沒辦法從
ArrayBuffer 建立 RN 認得的 Blob,改用 XMLHttpRequest 讀取本機圖片 URI。同時處理三項
真機測試發現的樣式問題:縮放拉桿在深色主題下配色補齊(原本吃套件預設淺色)、頭像編輯框的
dashed border 改成純色實線(RN 對圓形疊虛線框是已知平台限制)、改名輸入框補上文字顏色
(TextInput 沒有走 Themed 自動套色,預設黑字在深色底看不見)。

另外三項介面回饋:拿掉縮放拉桿旁的放大鏡圖示;成長史從卡片內展開改成 Modal 彈窗顯示;
移除輸入框顏色問題後的最終確認。

使用者已在 iOS/Android 模擬器完整測試通過(含用 adb push 測試圖片驗證 Android 上傳路徑)。

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
easy-learn Ready Ready Preview, Comment Jul 13, 2026 5:55am

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Retsomm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e18c17f-67d9-4751-8900-a8045146c0ea

📥 Commits

Reviewing files that changed from the base of the PR and between 99972a5 and 0ff79a8.

📒 Files selected for processing (10)
  • apps/mobile/app/(tabs)/profile.tsx
  • apps/mobile/components/AccountHeader.tsx
  • apps/mobile/components/Mascot.tsx
  • apps/mobile/screens/Quiz.tsx
  • apps/mobile/screens/Stats.tsx
  • apps/web/src/components/Mascot.tsx
  • apps/web/src/index.css
  • apps/web/src/screens/Quiz.tsx
  • apps/web/src/screens/Stats.tsx
  • packages/core/src/stages.ts
📝 Walkthrough

Walkthrough

The PR replaces mobile placeholders with notes, review, statistics, and profile experiences; adds shared XP stages; changes wrong-question removal to immediate deletion after correct answers; updates web integrations; and introduces dark-mode, gesture, avatar, and icon support.

Changes

Mobile learning and progress experience

Layer / File(s) Summary
Shared progression contracts
packages/core/src/*
Adds shared XP stage helpers and changes correct-answer handling to remove wrong questions immediately.
Notes, review, and statistics flow
apps/mobile/app/(tabs)/notes.tsx, apps/mobile/screens/*, apps/mobile/app/(tabs)/stats.tsx
Replaces placeholders with notes navigation, wrong/saved question books, review cards, quizzes, and hydrated statistics views.
Profile and account experience
apps/mobile/app/(tabs)/profile.tsx, apps/mobile/components/{AccountHeader,GrowthHistory,Mascot}.tsx
Adds profile dashboards, XP progression displays, account deletion, avatar editing, name editing, and growth history.
Mobile platform and visual system
apps/mobile/app.json, apps/mobile/app/_layout.tsx, apps/mobile/components/Icon.tsx, apps/mobile/components/useColorScheme*, apps/mobile/constants/Colors.ts, apps/mobile/package.json
Configures image-picker permissions and gesture handling, adds Lucide icons, forces dark mode, and updates dark colors.
Web progress and shared-stage alignment
apps/web/src/app/api/progress/answer/route.ts, apps/web/src/components/*, apps/web/src/hooks/useProgress.ts, apps/web/src/screens/*
Aligns web wrong-question handling and stage imports with the shared core behavior.
Migration progress documentation
docs/rn-migration.md
Records completed React Native migration phases and validation details.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant NotesScreen
  participant QuestionBook
  participant Quiz
  User->>NotesScreen: Open Notes tab
  NotesScreen->>QuestionBook: Open wrong or saved questions
  QuestionBook->>Quiz: Start sampled review
  Quiz-->>NotesScreen: Finish or exit review
Loading

Possibly related PRs

  • Retsomm/EasyLearn#3: Adds the earlier wrong-question review flow that this mobile notes state machine integrates.
  • Retsomm/EasyLearn#8: Introduces the prior Leitner graduation behavior replaced by immediate wrong-entry removal here.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is too generic and doesn't describe the broad mobile/core progress and UI changes in the PR. Rename it to a concise, specific summary such as "Add mobile notes/stats/profile screens and shared progress stages".
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/core/src/progressCalc.ts (1)

43-54: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Update the review-mode copy in apps/mobile/screens/Quiz.tsx.
The banner still says 答對升熟練度,答錯重來,練到最高熟練度才畢業, but applyAnswer now removes a wrong question on the first correct answer. The review text should match the new immediate-removal rule.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/progressCalc.ts` around lines 43 - 54, Update the
review-mode banner text in Quiz so it reflects that answering correctly once
removes the question from the wrong-question list, rather than requiring maximum
proficiency; leave the answer-processing logic in applyAnswer unchanged.
apps/web/src/screens/Quiz.tsx (1)

100-104: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Update stale review-mode text to match the new immediate-removal behavior.

The review banner (line 143) says "答對升熟練度,答錯重來,練到最高熟練度才畢業" (correct answers increase mastery, practice until highest mastery to graduate), but the new behavior removes a wrong entry on a single correct answer — there is no mastery progression or graduation threshold. The result hint (line 102) similarly implies ongoing mastery progression with "繼續練會更熟練". These texts are now misleading to users.

📝 Suggested text updates
         <div className="review-banner">
           <Icon name="rotate-ccw" size={15} />
-          錯題重練模式:答對升熟練度,答錯重來,練到最高熟練度才畢業
+          錯題重練模式:答對一次就從錯題本畢業,答錯重來
         </div>
         <p className="result-hint">
           {isReview && questions.some((q) => progress.wrongIds[q.id])
-            ? '還沒畢業的錯題會留著,繼續練會更熟練!'
+            ? '還沒答對的錯題會留著,再練一次就能畢業!'
             : '你的星球又長大了一點,明天也要回來澆灌它喔!'}
         </p>

Also applies to: 140-145

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/screens/Quiz.tsx` around lines 100 - 104, Update the review-mode
copy in the result hint and review banner near the result rendering to describe
immediate removal of a wrong entry after one correct answer, rather than mastery
progression, continued practice, or graduation thresholds. Preserve the existing
non-review text and conditional behavior.
🧹 Nitpick comments (1)
apps/mobile/app/(tabs)/profile.tsx (1)

108-117: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Duplicate XP-progress formula also lives in Mascot.tsx.

xpProgress here recomputes the exact same (xp - stage.min) / (nextStage.min - stage.min) percentage already implemented in apps/mobile/components/Mascot.tsx (progressToNext). Since this PR just moved STAGES/getStage/getNextStage into packages/core specifically to share this logic, consider adding a getStageProgress(xp) helper there and using it from both places, so any future change to the progress calc doesn't need to be kept in sync manually.

♻️ Proposed consolidation
// packages/core/src/stages.ts
+export const getStageProgress = (xp: number) => {
+  const stage = getStage(xp)
+  const next = getNextStage(xp)
+  return next ? Math.min(100, Math.round(((xp - stage.min) / (next.min - stage.min)) * 100)) : 100
+}
// apps/mobile/app/(tabs)/profile.tsx
-  const xpProgress = nextStage
-    ? Math.min(100, Math.round(((progress.xp - stage.min) / (nextStage.min - stage.min)) * 100))
-    : 100;
+  const xpProgress = getStageProgress(progress.xp);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/mobile/app/`(tabs)/profile.tsx around lines 108 - 117, Consolidate the
duplicated XP percentage calculation by adding a shared getStageProgress(xp)
helper alongside getStage and getNextStage in packages/core. Update the profile
component’s xpProgress calculation and Mascot.tsx’s progressToNext logic to use
this helper, preserving the existing clamping and completed-stage behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/mobile/components/AccountHeader.tsx`:
- Around line 175-193: Update saveName and the confirm button using saveName so
an all-whitespace name cannot be submitted silently: disable the confirm action
when nameValue.trim() is empty, while preserving the existing validation guard
and saving behavior for non-empty names.

---

Outside diff comments:
In `@apps/web/src/screens/Quiz.tsx`:
- Around line 100-104: Update the review-mode copy in the result hint and review
banner near the result rendering to describe immediate removal of a wrong entry
after one correct answer, rather than mastery progression, continued practice,
or graduation thresholds. Preserve the existing non-review text and conditional
behavior.

In `@packages/core/src/progressCalc.ts`:
- Around line 43-54: Update the review-mode banner text in Quiz so it reflects
that answering correctly once removes the question from the wrong-question list,
rather than requiring maximum proficiency; leave the answer-processing logic in
applyAnswer unchanged.

---

Nitpick comments:
In `@apps/mobile/app/`(tabs)/profile.tsx:
- Around line 108-117: Consolidate the duplicated XP percentage calculation by
adding a shared getStageProgress(xp) helper alongside getStage and getNextStage
in packages/core. Update the profile component’s xpProgress calculation and
Mascot.tsx’s progressToNext logic to use this helper, preserving the existing
clamping and completed-stage behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c824a6de-f312-4c20-a5aa-c46d48f40953

📥 Commits

Reviewing files that changed from the base of the PR and between 97fdc44 and 99972a5.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (29)
  • apps/mobile/app.json
  • apps/mobile/app/(tabs)/notes.tsx
  • apps/mobile/app/(tabs)/profile.tsx
  • apps/mobile/app/(tabs)/stats.tsx
  • apps/mobile/app/_layout.tsx
  • apps/mobile/components/AccountHeader.tsx
  • apps/mobile/components/ComingSoon.tsx
  • apps/mobile/components/GrowthHistory.tsx
  • apps/mobile/components/Icon.tsx
  • apps/mobile/components/Mascot.tsx
  • apps/mobile/components/useColorScheme.ts
  • apps/mobile/components/useColorScheme.web.ts
  • apps/mobile/constants/Colors.ts
  • apps/mobile/package.json
  • apps/mobile/screens/Notes.tsx
  • apps/mobile/screens/QuestionBook.tsx
  • apps/mobile/screens/QuestionReview.tsx
  • apps/mobile/screens/Stats.tsx
  • apps/web/src/app/api/progress/answer/route.ts
  • apps/web/src/components/GrowthHistory.tsx
  • apps/web/src/components/Mascot.tsx
  • apps/web/src/components/QuestionReview.tsx
  • apps/web/src/hooks/useProgress.ts
  • apps/web/src/screens/Profile.tsx
  • apps/web/src/screens/Quiz.tsx
  • docs/rn-migration.md
  • packages/core/src/index.ts
  • packages/core/src/progressCalc.ts
  • packages/core/src/stages.ts
💤 Files with no reviewable changes (1)
  • apps/mobile/components/ComingSoon.tsx

Comment thread apps/mobile/components/AccountHeader.tsx
- Quiz 錯題重練模式的 banner/結算提示文字改為描述「答對一次即從錯題本移除」,
  修正舊版 Leitner 盒制熟練度用語與實際邏輯(applyAnswer)不符的問題
- AccountHeader 姓名確認按鈕在輸入全空白時停用,避免靜默失敗
- 新增 packages/core 的 getStageProgress(),收斂 profile.tsx/web 與 mobile
  Mascot.tsx 三處重複的 XP 進度百分比算式
- 修正 mobile 學習數據頁熱力圖月份標籤欄寬(16px)與格子欄寬(11px)不一致
  導致視覺對不齊、看起來像沒有算到最新日期的問題,補上分科成效細分頁的提示文字
@Retsomm
Retsomm merged commit 3604caa into main Jul 13, 2026
3 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