Skip to content

設定画面にウォークスルーを追加 - #5060

Merged
TinyKitten merged 1 commit into
devfrom
claude/add-settings-walkthrough-6DPdn
Jan 14, 2026
Merged

TinyKitten merged 1 commit into
devfrom
claude/add-settings-walkthrough-6DPdn

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jan 14, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

新機能

  • 設定画面にマルチステップのウォークスルーを追加(順送り、スキップ、完了の操作を含む)
  • ウォークスルー中に特定項目をスポットライト表示し案内する導線を追加

ローカライズ対応

  • 英語・日本語でウォークスルー用の文言を追加・拡張しました

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions Bot added the react label Jan 14, 2026
@coderabbitai

coderabbitai Bot commented Jan 14, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

このプルリクエストは、設定画面に対する4段階のウォークスルーを追加しており、新たなローカライゼーション文字列、ウォークスルー用の AsyncStorage キー、公開フック useSettingsWalkthrough、および設定画面側でのレイアウト計測と WalkthroughOverlay 統合を含みます。

Changes

Cohort / File(s) Summary
ローカライゼーション
assets/translations/en.json, assets/translations/ja.json
設定ウォークスルー用のタイトル/説明キー settingsWalkthroughTitle1-4 と settingsWalkthroughDescription1-4 を追加。既存 JSON のカンマ調整あり。
ウォークスルー型定義
src/components/WalkthroughOverlay.tsx
WalkthroughStepId 型に settingsWelcome、settingsTheme、settingsTts、settingsLanguages を追加。
永続化キー
src/constants/asyncStorage.ts
新しい AsyncStorage キー SETTINGS_WALKTHROUGH_COMPLETED (@TrainLCD:settingsWalkthroughCompleted) を追加。
フック層
src/hooks/useSettingsWalkthrough.ts, src/hooks/index.ts
新規フック useSettingsWalkthrough を実装(状態読み込み/保存、ステップ管理、スポットライト領域追跡、ナビゲーション API)。src/hooks/index.ts で再エクスポートを追加。
設定画面統合
src/screens/AppSettings.tsx
SettingsItem にレイアウト報告(measureInWindow)を追加、テーマ/TTS/言語項目のレイアウト状態を管理し、useSettingsWalkthrough と WalkthroughOverlay を統合してスポットライト制御とウォークスルー操作を連携。

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant App as AppSettingsScreen
    participant Hook as useSettingsWalkthrough
    participant Overlay as WalkthroughOverlay
    participant Storage as AsyncStorage

    User->>App: 設定画面を開く
    App->>Hook: フックを初期化
    Hook->>Storage: 完了フラグを読み込む
    Storage-->>Hook: フラグを返す
    Hook-->>App: ウォークスルー開始/非表示を決定

    rect rgb(220, 245, 220)
      App->>App: 各 SettingsItem を measureInWindow で測定
      App->>Hook: スポットライト領域を設定
      Hook-->>Overlay: 現在ステップとスポットライトを提供
      Overlay->>User: ステップ表示(次へ/スキップ)
      User->>Overlay: 操作(次へ/スキップ/ジャンプ)
      Overlay->>Hook: nextStep()/skipWalkthrough()/goToStep() 呼び出し
      Hook->>Storage: 完了フラグを保存(必要時)
      Storage-->>Hook: 保存完了
      Hook-->>Overlay: 更新されたステップ状態を返す
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 設定の小道をぴょんと案内するよ
四つの光が項目をそっと照らす
テーマ、声、言語へ一歩ずつ
ユーザーと手をつなぎ進む旅路
新しい「わかる」が生まれるよ ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは「設定画面にウォークスルーを追加」で、変更セットの主要な目的と完全に一致しています。簡潔で明確で、チームメンバーが変更履歴をスキャンする際に主な変更内容を理解できます。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
src/screens/AppSettings.tsx (2)

82-106: forwardRef と useImperativeHandle の使用について確認が必要です。

ref パラメータが受け取られていますが、現在のコードでは viewRef が内部的に使用されており、外部から ref 経由でアクセスする箇所が見当たりません。forwardRef パターンが将来の拡張のためであれば問題ありませんが、不要であれば削除を検討してください。

