Repository navigation
フィードバックモーダルのデザインを刷新 - #6624
フィードバックモーダルのデザインを刷新#6624
Conversation
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018WsXPyBTaHgqxhP9v4AWio
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesNewReportModal 更新
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (4)
src/components/NewReportModal.tsx (2)
167-174: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winアンマウント時にアニメーションを停止してください。
この effect は
Animated.timing(...).start()を呼びますが、クリーンアップを返しません。useNativeDriver: falseのため、アニメーションは JS 側で駆動します。モーダルを閉じた直後や依存値が連続で変化した場合、前のアニメーションが残ります。クリーンアップでstop()を呼ぶと、この残留を防げます。♻️ 提案する修正
useEffect(() => { - Animated.timing(progressAnim, { + const animation = Animated.timing(progressAnim, { toValue: Math.min(charCount / descriptionLowerLimit, 1), duration: 200, // NOTE: width をアニメーションするため native driver は使えない useNativeDriver: false, - }).start(); + }); + animation.start(); + return () => animation.stop(); }, [charCount, descriptionLowerLimit, progressAnim]);🤖 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 `@src/components/NewReportModal.tsx` around lines 167 - 174, Update the useEffect managing progressAnim so it retains the animation returned by Animated.timing(...).start() and returns a cleanup function that calls stop() on it, ensuring the JS-driven animation is stopped on unmount or before dependencies change.
238-248: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueテーマ依存スタイルの定義が
StyleSheet.createと JSX に分散しています。 どちらの箇所も、テーマごとの外観値を JSX のインラインオブジェクトで指定するため、静的スタイル側の指定が重複または無効化されます。テーマ別の静的スタイルをStyleSheet.createにまとめると、参照が安定し、外観値の確認箇所が1つになります。
src/components/NewReportModal.tsx#L238-L248:modalViewLEDとmodalViewDefaultをStyleSheet.createに定義し、isLEDTheme ? styles.modalViewLED : styles.modalViewDefaultに置き換えてください。src/components/NewReportModal.tsx#L74-L84:styles.textInputのborderRadius: 12を削除してください。JSX 側(Line 291)のborderRadius: isLEDTheme ? 0 : 12が常に上書きします。同様にtextInputLEDとtextInputDefaultを切り出すと、色と角丸の指定を1箇所に集約できます。🤖 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 `@src/components/NewReportModal.tsx` around lines 238 - 248, In src/components/NewReportModal.tsx lines 238-248, define the theme-specific modal styles as modalViewLED and modalViewDefault within StyleSheet.create, then replace the inline conditional with styles.modalViewLED or styles.modalViewDefault. In lines 74-84, remove borderRadius from styles.textInput and split the theme-specific text input styling into textInputLED and textInputDefault so color and radius values are defined in one place; update the JSX usage accordingly.src/components/NewReportModal.test.tsx (2)
106-119: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win破棄を選択した後に
onCloseが呼ばれることを検証してください。このテストは
showDialogの第3引数をexpect.any(Array)としか照合しません。破棄ボタンのonPressがonCloseを呼ぶ経路は未検証です。この経路は入力内容を捨てる分岐であり、退行するとユーザーはモーダルを閉じられません。渡されたボタン配列からdestructiveの項目を取り出して実行すると、この経路を保護できます。💚 提案する追記
expect(showDialog).toHaveBeenCalledWith( 'confirmDiscardTitle', 'confirmDiscardMessage', expect.any(Array) ); expect(onClose).not.toHaveBeenCalled(); + + const buttons = showDialog.mock.calls[0][2]; + const discardButton = buttons.find( + (button: { style?: string }) => button.style === 'destructive' + ); + expect(discardButton).toBeDefined(); + + act(() => { + discardButton.onPress(); + }); + expect(onClose).toHaveBeenCalledTimes(1); });🤖 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 `@src/components/NewReportModal.test.tsx` around lines 106 - 119, Update the test around the showDialog call in the “入力済みで閉じると破棄確認ダイアログを表示し、即時にはonCloseを呼ばない” case to capture its button-array argument, locate the destructive discard action, invoke its onPress handler, and assert that onClose is then called. Preserve the existing assertions that the dialog appears and onClose is not called before discard.
11-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
jotaiのモジュール全体モックは壊れやすいです。このモックは
useAtomValueとatomだけを提供します。NewReportModalまたはその子コンポーネントが将来useAtom、useSetAtom、Providerを使うと、テストはundefined is not a functionで失敗します。実モジュールを展開してから必要な部分だけ置換すると、この破損を防げます。♻️ 提案する修正
-jest.mock('jotai', () => ({ - useAtomValue: jest.fn(() => false), - atom: jest.fn((initialValue) => initialValue), -})); +jest.mock('jotai', () => ({ + ...jest.requireActual('jotai'), + useAtomValue: jest.fn(() => false), +}));🤖 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 `@src/components/NewReportModal.test.tsx` around lines 11 - 14, Update the jotai mock in NewReportModal tests to preserve the real module exports and override only useAtomValue and atom with the test behavior. This keeps useAtom, useSetAtom, Provider, and any future jotai APIs available to NewReportModal and its children.
🤖 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 `@src/components/NewReportModal.test.tsx`:
- Line 12: Update the NewReportModal tests to cover the isLEDTheme=true branch
by overriding the mocked useAtomValue with mockReturnValue(true) in a dedicated
test, and assert the LED-specific styling behavior for disabled corner rounding,
white borders, and monochrome colors. Keep the existing false-theme coverage
intact.
In `@src/components/NewReportModal.tsx`:
- Line 222: Update mutedTextColor in the non-LED theme branch to use `#767676` or
a darker value, ensuring sufficient contrast against the white background while
leaving the LED theme color unchanged.
- Line 257: Update the Pressable wrapping the keyboard-dismiss touch handling in
NewReportModal to set accessible to false, preserving its existing
Keyboard.dismiss onPress behavior while keeping the child TextInput and Button
controls individually accessible.
---
Nitpick comments:
In `@src/components/NewReportModal.test.tsx`:
- Around line 106-119: Update the test around the showDialog call in the
“入力済みで閉じると破棄確認ダイアログを表示し、即時にはonCloseを呼ばない” case to capture its button-array
argument, locate the destructive discard action, invoke its onPress handler, and
assert that onClose is then called. Preserve the existing assertions that the
dialog appears and onClose is not called before discard.
- Around line 11-14: Update the jotai mock in NewReportModal tests to preserve
the real module exports and override only useAtomValue and atom with the test
behavior. This keeps useAtom, useSetAtom, Provider, and any future jotai APIs
available to NewReportModal and its children.
In `@src/components/NewReportModal.tsx`:
- Around line 167-174: Update the useEffect managing progressAnim so it retains
the animation returned by Animated.timing(...).start() and returns a cleanup
function that calls stop() on it, ensuring the JS-driven animation is stopped on
unmount or before dependencies change.
- Around line 238-248: In src/components/NewReportModal.tsx lines 238-248,
define the theme-specific modal styles as modalViewLED and modalViewDefault
within StyleSheet.create, then replace the inline conditional with
styles.modalViewLED or styles.modalViewDefault. In lines 74-84, remove
borderRadius from styles.textInput and split the theme-specific text input
styling into textInputLED and textInputDefault so color and radius values are
defined in one place; update the JSX usage accordingly.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d150ddbd-709f-4254-9e79-a68d419e3744
📒 Files selected for processing (2)
src/components/NewReportModal.test.tsxsrc/components/NewReportModal.tsx
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018WsXPyBTaHgqxhP9v4AWio
Fixes Applied SuccessfullyFixed 2 file(s) based on 3 CodeRabbit feedback item(s). Files modified:
Commit: The latest autofix changes are on the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@src/components/NewReportModal.test.tsx`:
- Around line 132-142:
LEDテーマの入力欄スタイルを検証するテストで、既存のスタイルアサーションにborderColorが白(#fff)であることも追加確認してください。対象はrenderModalで取得したinputのスタイル検証です。
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: dcd8766b-35e1-4f43-be8f-6353e8006d48
📒 Files selected for processing (2)
src/components/NewReportModal.test.tsxsrc/components/NewReportModal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/NewReportModal.tsx
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_018WsXPyBTaHgqxhP9v4AWio
Fixes Applied SuccessfullyFixed 1 file(s) based on 1 CodeRabbit feedback item(s). Files modified:
Commit: The latest autofix changes are on the |
概要
変更の種類
変更内容
NewReportModalのデザインを刷新(src/components/NewReportModal.tsx)flex: 1をやめてコンテンツに沿った高さに変更NewReportModalのレンダーテストを新規追加(src/components/NewReportModal.test.tsx、7ケース)Pressableにaccessible={false}を指定し、子の入力欄・ボタンを個別にフォーカス可能に#777→#767676に変更し WCAG AA (4.5:1) を満たすコントラストにテスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit
新機能
テスト