Skip to content

Conversation

@Aotumuri
Copy link
Member

Description:

This PR removes the remaining keybind explanations from the HelpModal and replaces them with a short description and a button that directs users to the keybind settings.

Following the previous PR that made fixed keybinds configurable, this change completes the HelpModal cleanup by no longer duplicating keybind information in help text.

Instead of listing individual keybinds, the HelpModal now guides users to the Keybinds tab in Settings, where the full and up-to-date list of bindings can be viewed and customized.

This helps:

  • Keep the HelpModal lightweight and easier to maintain
  • Avoid outdated or incorrect keybind information in help text
2026-01-13.21.46.37.mov

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced

Please put your Discord username so you can be contacted if a bug or regression is found:

aotumuri

@CLAassistant
Copy link

CLAassistant commented Jan 13, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ evanpelle
❌ Aotumuri
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 13, 2026

Walkthrough

Refactors HelpModal to remove internal keybind parsing and rendering, delegating keybinds access to the user settings modal. Adds three English localization strings for a new keybinds subsection and a method on UserSettingModal to open the keybinds tab.

Changes

Cohort / File(s) Summary
Localization Strings
resources/lang/en.json
Added three new translation keys under help_modal: keybinds_title, keybinds_desc, keybinds_button.
Help Modal Refactor
src/client/HelpModal.ts
Removed keybinds parsing, normalization, state and table rendering; deleted onOpen() lifecycle hook and helper functions; added openSettingsModal() to open settings or navigate to settings page; updated template to show description + button.
User Settings Modal
src/client/UserSettingModal.ts
Added public openKeybindsTab() to set activeTab = "keybinds" and open the modal.

Sequence Diagram

sequenceDiagram
    actor User
    participant HelpModal
    participant UserSettingModal
    participant UI

    User->>HelpModal: Click "Keybinds" button
    HelpModal->>HelpModal: openSettingsModal()
    alt UserSettingModal available
        HelpModal->>UserSettingModal: openKeybindsTab()
        UserSettingModal->>UserSettingModal: set activeTab = "keybinds"
        UserSettingModal->>UI: render modal with keybinds tab
    else Fallback
        HelpModal->>UI: navigate to settings page
    end
    UI-->>User: show settings/keybinds UI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🔑 Help modal points the way, not the map,
A button now bridges the settings gap,
Keys live in one simple, tidy spot—
Click, open, adjust, and you’re all set! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: replacing keybind explanations in HelpModal with a settings link, which matches the core objectives of the PR.
Description check ✅ Passed The description is well-related to the changeset, explaining the motivation (avoiding duplication and outdated info), the implementation approach (directing users to Settings), and the benefits (maintainability and lightweight HelpModal).
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.


🧹 Recent nitpick comments
src/client/HelpModal.ts (1)

11-25: Good fallback chain for opening settings.

The progressive fallback (openKeybindsTabopenshowPage) handles different states well. One small note: if all three options fail, the user gets no feedback. Consider logging a warning or showing a toast in that case.

Optional: Add fallback warning
   private openSettingsModal = () => {
     const settingsModal = document.querySelector("user-setting") as {
       open?: () => void;
       openKeybindsTab?: () => void;
     } | null;
     if (settingsModal?.openKeybindsTab) {
       settingsModal.openKeybindsTab();
       return;
     }
     if (settingsModal?.open) {
       settingsModal.open();
       return;
     }
-    window.showPage?.("page-settings");
+    if (window.showPage) {
+      window.showPage("page-settings");
+    } else {
+      console.warn("Could not open settings modal or page");
+    }
   };

📜 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 a19141a and 1623729.

📒 Files selected for processing (2)
  • src/client/HelpModal.ts
  • src/client/UserSettingModal.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/client/UserSettingModal.ts
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
📚 Learning: 2025-06-09T02:20:43.637Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

Applied to files:

  • src/client/HelpModal.ts
📚 Learning: 2026-01-12T21:37:01.156Z
Learnt from: FloPinguin
Repo: openfrontio/OpenFrontIO PR: 2874
File: src/server/MapLandTiles.ts:7-11
Timestamp: 2026-01-12T21:37:01.156Z
Learning: In this repository's OpenFrontIO deployment, inter-service HTTP calls to the master should target http://localhost:3000 (master at port 3000) as the canonical address. Apply this as the standard for all server-side TypeScript code that communicates with the master. Avoid hardcoding non-master URLs; centralize the master address (e.g., via config or env) when possible, and ensure internal service communication uses localhost:3000 in this architecture.

Applied to files:

  • src/client/HelpModal.ts
🧬 Code graph analysis (1)
src/client/HelpModal.ts (2)
src/client/LangSelector.ts (1)
  • translateText (276-300)
src/client/Utils.ts (1)
  • translateText (165-224)
🔇 Additional comments (2)
src/client/HelpModal.ts (2)

85-98: LGTM - Clean keybinds section.

