Skip to content

設定モーダルのボタンでカッコ内テキストを本文より小さく表示する - #5950

Merged
TinyKitten merged 4 commits into
devfrom
claude/fix-train-type-font-tablet-McHfL
May 11, 2026
Merged

TinyKitten merged 4 commits into
devfrom
claude/fix-train-type-font-tablet-McHfL

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 11, 2026 •

Copy link
Copy Markdown
Member

概要

設定モーダル(SelectBoundSettingListModal)の「列車種別」「テーマ」ボタンに表示されるテキストで、カッコ内の文字が本文と同じフォントサイズで描画されてしまう不具合を修正しました。CommonCard 系のモーダルではすでにカッコ内を小さく表示する処理が入っていましたが、本モーダルでは独自レンダリングのため対象外になっていました。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • src/components/SelectBoundSettingListModal.tsx に trainTypeNameParens スタイル(fontSize: RFValue(9))を追加し、本文 trainTypeNameText(RFValue(12))の約 75% のサイズで描画されるようにした。
  • モジュールスコープのヘルパー renderWithSmallParens を追加し、(...) 部分を別の Typography として切り出して縮小フォントを当てる。スマホ・タブレット双方で本文と一定の比率を保ちつつカッコだけが小さく表示されるようになる。
  • 列車種別ボタンとテーマボタンの両方の Typography で同ヘルパーを使うように変更。カッコを含まない通常文字列ではこれまで通り単一フラグメントとして描画される。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

関連Issue

スクリーンショット(任意)


Generated by Claude Code

Summary by CodeRabbit

  • UI改善
    • 列車タイプ名とテーマラベル内の括弧内テキストが、より小さく太字で表示されるよう改善されました。括弧情報が視覚的に区別されることで、ラベルの可読性とコンテキスト把握が向上します。これにより一覧や選択モーダルでの情報認識がしやすくなります。

Review Change Stack

@TinyKitten TinyKitten self-assigned this May 11, 2026
@github-actions github-actions Bot added the react label May 11, 2026
@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2b7646e6-526e-4387-9a0d-660e58e00654

📥 Commits

Reviewing files that changed from the base of the PR and between 440852c and d5c9a57.

📒 Files selected for processing (1)
  • src/components/SelectBoundSettingListModal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/SelectBoundSettingListModal.tsx

📝 Walkthrough

Walkthrough

SelectBoundSettingListModalで、括弧内の部分を小さく太字で表示する新スタイルと、括弧を検出して分割・レンダリングするヘルパーを追加し、trainTypeNameとthemeLabelの出力に適用しています。

変更内容

括弧付きテキストスタイル

Layer / File(s) Summary
括弧スタイルの定義
src/components/SelectBoundSettingListModal.tsx
新しいスタイルtrainTypeNameParensを追加。括弧内のテキストをより小さいフォントサイズと太字の重みで表示。
括弧テキスト分割ヘルパー関数
src/components/SelectBoundSettingListModal.tsx
renderWithSmallParens(text: string)ヘルパー関数を実装。入力文字列の半角・全角括弧パターンを検出して分割し、括弧内の部分をtrainTypeNameParensスタイル付きのTypographyでラップ。
trainTypeName ラベル適用
src/components/SelectBoundSettingListModal.tsx
trainTypeNameの描画ロジックをヘルパー経由に変更。既存のフォールバックもヘルパーに渡すように更新。
themeLabel ラベル適用
src/components/SelectBoundSettingListModal.tsx
themeLabel表示をrenderWithSmallParens(themeLabel ?? translate('autoTheme'))に変更し、括弧処理を適用。

🎯 2 (Simple) | ⏱️ ~8分

🐰 小さき括弧よ、太く光れ
テキストに彩り、文字に命
スタイル加えて、もっと輝く
ラベルに魔法、かくれんぼする括弧も
可愛らしく踊るモバイルの画面✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトルは、設定モーダルのボタン内のカッコ文字を本文より小さく表示する主要な変更を簡潔かつ明確に説明しており、変更内容と完全に関連している。
Description check ✅ Passed プルリクエストの説明は、テンプレートの主要なセクション(概要、変更の種類、変更内容、テスト)を完全に満たし、詳細な技術的情報を含んでいる。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-train-type-font-tablet-McHfL

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/SelectBoundSettingListModal.tsx (1)

85-96: ⚡ Quick win

全角カッコ((...))が縮小対象から漏れる可能性があります。

Line 86 と Line 88 の正規表現は半角 () のみ対象です。日本語ラベルで全角カッコが混在すると縮小表示されないため、両対応にしておくのが安全です。

#!/bin/bash
# 目的:
# 1) この画面で使う翻訳キーの定義周辺を確認
# 2) リポジトリ内に全角カッコ文字列がどの程度存在するか確認
# 期待:
# - trainTypeDefault / autoTheme が全角カッコを含む場合、現状ロジックだと縮小されない可能性を確認できる

rg -n -C2 "trainTypeDefault|autoTheme" src
rg -n --iglob '*.{ts,tsx,js,jsx,json,yml,yaml}' '([^)]*)' src
修正案(差分)
-const renderWithSmallParens = (text: string) => {
-  const parts = text.split(/(\([^)]*\))/);
+const renderWithSmallParens = (text: string) => {
+  const parts = text.split(/([((][^))]*[))])/);
   return parts.map((part, index) =>
-    /^\(.*\)$/.test(part) ? (
+    /^(?:\([^)]*\)|([^)]*))$/.test(part) ? (
       <Typography key={`${index}-${part}`} style={styles.trainTypeNameParens}>
         {part}
       </Typography>
     ) : (
       part
     )
   );
 };
🤖 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/SelectBoundSettingListModal.tsx` around lines 85 - 96, The
split/regex logic in renderWithSmallParens only handles halfwidth parentheses so
fullwidth Japanese parentheses won’t be matched; update the regexes used in
renderWithSmallParens (the split regex /(\([^)]*\))/ and the test /^\(.*\)$/ )
to accept both halfwidth and fullwidth parens (e.g. use a character class like
[()()] in both the split and the test) so parts that are wrapped in (...) also
render with styles.trainTypeNameParens inside the Typography element.
🤖 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.

Nitpick comments:
In `@src/components/SelectBoundSettingListModal.tsx`:
- Around line 85-96: The split/regex logic in renderWithSmallParens only handles
halfwidth parentheses so fullwidth Japanese parentheses won’t be matched; update
the regexes used in renderWithSmallParens (the split regex /(\([^)]*\))/ and the
test /^\(.*\)$/ ) to accept both halfwidth and fullwidth parens (e.g. use a
character class like [()()] in both the split and the test) so parts that are
wrapped in (...) also render with styles.trainTypeNameParens inside the
Typography element.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c71acdd1-572d-4ea7-9d85-f7f846afd120

📥 Commits

Reviewing files that changed from the base of the PR and between 61b8efb and 440852c.

📒 Files selected for processing (1)
  • src/components/SelectBoundSettingListModal.tsx

@TinyKitten
TinyKitten merged commit 18f1f53 into dev May 11, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the claude/fix-train-type-font-tablet-McHfL branch May 11, 2026 14:00
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