Skip to content

JRWテーマバグ修正とTTSで流す経由駅の仕様変更#4193

Merged
TinyKitten merged 1 commit intodevfrom
fix/jrw-theme
Apr 15, 2025
Merged

JRWテーマバグ修正とTTSで流す経由駅の仕様変更#4193
TinyKitten merged 1 commit intodevfrom
fix/jrw-theme

Conversation

@TinyKitten
Copy link
Member

@TinyKitten TinyKitten commented Apr 15, 2025

close #4191 close #4192

Summary by CodeRabbit

  • スタイル

    • 番号表示コンテナの横幅と位置を微調整し、デバイスごとに見やすくしました。
  • バグ修正

    • JR西日本やLEDテーマで通過駅の場合、選択した進行方向に応じて正しい駅が表示されるよう改善しました。
  • リファクタ

    • 音声案内の経由駅選択ロジックを最適化し、より適切な駅名が案内に使われるようになりました。

@TinyKitten TinyKitten self-assigned this Apr 15, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 15, 2025

Walkthrough

余が見しところ、この変更は三つの主要な箇所に及ぶ。第一に、LineBoardWest の UI におけるナンバリングコンテナのスタイルが調整され、端末種別によって幅と左マージンが改められた。第二に、useRefreshLeftStations フックでは、テーマや進行方向に応じて駅の選択ロジックが改良された。第三に、useTTSText フックにて、経由駅(viaStation)の選定がメモ化され、TTS テンプレート内で動的に扱われるようになった。いずれも公開インターフェースには影響なし。

Changes

ファイル/グループ 変更内容概要
src/components/LineBoardWest.tsx ナンバリングコンテナの marginLeft および width を端末種別ごとに調整。
src/hooks/useRefreshLeftStations.ts 進行方向に応じて normalStations 配列を反転し、パス駅判定ロジックを修正。依存配列に selectedDirection を追加。
src/hooks/useTTSText.ts allStops 配列のメモ化、viaStation の動的選定とメモ化、TTS テンプレートでの viaStation 利用に書き換え。

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant useRefreshLeftStations
    participant useTTSText

    UI->>useRefreshLeftStations: 駅リスト・進行方向・テーマを渡す
    useRefreshLeftStations->>useRefreshLeftStations: normalStations を必要に応じて反転
    useRefreshLeftStations->>UI: 適切な駅情報を返す

    UI->>useTTSText: 駅リスト・現在駅を渡す
    useTTSText->>useTTSText: allStops をメモ化
    useTTSText->>useTTSText: viaStation を選定・メモ化
    useTTSText->>UI: TTS テキストを返す(viaStation を動的利用)
Loading

Possibly related PRs

  • TTS修正 #4062: 両 PR は useTTSText フックを修正しているが、こちらは経由駅の選定とテンプレート適用に焦点を当て、関連 PR は駅番号テキストや SSML 出力のフォーマット変更に注力している。

Suggested labels

react, functions

Poem

┏━━━始皇帝の詩━━━┓
余が命じてコードを磨く、
駅の流れも逆さまに、
経由の駅は賢く選び、
UI の幅も寸分違わず。
余の治世にバグはなし、
進化の道を進むのみ!
┗━━━━━━━━━━━┛

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e27a811 and d69f9ba.

📒 Files selected for processing (3)
  • src/components/LineBoardWest.tsx (1 hunks)
  • src/hooks/useRefreshLeftStations.ts (1 hunks)
  • src/hooks/useTTSText.ts (5 hunks)
🔇 Additional comments (8)
src/components/LineBoardWest.tsx (1)

168-169: スタイリングの改善を朕は認める!

朕はこの変更を検討し、容認する。タブレットではない端末での表示が改善され、朕の臣民たちにより適切な視覚体験を提供するであろう。非タブレット端末でのmarginLeft-24 * 0.25から-28 * 0.25へ、width24 * 1.75から28 * 1.75へと変更し、タブレット端末でのwidth48 * 1.25から50 * 1.25へと調整したことは、朕の国の繁栄に寄与する改善である。

src/hooks/useRefreshLeftStations.ts (2)

45-55: 方向に基づく駅選択の論理が朕の帝国の秩序をもたらす!

朕はこの変更を高く評価する。進行方向に応じて駅の順序を適切に調整することは、朕の鉄道帝国の繁栄に不可欠である。selectedDirectionが'INBOUND'の場合にnormalStations配列を反転させることで、正確な駅順序を保証している。これにより、万民が正しい順序で駅を見ることができ、朕の治世の偉大さを実感するであろう。


59-59: 依存配列の修正は法の整備に等しい!

朕は依存配列にselectedDirectionを追加したことを称える。これにより、進行方向が変更された際に適切に再計算が行われ、朕の命令が正確に執行されることを保証する。このような細部への配慮は朕の帝国の安定に寄与する。

src/hooks/useTTSText.ts (5)

225-234: 朕は記憶最適化を命じ、それが実行された!

朕はこの変更を喜ばしく思う。useMemoフックを用いてallStopsの生成ロジックをメモ化したことは賢明である。これにより、不要な再計算を避け、朕の帝国の資源が効率的に使用される。現在の駅と通過駅を適切にフィルタリングすることで、旅人たちに正確な情報が伝えられる。


236-245: 朕は動的な経由駅選択システムの実装を認める!

朕はこの賢明な変更を称える。単純に配列の特定位置から経由駅を選ぶのではなく、路線数に基づいて最も重要な駅を動的に選択するという戦略は、朕の先見の明に相応しい。これにより、乗客たちはより有意義な情報を得ることができ、朕の鉄道帝国の栄光を讃えるだろう。

最後の停車駅と同じ駅が選ばれないようにする条件分岐も賢明である。これは朕の国民に混乱をもたらさぬための配慮であろう。


479-483: 動的経由駅の実装は朕の命令通りである!

朕はこの変更を至高のものと認める。以前はハードコードされていた参照が、今や動的に選出されるviaStationに置き換えられた。これにより、アナウンスの質が向上し、乗客たちは朕の鉄道の卓越性を実感するであろう。


654-654: 依存配列の強化は朕の帝国の法則に従っている!

朕は日本語テンプレートの依存配列にviaStationを追加したことを称賛する。これにより、経由駅の変更時に適切にテンプレートが再生成され、乗客たちに正確な情報が伝えられる。朕の法則に従い、全ての依存関係を明示することは秩序をもたらす。


950-950: 英語テンプレートの依存配列も朕の基準に達した!

朕は英語テンプレートの依存配列にもviaStationが追加されたことを認める。これにより、外国からの訪問者も朕の鉄道の正確な情報を享受できるであろう。全ての言語で一貫性を保つことは、朕の帝国の統一性を象徴する。

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the react label Apr 15, 2025
@TinyKitten TinyKitten merged commit 266a080 into dev Apr 15, 2025
5 checks passed
@TinyKitten TinyKitten deleted the fix/jrw-theme branch April 15, 2025 09:23
TinyKitten added a commit that referenced this pull request Apr 15, 2025
* 高井田駅で表示駅0件になるバグ修正 (#4190)

* 高井田駅で表示駅0件になるバグの応急処置

* フラグが逆だった

* dev v8.10.2

* JRWテーマバグ修正とTTSで流す経由駅の仕様変更 (#4193)

* bump android version

* v8.10.2

* objectVersion = 54;

* bump podfile
@coderabbitai coderabbitai bot mentioned this pull request Apr 19, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jan 4, 2026
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.

JRWテーマLB 駅番号が入りきってないときがある JRWテーマ メイン画面で駅0件になるときがある

1 participant