The new lightweight keybinds section with description and settings button is well-structured. Translation keys are used properly, and styling is consistent with adjacent sections.


85-98: Address reviewer feedback: mouse-action explanatory images.

Per PR discussion, VariableVince and ryanbarlow97 noted that explanatory images for mouse actions (right/left click, wheel scroll, modifiers) were removed. These static instructions help users understand basic controls and are not duplicated by configurable keybinds.

Consider either:

  1. Keeping these mouse-action images in the HelpModal alongside the new settings link, or
  2. Adding them to the Keybinds Settings tab as the reviewers suggest.

This feedback should be addressed before merging.

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/client/HelpModal.ts (1)

11-25: Consider closing HelpModal before opening settings.

The fallback chain is well-structured. However, when opening the settings modal, the HelpModal stays open. This could cause modal stacking issues where both modals are visible at the same time.

Suggested fix
 private openSettingsModal = () => {
+  this.close();
   const settingsModal = document.querySelector("user-setting") as {
     open?: () => void;
     openKeybindsTab?: () => void;
   } | null;
   if (settingsModal?.openKeybindsTab) {
     settingsModal.openKeybindsTab();
     return;
   }
   if (settingsModal?.open) {
     settingsModal.open();
     return;
   }
   window.showPage?.("page-settings");
 };
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed3c7b1 and a19141a.

📒 Files selected for processing (3)
  • resources/lang/en.json
  • src/client/HelpModal.ts
  • src/client/UserSettingModal.ts
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
📚 Learning: 2026-01-12T21:37:01.156Z
Learnt from: FloPinguin
Repo: openfrontio/OpenFrontIO PR: 2874
File: src/server/MapLandTiles.ts:7-11
Timestamp: 2026-01-12T21:37:01.156Z
Learning: In this repository's OpenFrontIO deployment, inter-service HTTP calls to the master should target http://localhost:3000 (master at port 3000) as the canonical address. Apply this as the standard for all server-side TypeScript code that communicates with the master. Avoid hardcoding non-master URLs; centralize the master address (e.g., via config or env) when possible, and ensure internal service communication uses localhost:3000 in this architecture.

Applied to files:

  • src/client/UserSettingModal.ts
  • src/client/HelpModal.ts
📚 Learning: 2025-06-02T14:27:37.609Z
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.

Applied to files:

  • resources/lang/en.json
📚 Learning: 2025-06-09T02:20:43.637Z
Learnt from: VariableVince
Repo: openfrontio/OpenFrontIO PR: 1110
File: src/client/Main.ts:293-295
Timestamp: 2025-06-09T02:20:43.637Z
Learning: In src/client/Main.ts, during game start in the handleJoinLobby callback, UI elements are hidden using direct DOM manipulation with classList.add("hidden") for consistency. This includes modals, buttons, and error divs. The codebase follows this pattern rather than using component APIs for hiding elements during game transitions.

Applied to files:

  • src/client/HelpModal.ts
🧬 Code graph analysis (1)
src/client/HelpModal.ts (2)
src/client/LangSelector.ts (1)
  • translateText (276-300)
src/client/Utils.ts (1)
  • translateText (165-224)
🔇 Additional comments (4)
resources/lang/en.json (1)

62-64: New translation keys look good.

The three new keys (keybinds_title, keybinds_desc, keybinds_button) follow the existing naming pattern and provide clear, user-friendly text. The British spelling "customisable" is consistent.

Note: The old hotkeys key at line 61 may now be unused. Consider removing it in a follow-up cleanup if confirmed dead.

src/client/HelpModal.ts (2)

51-98: Clean UI update for the keybinds section.

The simplified keybinds section replaces the old table with a brief description and action button. The styling is consistent with other sections, and translation keys are used correctly. Good use of type="button" for accessibility.


1-7: Import cleanup is correct.

Removed the state decorator import since keybinds state management was moved out. The remaining imports are all used.

src/client/UserSettingModal.ts (1)

952-956: Simple and effective method for direct keybinds tab access.

The openKeybindsTab() method cleanly sets the active tab before opening, ensuring users land directly on the keybinds settings. This follows good composition patterns - the HelpModal delegates navigation to this modal rather than duplicating keybind rendering.

@VariableVince
Copy link
Contributor

VariableVince commented Jan 13, 2026

@Aotumuri @ryanbarlow97 What about the explanatory pictures of a right or left mouse click, or mouse wheel scroll or click, or mouse click combined with a key? Those were there to actually instruct, to help. I'd say we need those pictures in Keybinds Settings if not in Instructions anymore

@VariableVince
Copy link
Contributor

Screenshot_20260113_135701_Vivaldi
Screenshot_20260113_135847_Vivaldi

@ryanbarlow97
Copy link
Contributor

Screenshot_20260113_135701_Vivaldi Screenshot_20260113_135847_Vivaldi

Yes agree, I think if needed we can move some static ones into there for now and then in another PR make them customisable?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants