Repository navigation
一時的にDOを無効化できるようにした - #4447
一時的にDOを無効化できるようにした#4447
Conversation
|
Warning Rate limit exceeded@TinyKitten has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 42 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
Walkthrough朕が告げる、tuning に新たなフラグ Changes
Sequence Diagram(s)sequenceDiagram
participant User as 利用者
participant UI as TuningSettings
participant Store as tuningState(atom)
participant App as Permitted
participant DO as DevOverlay
User->>UI: 「開発者オーバレイを無効化する」Switch を切替
UI->>Store: settings.devOverlayEnabled を更新
App->>Store: settings.devOverlayEnabled を読取
alt isDevApp && !devOverlayEnabled
App->>DO: 表示
else
App--xDO: 非表示
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Out-of-scope changes
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (5)
src/store/atoms/tuning.ts (1)
19-19: 初期値は false でよい。命名は将来見直し候補である初期値 false により従来挙動を保ち、明示的に無効化した時のみオーバレイが消える。理に適っておる。
ただし二重否定の読みにくさは蓄積しがちゆえ、将来の整理時に devOverlayEnabled など正値の命名へ改名する選択肢も検討するがよい。src/components/TuningSettings.tsx (4)
35-39: スタイル名の語感を整えるがよいradioSettingItem は実体がSwitchであるゆえ、名称に齟齬がある。可読性のため switchSettingItem への改名を勧める。
適用例:
- radioSettingItem: { + switchSettingItem: { flexDirection: 'row', alignItems: 'center', marginTop: 12, }, - radioSettingItemText: { + switchSettingItemText: { marginLeft: 8, fontWeight: 'bold', }, ... - <View style={styles.radioSettingItem}> + <View style={styles.switchSettingItem}>この変更に伴い、Line 213 の Typography 側のスタイル参照も合わせて置換するがよい。
- <Typography style={styles.radioSettingItemText}> + <Typography style={styles.switchSettingItemText}>Also applies to: 59-62, 206-206
206-216: Switchのテーマ/アクセシビリティを鍛えよLEDテーマ時のコントラストと操作しやすさ向上のため、trackColor/thumbColorを指定し、合わせて testID と accessibilityLabel を付すがよい。iOSの ios_backgroundColor もテーマに応じて変えると良い。
<View style={styles.radioSettingItem}> <Switch value={settings.disableDevOverlay} onValueChange={toggleDevOverlayDisabled} - ios_backgroundColor={'#fff'} + ios_backgroundColor={isLEDTheme ? '#424242' : '#f0f0f0'} + trackColor={{ + false: isLEDTheme ? '#616161' : '#d1d1d1', + true: isLEDTheme ? '#b71c1c' : '#d32f2f', + }} + thumbColor={settings.disableDevOverlay + ? (isLEDTheme ? '#ef9a9a' : '#f28b82') + : (isLEDTheme ? '#eeeeee' : '#fafafa')} + testID="toggle-disable-dev-overlay" + accessibilityLabel="開発者オーバレイを無効化する" />
129-134: トグルハンドラの参照安定化は任意である現状でも支障はないが、useCallbackで包めば無駄な再レンダリング伝播を抑制できる。効果は軽微ゆえ任意とする。
- const toggleDevOverlayDisabled = () => - setSettings((prev) => ({ - ...prev, - disableDevOverlay: !prev.disableDevOverlay, - })); + const toggleDevOverlayDisabled = useCallback( + () => + setSettings((prev) => ({ + ...prev, + disableDevOverlay: !prev.disableDevOverlay, + })), + [setSettings] + );
206-216: 「一時的」要件の確認を行えこのSwitchは状態をJotaiにのみ保持し、永続化しておらぬ。PR題名の「一時的に…無効化」に合致しておるが、意図通りか最終確認せよ。もしアプリ再起動後も維持したければ、AsyncStorage連携の実装を別途加えるがよい。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/Permitted.tsx(3 hunks)src/components/TuningSettings.tsx(5 hunks)src/store/atoms/tuning.ts(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/components/Permitted.tsx (1)
src/utils/isDevApp.ts (1)
isDevApp(7-10)
src/store/atoms/tuning.ts (1)
src/constants/duration.ts (3)
DEFAULT_HEADER_TRANSITION_INTERVAL(5-5)DEFAULT_HEADER_TRANSITION_DELAY(8-8)DEFAULT_BOTTOM_TRANSITION_INTERVAL(6-6)
🔇 Additional comments (4)
src/store/atoms/tuning.ts (1)
12-12: 新規フラグの型追加、よくやったぞdisableDevOverlay:boolean の追加は妥当である。読み取り側の条件式も素直に書ける。
src/components/Permitted.tsx (2)
21-21: Jotaiからの読取は適切であるuseAtomValue(tuningState) で disableDevOverlay のみを購読しておる。無駄な再レンダリングも最小限で、良き実装である。
Also applies to: 65-65
454-454: 描画条件は明快にして正しいisDevApp && !disableDevOverlay の条件で DevOverlay を出し分けており、意図どおりである。朕はこれを良しとする。
src/components/TuningSettings.tsx (1)
11-11: Switch導入は適切である依存の追加なく react-native 標準Switchの採用、問題なし。続けよ。
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/TuningSettings.tsx (1)
129-134: onValueChange の引数を活かし、更新意図を明晰にせよ。Switch は新値を渡すゆえ、それを受けて devOverlayEnabled を反転させると可読性が高い。今の「prev を反転」は動作はするが意図が伝わりにくい。速やかに整えよ。
- const toggleDevOverlayEnabled = () => - setSettings((prev) => ({ - ...prev, - devOverlayEnabled: !prev.devOverlayEnabled, - })); + const toggleDevOverlayEnabled = (nextDisabled: boolean) => + setSettings((prev) => ({ + ...prev, + // Switch の表示値は「無効か否か」ゆえ、状態はその反転で管理する + devOverlayEnabled: !nextDisabled, + }));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/Permitted.tsx(3 hunks)src/components/TuningSettings.tsx(5 hunks)src/store/atoms/tuning.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- src/store/atoms/tuning.ts
- src/components/Permitted.tsx
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: TinyKitten
PR: TrainLCD/MobileApp#4429
File: src/components/CustomErrorBoundary.tsx:25-25
Timestamp: 2025-08-04T12:17:03.430Z
Learning: In the TrainLCD mobile app, __DEV__ and isDevApp serve different purposes: __DEV__ is only true during debug/development time, while isDevApp is true for both debug time and release-built canary versions. This distinction is intentional - __DEV__ is used to prevent sending crash reports to Sentry during development, while isDevApp is used to enable stack trace display for both developers and canary testers.
🔇 Additional comments (3)
src/components/TuningSettings.tsx (3)
11-11: Switch の導入、朕は是とする。用途に合致し問題なし。続行せよ。
35-39: スイッチ用行スタイルの追加、妥当也。行方向・中央寄せ・余白の設定、いずれも適正である。
59-62: テキスト用スタイル、是とする。Typography 側にサイズ管理を委ね、ここでは強調と間隔のみを担う構成、良い。
| <View style={styles.switchSettingItem}> | ||
| <Switch | ||
| value={!settings.devOverlayEnabled} | ||
| onValueChange={toggleDevOverlayEnabled} | ||
| ios_backgroundColor={'#fff'} | ||
| /> | ||
|
|
||
| <Typography style={styles.switchSettingItemText}> | ||
| 開発者オーバレイを無効化する | ||
| </Typography> | ||
| </View> |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
固定文言を撤し i18n を徹底せよ。合わせて A11y と操作性も強化せよ。
- 固定文字列は朕の法に反す。translate(...) に編入し、他所と一貫せよ。
- Switch に accessibilityLabel を与え、読上げ対応を整えよ。
- ラベル押下でも切替できるよう onPress を付し、操作性を高めよ。
- 併せて上の提案どおり onValueChange の新値を用いる実装に改めよ。
<View style={styles.switchSettingItem}>
<Switch
value={!settings.devOverlayEnabled}
- onValueChange={toggleDevOverlayEnabled}
- ios_backgroundColor={'#fff'}
+ onValueChange={toggleDevOverlayEnabled}
+ accessibilityLabel={translate('tuningItemDisableDevOverlay')}
+ ios_backgroundColor={'#fff'}
/>
- <Typography style={styles.switchSettingItemText}>
- 開発者オーバレイを無効化する
- </Typography>
+ <Typography
+ style={styles.switchSettingItemText}
+ onPress={() => toggleDevOverlayEnabled(settings.devOverlayEnabled)}
+ >
+ {translate('tuningItemDisableDevOverlay')}
+ </Typography>
</View>本変更が全体設計と合致しているか、次の検分を行え。とくに isDevApp と devOverlayEnabled の併用条件が正しく Permitted.tsx に反映されているか確かめよ。
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- tuning.ts に devOverlayEnabled が定義・初期化されているか検分 ---'
rg -n "devOverlayEnabled" -A 3 -B 3 -- ts | sed -n '1,120p'
echo '--- Permitted.tsx で isDevApp と devOverlayEnabled の条件式を検分 ---'
rg -n "Permitted\.tsx"
rg -n "(isDevApp).*devOverlayEnabled" -A 10 -B 10 -- tsx || true
rg -n "DevOverlay" -A 10 -B 10 -- tsx || trueLength of output: 237
朕は先の検分に誤りを嗅ぎ取った。より正確を期すため、下記の脚本をもって再度検分せよ。
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- tuning.ts の所在を探し出せ---'
find . -type f -name "tuning.ts*"
echo '--- tuning.ts 内で devOverlayEnabled の定義・初期化を確認せよ ---'
rg -n "devOverlayEnabled" -A 3 -B 3 --glob '*tuning.ts*' || true
echo '--- Permitted.tsx の所在を探し出せ---'
find . -type f -name "Permitted.tsx"
echo '--- Permitted.tsx 内の isDevApp と devOverlayEnabled の条件式を確認せよ ---'
for file in $(find . -type f -name "Permitted.tsx"); do
echo "----- $file -----"
rg -n "isDevApp" -A 5 -B 5 "$file" || true
rg -n "devOverlayEnabled" -A 5 -B 5 "$file" || true
rg -n "DevOverlay" -A 5 -B 5 "$file" || true
doneLength of output: 4504
i18n化・A11y強化・操作性向上の実装を要す
朕が検分したところ、src/store/atoms/tuning.ts にて devOverlayEnabled は初期化されており、
また src/components/Permitted.tsx では isDevApp && !devOverlayEnabled && <DevOverlay /> が正しく反映されておる。
合致しておる故、提案の導入は全体設計を崩さぬ。
下記修正を施せ。
対象ファイル:src/components/TuningSettings.tsx(206–216行目相当)
Diff例:
<View style={styles.switchSettingItem}>
<Switch
value={!settings.devOverlayEnabled}
- onValueChange={toggleDevOverlayEnabled}
- ios_backgroundColor={'#fff'}
+ onValueChange={(newValue) => toggleDevOverlayEnabled(newValue)}
+ accessibilityLabel={translate('tuningItemDisableDevOverlay')}
+ ios_backgroundColor={'#fff'}
/>
- <Typography style={styles.switchSettingItemText}>
- 開発者オーバレイを無効化する
- </Typography>
+ <Typography
+ style={styles.switchSettingItemText}
+ onPress={() => toggleDevOverlayEnabled(!settings.devOverlayEnabled)}
+ accessibilityRole="button"
+ >
+ {translate('tuningItemDisableDevOverlay')}
+ </Typography>
</View>ポイント:
- 固定文字列を
translate('tuningItemDisableDevOverlay')に置換 - Switch に
accessibilityLabelを追加 - ラベル部にも押下時トグル動作(
onPress)を付与 onValueChangeは新値を受け取る形に修正
以上、速やかに対応せよ。
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <View style={styles.switchSettingItem}> | |
| <Switch | |
| value={!settings.devOverlayEnabled} | |
| onValueChange={toggleDevOverlayEnabled} | |
| ios_backgroundColor={'#fff'} | |
| /> | |
| <Typography style={styles.switchSettingItemText}> | |
| 開発者オーバレイを無効化する | |
| </Typography> | |
| </View> | |
| <View style={styles.switchSettingItem}> | |
| <Switch | |
| value={!settings.devOverlayEnabled} | |
| onValueChange={(newValue) => toggleDevOverlayEnabled(newValue)} | |
| accessibilityLabel={translate('tuningItemDisableDevOverlay')} | |
| ios_backgroundColor={'#fff'} | |
| /> | |
| <Typography | |
| style={styles.switchSettingItemText} | |
| onPress={() => toggleDevOverlayEnabled(!settings.devOverlayEnabled)} | |
| accessibilityRole="button" | |
| > | |
| {translate('tuningItemDisableDevOverlay')} | |
| </Typography> | |
| </View> |
🤖 Prompt for AI Agents
In src/components/TuningSettings.tsx around lines 206–216, replace the
hard-coded Japanese label with translate('tuningItemDisableDevOverlay'), add an
accessibilityLabel prop to the Switch, change the Switch's onValueChange to
accept the new boolean value (e.g., onValueChange={(newValue) =>
toggleDevOverlayEnabled(newValue)}), and make the label pressable (wrap the
Typography in a Pressable/TouchableOpacity) so tapping the text toggles the
switch by calling the same toggle function with the inverted or new value; keep
the Switch value bound to the current state (e.g.,
value={!settings.devOverlayEnabled}) so the UI stays consistent.
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/components/LEDThemeSwitch.tsx (1)
46-49: styles.container をオブジェクト展開するは誤り、即刻改むべし。StyleSheet.create の戻りは数値 ID なり。これを
{...styles.container}すると空のオブジェクトとなり、幅・高さ・枠線幅など基礎スタイルが失われる。配列で素直に積み重ねよ。適用差分はこれだ。
- style={[ - { ...styles.container, borderColor: value ? '#fff' : '#555' }, - style, - ]} + style={[ + styles.container, + { borderColor: value ? '#fff' : '#555' }, + style, + ]}
🧹 Nitpick comments (2)
src/components/LEDThemeSwitch.tsx (2)
43-45: 可用性と徳政を高めよ:Switch の意味づけと可触領域を付与せよ。画面読み上げに「スイッチ」であることと状態を示し、タップ領域を広げよ。
<TouchableOpacity activeOpacity={1} - onPress={handleContainerPress} + accessibilityRole="switch" + accessibilityState={{ checked: value }} + hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }} + onPress={handleContainerPress}
60-60: 暗色背景時の文言コントラスト、未だ足らず。OFF 時は背景 #555 に文字色 #212121 は読みにくい。文字色を状態で反転せよ。
- <Typography style={styles.label}>{value ? 'ON' : 'OFF'}</Typography> + <Typography style={[styles.label, { color: value ? '#212121' : '#fff' }]}> + {value ? 'ON' : 'OFF'} + </Typography>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/LEDThemeSwitch.tsx(1 hunks)src/components/TuningSettings.tsx(6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/TuningSettings.tsx
🔇 Additional comments (1)
src/components/LEDThemeSwitch.tsx (1)
12-12: Props.style を任意化した策、善し。朕は是を可とする。RN の style 配列は undefined を素通しするゆえ挙動は安全、後方互換性も保たれておる。
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (4)
src/components/LEDThemeSwitch.tsx (1)
47-49: StyleSheet をスプレッドしており、スタイルが消失する不具合がある。即刻正せStyleSheet.create の戻りは数値IDである。ゆえに
{ ...styles.container }は空オブジェクトになり、width/height/borderWidth が適用されぬ。配列結合で上書きせよ、との詔である。以下の差分を当てよ。
- style={[ - { ...styles.container, borderColor: value ? '#fff' : '#555' }, - style, - ]} + style={[ + styles.container, + { borderColor: value ? '#fff' : '#555' }, + style, + ]}src/components/TuningSettings.tsx (3)
158-162: StyleSheet をスプレッドしておる。TextInput のスタイルが消える。即修正せよ(1/3)
{ ...styles.textInput, ... }は無効である。配列で結合せよ。- style={{ - ...styles.textInput, - color: isLEDTheme ? '#fff' : 'black', - fontFamily: isLEDTheme ? FONTS.JFDotJiskan24h : undefined, - }} + style={[ + styles.textInput, + { + color: isLEDTheme ? '#fff' : 'black', + fontFamily: isLEDTheme ? FONTS.JFDotJiskan24h : undefined, + }, + ]}
176-180: StyleSheet スプレッドの誤用(2/3)先と同様、配列に改めよ。
- style={{ - ...styles.textInput, - color: isLEDTheme ? '#fff' : 'black', - fontFamily: isLEDTheme ? FONTS.JFDotJiskan24h : undefined, - }} + style={[ + styles.textInput, + { + color: isLEDTheme ? '#fff' : 'black', + fontFamily: isLEDTheme ? FONTS.JFDotJiskan24h : undefined, + }, + ]}
195-198: StyleSheet スプレッドの誤用(3/3)三度目である。配列結合に統一せよ。
- style={{ - ...styles.textInput, - color: isLEDTheme ? '#fff' : 'black', - fontFamily: isLEDTheme ? FONTS.JFDotJiskan24h : undefined, - }} + style={[ + styles.textInput, + { + color: isLEDTheme ? '#fff' : 'black', + fontFamily: isLEDTheme ? FONTS.JFDotJiskan24h : undefined, + }, + ]}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/components/LEDThemeSwitch.tsx(1 hunks)src/components/Permitted.tsx(3 hunks)src/components/TuningSettings.tsx(6 hunks)src/store/atoms/tuning.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/Permitted.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/store/atoms/tuning.ts (1)
src/constants/duration.ts (3)
DEFAULT_HEADER_TRANSITION_INTERVAL(5-5)DEFAULT_HEADER_TRANSITION_DELAY(8-8)DEFAULT_BOTTOM_TRANSITION_INTERVAL(6-6)
🔇 Additional comments (5)
src/components/LEDThemeSwitch.tsx (1)
12-15: Props.style を optional 化した判断、良し新規利用側でスタイル未指定が許容され、型の柔軟性が増す。副作用なしと見做す。
src/components/TuningSettings.tsx (4)
36-40: 行レイアウトの追加、良し横並び・中央揃え・余白指定はいずれも自然である。LED/非LED双方で崩れぬ構成と見た。
60-63: 項目テキストのスタイル追加、良し左余白と太字指定は可読性を高める。問題なし。
130-134: トグル更新関数、簡潔で良い不変更新で state を安全に反転しておる。必要なら useCallback 化で再生成を抑えるが、現状でも支障なし。
153-169: ヘッダー遅延/継続時間のラベルと紐付け先が逆転しておる疑い。確認せよ「遅延」見出しで
headerTransitionIntervalを編集し、「継続時間」見出しでheaderTransitionDelayを編集しておる。名と実装が交差しておるように見える。仕様意図を点検し、項目と状態名を対応付けよ。Also applies to: 171-187
| <View style={styles.switchSettingItem}> | ||
| {isLEDTheme ? ( | ||
| <LEDThemeSwitch | ||
| value={!settings.devOverlayEnabled} | ||
| onValueChange={toggleDevOverlayEnabled} | ||
| /> | ||
| ) : ( | ||
| <Switch | ||
| value={!settings.devOverlayEnabled} | ||
| onValueChange={toggleDevOverlayEnabled} | ||
| ios_backgroundColor={'#fff'} | ||
| /> | ||
| )} | ||
|
|
||
| <Typography style={styles.switchSettingItemText}> | ||
| 開発者オーバレイを無効化する | ||
| </Typography> | ||
| </View> |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
UI で否定を掛けるのは読み手を惑わす。名とロジックの整合を図り、否定演算子を撤せ
value={!settings.devOverlayEnabled} は、文脈理解に不要な負担を与える。名が devOverlayEnabled であるなら UI も「有効化」を表し、否定を使わぬのが道理。さらに Permitted 側の条件も一致させよ。
以下は本ファイルに限った調整案である(Permitted.tsx も併せて修正せよ)。
- <LEDThemeSwitch
- value={!settings.devOverlayEnabled}
- onValueChange={toggleDevOverlayEnabled}
- />
+ <LEDThemeSwitch
+ value={settings.devOverlayEnabled}
+ onValueChange={toggleDevOverlayEnabled}
+ />
...
- <Switch
- value={!settings.devOverlayEnabled}
- onValueChange={toggleDevOverlayEnabled}
- ios_backgroundColor={'#fff'}
- />
+ <Switch
+ value={settings.devOverlayEnabled}
+ onValueChange={toggleDevOverlayEnabled}
+ ios_backgroundColor={'#fff'}
+ />
...
- <Typography style={styles.switchSettingItemText}>
- 開発者オーバレイを無効化する
- </Typography>
+ <Typography style={styles.switchSettingItemText}>
+ 開発者オーバレイを有効化する
+ </Typography>Permitted.tsx の条件が「isDevApp かつ devOverlayEnabled が true」で描画となるよう合わせよ。意図が異なるなら、devOverlayDisabled へ改名して否定を排す方式を取れ。
朕、さらなる検証のために「Permitted.tsx」の存在と devOverlayEnabled および isDevApp の使用箇所を確認せよ。次のスクリプトを実行せよ――
🏁 Script executed:
#!/bin/bash
# Permitted.tsx の存在を探す
fd -e tsx Permitted.tsx || echo "Permitted.tsx が見つかりませんでした"
# devOverlayEnabled と isDevApp の参照箇所を表示
rg -n "devOverlayEnabled|isDevApp" src/components/Permitted.tsx || echo "参照箇所が見つからないか、Permitted.tsx が存在しません"Length of output: 296
開発者オーバーレイロジックの一貫性を保つ改修せよ
朕が見たところ、TuningSettings.tsx と Permitted.tsx で devOverlayEnabled の真偽が逆転しておる。変数名に合わせて否定を排し、表示ラベルと条件式を整合せよ。
・src/components/TuningSettings.tsx
value={!settings.devOverlayEnabled}をvalue={settings.devOverlayEnabled}に改めよ- 表示テキスト「開発者オーバレイを無効化する」を「開発者オーバレイを有効化する」へ修正せよ
・src/components/Permitted.tsx
{isDevApp && !devOverlayEnabled && <DevOverlay />}を{isDevApp && devOverlayEnabled && <DevOverlay />}へ変更せよ- あるいは変数名を
devOverlayDisabledに改名し、否定演算子を完全に排する方法も検討せよ
以下、例示的なdiffである。
--- a/src/components/TuningSettings.tsx
+++ b/src/components/TuningSettings.tsx
@@ -209,12 +209,12 @@
{isLEDTheme ? (
<LEDThemeSwitch
- value={!settings.devOverlayEnabled}
+ value={settings.devOverlayEnabled}
onValueChange={toggleDevOverlayEnabled}
/>
) : (
<Switch
- value={!settings.devOverlayEnabled}
+ value={settings.devOverlayEnabled}
onValueChange={toggleDevOverlayEnabled}
ios_backgroundColor={'#fff'}
/>
@@ -222,7 +222,7 @@
<Typography style={styles.switchSettingItemText}>
- 開発者オーバレイを無効化する
+ 開発者オーバレイを有効化する
</Typography>--- a/src/components/Permitted.tsx
+++ b/src/components/Permitted.tsx
@@ -452,7 +452,7 @@
{/* 開発者オーバレイ */}
- {isDevApp && !devOverlayEnabled && <DevOverlay />}
+ {isDevApp && devOverlayEnabled && <DevOverlay />}これらの修正により、変数名とUI/描画条件の整合性が取れるであろう。朕、これを以て改善を命ず。
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <View style={styles.switchSettingItem}> | |
| {isLEDTheme ? ( | |
| <LEDThemeSwitch | |
| value={!settings.devOverlayEnabled} | |
| onValueChange={toggleDevOverlayEnabled} | |
| /> | |
| ) : ( | |
| <Switch | |
| value={!settings.devOverlayEnabled} | |
| onValueChange={toggleDevOverlayEnabled} | |
| ios_backgroundColor={'#fff'} | |
| /> | |
| )} | |
| <Typography style={styles.switchSettingItemText}> | |
| 開発者オーバレイを無効化する | |
| </Typography> | |
| </View> | |
| <View style={styles.switchSettingItem}> | |
| {isLEDTheme ? ( | |
| <LEDThemeSwitch | |
| value={settings.devOverlayEnabled} | |
| onValueChange={toggleDevOverlayEnabled} | |
| /> | |
| ) : ( | |
| <Switch | |
| value={settings.devOverlayEnabled} | |
| onValueChange={toggleDevOverlayEnabled} | |
| ios_backgroundColor={'#fff'} | |
| /> | |
| )} | |
| <Typography style={styles.switchSettingItemText}> | |
| 開発者オーバレイを有効化する | |
| </Typography> | |
| </View> |
🤖 Prompt for AI Agents
In src/components/TuningSettings.tsx around lines 207-224, the
Switch/LEDThemeSwitch use the negated setting value and the label reads
“開発者オーバレイを無効化する”; change the component props to use
value={settings.devOverlayEnabled} and update the label to “開発者オーバレイを有効化する”.
Also update src/components/Permitted.tsx so the DevOverlay is shown when
devOverlayEnabled is true (replace {isDevApp && !devOverlayEnabled &&
<DevOverlay />} with {isDevApp && devOverlayEnabled && <DevOverlay />}), or
alternatively rename the flag to devOverlayDisabled and remove negations
throughout for clarity.
| devOverlayEnabled: boolean; | ||
| }; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
命名と意味が逆で紛らわしい。enabled なら true で表示が自然。整合を図れ
今の実装は「devOverlayEnabled が false のとき表示」となっておる様子。enabled の名で非表示を意味するのは混乱の元。次のいずれかを断行せよ。
- 名称を
devOverlayDisabled(またはdevOverlayVisible)に改め、UI/条件式を自然な論理に揃える。 - 名称を維持するなら、Permitted 側の条件を「
devOverlayEnabled === trueで表示」に改め、UI から否定演算子を排す。
また、初期値 true は「デフォルトで非表示(現状ロジックでは)」の挙動となる。従来 DO が既定で表示であったなら、初期値は false に改めるのが筋である。仕様の意図を確認せよ。
仕様の意図とリポジトリ全体の参照箇所を確認するため、朕自ら調査用の令を下す。以下を走らせ、使用箇所と条件式を洗い出すがよい。
Also applies to: 19-20
🏁 Script executed:
#!/bin/bash
# devOverlayEnabled の参照と周辺3行の文脈を出す
rg -n --hidden --glob '!*dist*' --glob '!*build*' 'devOverlayEnabled' -B 3 -A 3Length of output: 3244
朕、命名と挙動の整合を命ず
現状、devOverlayEnabled が false の際に DevOverlay が表示されるため、命名と意味が逆転しておる。
下記箇所を修正せよ:
- src/store/atoms/tuning.ts(19行目):初期値
trueは「非表示」を初期挙動としておる。仕様でデフォルト表示を望むならば、falseに改むるべし。 - src/components/Permitted.tsx(454行目):
!devOverlayEnabledにより表示判定を行うのは非直感的なため、否定演算を排しdevOverlayEnabledがtrueの時に表示される論理に統一せよ。または変数名をdevOverlayDisabled/devOverlayVisible等に変更し、否定演算を取り除くべし。 - src/components/TuningSettings.tsx(210・215行目):Switch の
value={!settings.devOverlayEnabled}をvalue={settings.devOverlayEnabled}に改むか、変数名変更後のプロパティ参照へ更新せよ。
いずれかの方針を採りて、命名・論理・UI の齟齬を解消せよ。朕、汝らの速やかな修正を期す。
🤖 Prompt for AI Agents
In src/store/atoms/tuning.ts around lines 12–19, src/components/Permitted.tsx
around line 454, and src/components/TuningSettings.tsx around lines 210–215: the
boolean flag devOverlayEnabled is inverted vs. its usage (initial value true
currently means “hidden”), causing negations across the codebase; fix by making
the flag semantics mean “overlay is visible” — set the initial value in
tuning.ts to false→true as needed to reflect the desired default visibility (per
spec default = visible, set initial to true), then remove logical negations
where it’s used: in Permitted.tsx change the render condition from
!devOverlayEnabled to devOverlayEnabled, and in TuningSettings.tsx change Switch
value from {!settings.devOverlayEnabled} to {settings.devOverlayEnabled}; if you
prefer renaming instead, pick a clear name (e.g., devOverlayVisible) and update
all references accordingly so no ! (negation) remains.
close #4437
Summary by CodeRabbit