♻️ forwardRefが不要な場合の簡略化
-const SettingsItem = React.forwardRef<
-  View,
-  {
-    item: SettingsSectionData;
-    isFirst: boolean;
-    isLast: boolean;
-    onPress?: () => void;
-    onItemLayout?: (layout: ItemLayout) => void;
-  }
->(({ item, isFirst, isLast, onPress, onItemLayout }, ref) => {
+const SettingsItem: React.FC<{
+  item: SettingsSectionData;
+  isFirst: boolean;
+  isLast: boolean;
+  onPress?: () => void;
+  onItemLayout?: (layout: ItemLayout) => void;
+}> = ({ item, isFirst, isLast, onPress, onItemLayout }) => {
   const isLEDTheme = useAtomValue(isLEDThemeAtom);
   const viewRef = useRef<View>(null);

   const handleLayout = useCallback(() => {
     if (viewRef.current && onItemLayout) {
       viewRef.current.measureInWindow(
         (x: number, y: number, width: number, height: number) => {
           onItemLayout({ x, y, width, height });
         }
       );
     }
   }, [onItemLayout]);

-  React.useImperativeHandle(ref, () => viewRef.current as View);

209-243: 3つの useEffect を1つに統合することを検討してください。

ロジックは正しいですが、3つの個別の useEffect は1つにまとめることで可読性とメンテナンス性が向上します。

♻️ useEffectの統合案
-  useEffect(() => {
-    if (currentStepId === 'settingsTheme' && themeItemLayout) {
-      setSpotlightArea({
-        x: themeItemLayout.x,
-        y: themeItemLayout.y,
-        width: themeItemLayout.width,
-        height: themeItemLayout.height,
-        borderRadius: 12,
-      });
-    }
-  }, [currentStepId, themeItemLayout, setSpotlightArea]);
-
-  useEffect(() => {
-    if (currentStepId === 'settingsTts' && ttsItemLayout) {
-      setSpotlightArea({
-        x: ttsItemLayout.x,
-        y: ttsItemLayout.y,
-        width: ttsItemLayout.width,
-        height: ttsItemLayout.height,
-        borderRadius: 0,
-      });
-    }
-  }, [currentStepId, ttsItemLayout, setSpotlightArea]);
-
-  useEffect(() => {
-    if (currentStepId === 'settingsLanguages' && languagesItemLayout) {
-      setSpotlightArea({
-        x: languagesItemLayout.x,
-        y: languagesItemLayout.y,
-        width: languagesItemLayout.width,
-        height: languagesItemLayout.height,
-        borderRadius: 12,
-      });
-    }
-  }, [currentStepId, languagesItemLayout, setSpotlightArea]);
+  useEffect(() => {
+    const layoutMap: Record<string, { layout: ItemLayout | null; borderRadius: number }> = {
+      settingsTheme: { layout: themeItemLayout, borderRadius: 12 },
+      settingsTts: { layout: ttsItemLayout, borderRadius: 0 },
+      settingsLanguages: { layout: languagesItemLayout, borderRadius: 12 },
+    };
+
+    if (currentStepId && layoutMap[currentStepId]) {
+      const { layout, borderRadius } = layoutMap[currentStepId];
+      if (layout) {
+        setSpotlightArea({
+          x: layout.x,
+          y: layout.y,
+          width: layout.width,
+          height: layout.height,
+          borderRadius,
+        });
+      }
+    }
+  }, [currentStepId, themeItemLayout, ttsItemLayout, languagesItemLayout, setSpotlightArea]);

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd72900 and 231ed10.

📒 Files selected for processing (7)
  • assets/translations/en.json
  • assets/translations/ja.json
  • src/components/WalkthroughOverlay.tsx
  • src/constants/asyncStorage.ts
  • src/hooks/index.ts
  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/hooks/index.ts
  • src/components/WalkthroughOverlay.tsx
  • src/constants/asyncStorage.ts
🧰 Additional context used
📓 Path-based instructions (10)
src/hooks/**/*.ts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Custom hooks should use use prefix (e.g., useStationFeed.ts)

Files:

  • src/hooks/useSettingsWalkthrough.ts
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Biome as the formatter for all code files

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
  • assets/translations/en.json
  • assets/translations/ja.json
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Use Biome as the linter for all code files
Use // biome-ignore only for true compatibility issues and include an inline reason

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
**/*.{ts,tsx,js,jsx,py,java,go,cs}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx,py,java,go,cs}: Use descriptive names for agents that clearly indicate their purpose and domain
Implement agents with well-defined input/output contracts to ensure clear communication
Document agent responsibilities and expected behaviors in comments or docstrings
Use composition and dependency injection for agent collaboration rather than tight coupling
Implement error handling and graceful degradation in agents to improve system resilience

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
**/*

📄 CodeRabbit inference engine (AGENTS.md)

Use UTF-8 encoding, two-space indentation, single quotes, and ES5 trailing commas as enforced by .editorconfig.

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
  • assets/translations/en.json
  • assets/translations/ja.json
**/*.{js,ts,tsx,jsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Biome is authoritative for linting; avoid // biome-ignore unless a rule is truly incompatible and document the rationale inline.

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
  • assets/translations/en.json
  • assets/translations/ja.json
**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

Name components with PascalCase (e.g., StationBanner.tsx).

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Name hooks with use* prefix (e.g., useStationFeed.ts).

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Keep comments purposeful: explain intent or non-obvious constraints, not obvious mechanics.

Files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
src/{components,screens}/**/*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Component files should use PascalCase naming (e.g., StationBanner.tsx)

Files:

  • src/screens/AppSettings.tsx
🧠 Learnings (6)
📓 Common learnings
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.
📚 Learning: 2025-05-19T10:59:37.813Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR `#4286`.

Applied to files:

  • src/hooks/useSettingsWalkthrough.ts
  • src/screens/AppSettings.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.{ts,tsx} : Name hooks with `use*` prefix (e.g., `useStationFeed.ts`).

Applied to files:

  • src/hooks/useSettingsWalkthrough.ts
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to src/hooks/**/*.ts : Custom hooks should use `use` prefix (e.g., `useStationFeed.ts`)

Applied to files:

  • src/hooks/useSettingsWalkthrough.ts
📚 Learning: 2024-12-18T00:29:05.817Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2024-12-18T00:29:05.817Z
Learning: 翻訳ファイル(`assets/translations/en.json` と `assets/translations/ja.json`)の変更を要約する際、`backgroundPermissionDenied` のようなキーが追加されているのか削除されているのかを正確に確認する。

Applied to files:

  • assets/translations/en.json
  • assets/translations/ja.json
📚 Learning: 2025-12-14T10:03:53.498Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4741
File: assets/translations/en.json:203-203
Timestamp: 2025-12-14T10:03:53.498Z
Learning: Ensure developer-facing translation keys (e.g., forDevelopers) are not exposed in production/public builds. Audit all translation files under assets/translations (e.g., en.json and other locales) and remove or guard such keys before releasing.

Applied to files:

  • assets/translations/en.json
  • assets/translations/ja.json
🧬 Code graph analysis (2)
src/hooks/useSettingsWalkthrough.ts (3)
src/components/WalkthroughOverlay.tsx (2)
  • WalkthroughStep (43-49)
  • WalkthroughStepId (29-41)
src/hooks/index.ts (1)
  • useSettingsWalkthrough (56-56)
src/constants/asyncStorage.ts (1)
  • ASYNC_STORAGE_KEYS (1-24)
src/screens/AppSettings.tsx (3)
src/store/atoms/theme.ts (1)
  • isLEDThemeAtom (7-7)
src/components/CardChevron.tsx (1)
  • CardChevron (3-14)
src/hooks/useSettingsWalkthrough.ts (1)
  • useSettingsWalkthrough (49-142)
🔇 Additional comments (11)
assets/translations/en.json (1)

264-272: LGTM!

設定ウォークスルー用の新しいローカライゼーションエントリが既存のパターンに従って正しく追加されています。日本語翻訳ファイルとも整合性が取れています。

src/hooks/useSettingsWalkthrough.ts (5)

9-34: LGTM!

ウォークスルーステップの定義が WalkthroughOverlay.tsx の WalkthroughStepId ユニオン型と翻訳キーに正しく対応しています。


36-55: LGTM!

型定義が明確で、isWalkthroughCompleted の null 状態によりロード中と未完了を区別できる設計になっています。


57-73: LGTM!

AsyncStorage の読み込みに適切なエラーハンドリングがあり、失敗時はウォークスルーを表示する安全なフォールバックになっています。


75-108: LGTM!

楽観的更新パターンで良好なUXを実現しており、境界チェックも適切です。useCallback による適切なメモ化も行われています。


117-141: LGTM!

派生状態のロジックが正しく、isWalkthroughActive の計算と currentStep のマージが適切に実装されています。

assets/translations/ja.json (1)

265-273: LGTM!

日本語のローカライゼーションエントリが英語版と一致しており、自然な日本語で記述されています。

src/screens/AppSettings.tsx (4)

75-80: LGTM!

ItemLayout 型がレイアウト計測に必要なプロパティを適切に定義しています。


124-176: LGTM!

レイアウト計測用の View ラッパーと onLayout コールバックが適切に実装されています。


182-207: LGTM!

レイアウト状態の管理と useSettingsWalkthrough フックの統合が適切に実装されています。


380-390: LGTM!

WalkthroughOverlay の条件付きレンダリングとプロパティの受け渡しが正しく実装されています。

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants