Skip to content

Conversation

@ryanbarlow97
Copy link
Contributor

@ryanbarlow97 ryanbarlow97 commented Jan 4, 2026

Description:

Adds a slightly better streamer mode:

Updates text on already existing button within settings:
image

If enabled, by default the "Create Private Lobby" modal will have the ID hidden:
image

It now also has the same button copy/hidden button in the "Join Private Lobby" modal:

Hidden:
image

Displayed:
image

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:

w.o.n

Copilot AI review requested due to automatic review settings January 4, 2026 21:13
@ryanbarlow97 ryanbarlow97 requested a review from a team as a code owner January 4, 2026 21:13
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2026

Warning

Rate limit exceeded

@ryanbarlow97 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 0 minutes and 19 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 76f1bd8 and 3782b4c.

📒 Files selected for processing (1)
  • src/client/JoinPrivateLobbyModal.ts

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The pull request enhances the private lobby creation experience by adding lobby ID visibility controls, clipboard copy functionality, and integrating user preferences. The modal now displays copy feedback and allows users to toggle ID visibility based on saved settings.

Changes

Cohort / File(s) Summary
Translation Updates
resources/lang/en.json
Updated lobby_id_visibility_desc string from "Hide Lobby ID in private lobby creation" to "Hide Lobby ID in private lobbies" for clarity.
Feature Implementation
src/client/JoinPrivateLobbyModal.ts
Integrated UserSettings to load lobbyIdVisibility preference. Added state variables for lobbyIdValue, lobbyIdVisible, and copySuccess. Implemented clipboard copy functionality with success feedback. Reworked UI rendering to conditionally show visibility toggle and copy button when joined, or input/paste button when not joined. Updated lifecycle hooks to load settings on open and reset state on close.
Styling Updates
src/client/styles.css
Changed lobby ID input styling to dark, translucent theme with white text. Increased horizontal padding (10px → 16px), updated border and background to semi-transparent values, added smooth transitions, and introduced hover/focus states with background darkening and border lightening. Added placeholder color styling.

Sequence Diagram

sequenceDiagram
    participant User
    participant Modal as JoinPrivateLobbyModal
    participant Settings as UserSettings
    participant Clipboard

    User->>Modal: Open Modal
    activate Modal
    Modal->>Settings: Fetch lobbyIdVisibility
    Settings-->>Modal: Return setting value
    Modal->>Modal: Initialize UI state<br/>(lobbyIdVisible, copySuccess)
    deactivate Modal
    
    rect rgb(220, 240, 255)
        Note over User,Modal: Lobby ID Display Phase
        alt User not yet joined
            Modal-->>User: Show paste input
        else User joined
            Modal-->>User: Show ID with<br/>visibility toggle & copy
        end
    end

    User->>Modal: Toggle Visibility
    activate Modal
    Modal->>Modal: Update lobbyIdVisible state
    Modal-->>User: Re-render UI
    deactivate Modal

    User->>Modal: Click Copy
    activate Modal
    Modal->>Clipboard: Copy lobby ID to clipboard
    Clipboard-->>Modal: Success
    Modal->>Modal: Set copySuccess flag<br/>Show feedback
    Modal-->>User: Display confirmation
    deactivate Modal
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

Feature - Frontend, UI/UX

Suggested reviewers

  • evanpelle
  • DevelopingTom

Poem

🔐 Hide it or show it, the choice is yours today,
A copy to clipboard in a smooth, swift way,
Dark theme and polish, with hover and glow,
The lobby ID dances—now faster, now slow! ✨

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Improved Streamer Mode' is directly related to the main change: enhancing streamer mode functionality with better UI and text updates.
Description check ✅ Passed The description clearly explains the streamer mode improvements, including text updates, lobby ID visibility toggles, and UI changes across both modals.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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 (3)
src/client/JoinPrivateLobbyModal.ts (3)

83-86: Remove redundant requestUpdate() calls.

Properties decorated with @state() automatically trigger re-renders when their values change. The explicit requestUpdate() call is not needed here.

🔎 Proposed fix
                        @click=${() => {
                          this.lobbyIdVisible = !this.lobbyIdVisible;
-                         this.requestUpdate();
                        }}

Same applies to line 104.


281-290: Consider adding user feedback on copy failure.

The copy operation silently fails if clipboard access is denied. Users might not know why the copy didn't work. A brief error message could improve UX, though this is a nice-to-have.

🔎 Proposed enhancement
  private async copyLobbyId() {
    if (!this.lobbyIdValue) return;
    try {
      await navigator.clipboard.writeText(this.lobbyIdValue);
      this.copySuccess = true;
      setTimeout(() => (this.copySuccess = false), 2000);
    } catch (err) {
      console.error("Failed to copy lobby id: ", err);
+     // Optionally show a brief error state to the user
    }
  }

201-206: Use the UserSettings.lobbyIdVisibility() typed accessor method for consistency.

The UserSettings class provides a lobbyIdVisibility() method that handles the setting key directly. Replace the raw get() call with this method to match the established pattern across the codebase and improve maintainability.

Note: The setting value is correct as-is—true means "visible" (not hidden), matching the default behavior. Do not invert the value.

Suggested fix
  public open(id: string = "") {
-   this.lobbyIdVisible = this.userSettings.get(
-     "settings.lobbyIdVisibility",
-     true,
-   );
+   this.lobbyIdVisible = this.userSettings.lobbyIdVisibility();
    this.copySuccess = false;
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d1e2f5 and 76f1bd8.

📒 Files selected for processing (3)
  • resources/lang/en.json
  • src/client/JoinPrivateLobbyModal.ts
  • src/client/styles.css
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: woodydrn
Repo: openfrontio/OpenFrontIO PR: 1836
File: src/client/Main.ts:482-482
Timestamp: 2025-08-17T20:48:49.411Z
Learning: In PR #1836, user woodydrn prefers to keep changes minimal and focused on the specific issue (clientID persistence) rather than refactoring redundant code in JoinLobbyEvent dispatchers. They want to avoid scope creep in focused bug fix PRs.
Learnt from: ryanbarlow97
Repo: openfrontio/OpenFrontIO PR: 2740
File: src/client/HostLobbyModal.ts:821-821
Timestamp: 2026-01-02T18:11:06.832Z
Learning: In src/client/HostLobbyModal.ts, the `?s=xxxxx` URL suffix in lobby URLs is purely for cache-busting embed previews on platforms like Discord, WhatsApp, and x.com. The suffix value is ignored by the join logic (any value works), so regenerating it on config changes via `updateUrlWithSuffix()` doesn't break existing shared URLs - it only forces platforms to re-fetch updated preview metadata.
📚 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/JoinPrivateLobbyModal.ts
  • src/client/styles.css
📚 Learning: 2026-01-02T18:11:06.832Z
Learnt from: ryanbarlow97
Repo: openfrontio/OpenFrontIO PR: 2740
File: src/client/HostLobbyModal.ts:821-821
Timestamp: 2026-01-02T18:11:06.832Z
Learning: In src/client/HostLobbyModal.ts, the `?s=xxxxx` URL suffix in lobby URLs is purely for cache-busting embed previews on platforms like Discord, WhatsApp, and x.com. The suffix value is ignored by the join logic (any value works), so regenerating it on config changes via `updateUrlWithSuffix()` doesn't break existing shared URLs - it only forces platforms to re-fetch updated preview metadata.

Applied to files:

  • src/client/JoinPrivateLobbyModal.ts
📚 Learning: 2025-06-20T20:11:00.965Z
Learnt from: devalnor
Repo: openfrontio/OpenFrontIO PR: 1195
File: src/client/graphics/layers/AlertFrame.ts:18-18
Timestamp: 2025-06-20T20:11:00.965Z
Learning: In the OpenFrontIO codebase, UserSettings instances are created directly with `new UserSettings()` in each component that needs them. This pattern is used consistently across at least 12+ files including OptionsMenu, EventsDisplay, DarkModeButton, Main, UserSettingModal, UsernameInput, NameLayer, AlertFrame, UILayer, InputHandler, ClientGameRunner, and GameView. This is the established architectural pattern and should be followed for consistency.

Applied to files:

  • src/client/JoinPrivateLobbyModal.ts
📚 Learning: 2025-06-07T19:47:34.514Z
Learnt from: its-sii
Repo: openfrontio/OpenFrontIO PR: 1089
File: src/client/styles/components/setting.css:9-22
Timestamp: 2025-06-07T19:47:34.514Z
Learning: In src/client/styles/components/setting.css, the padding difference between .setting-item and .setting-item-group is intentional - .setting-item-group doesn't need padding for the specific grouped setting styling being implemented.

Applied to files:

  • src/client/styles.css
📚 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-08-16T10:52:08.292Z
Learnt from: TheGiraffe3
Repo: openfrontio/OpenFrontIO PR: 884
File: resources/lang/en.json:456-461
Timestamp: 2025-08-16T10:52:08.292Z
Learning: In OpenFrontIO, translation files in resources/lang/*.json (except en.json) should not be updated in regular PRs. Only dedicated translation PRs titled "mls" and made by Aotumori should update non-English locale files. Regular PRs should only update en.json when adding or modifying translation keys.

Applied to files:

  • resources/lang/en.json
🧬 Code graph analysis (1)
src/client/JoinPrivateLobbyModal.ts (1)
src/core/game/UserSettings.ts (1)
  • UserSettings (6-210)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Deploy to openfront.dev
  • GitHub Check: Agent
🔇 Additional comments (5)
resources/lang/en.json (1)

397-397: LGTM!

The updated text correctly reflects the expanded scope: lobby ID visibility now applies to both creating and joining private lobbies.

src/client/styles.css (1)

543-569: LGTM!

The styling updates are consistent with the existing patterns in this file. The dark translucent theme with smooth transitions matches similar elements like .lobby-id-button and .lobby-id-paste-button.

src/client/JoinPrivateLobbyModal.ts (3)

14-25: LGTM!

State management looks good. The UserSettings instantiation follows the established codebase pattern.


269-274: LGTM!

The method correctly extracts the lobby ID from URLs and synchronizes both the state and input element.


214-223: LGTM!

The cleanup logic properly resets all state and clears the polling interval.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the streamer mode functionality by adding lobby ID visibility controls and copy functionality to the Join Private Lobby modal, bringing it to feature parity with the Create Private Lobby modal. The changes respect user preferences set in the settings menu for hiding lobby IDs.

Key Changes

  • Added visibility toggle and copy functionality for lobby IDs in the Join Private Lobby modal when a lobby has been joined
  • Updated the settings description text to reflect that the "Hidden Lobby IDs" setting now applies to both create and join private lobby modals
  • Improved input field styling with a darker theme, enhanced borders, and smooth hover/focus transitions

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/client/JoinPrivateLobbyModal.ts Added state variables for lobby ID visibility and copy success, implemented conditional rendering to show visibility toggle and copy button after joining a lobby, integrated with UserSettings to respect user preferences
src/client/styles.css Enhanced lobby ID input styling with darker background, refined borders, and added hover/focus state transitions
resources/lang/en.json Updated settings description from "Hide Lobby ID in private lobby creation" to "Hide Lobby ID in private lobbies" to reflect the expanded functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 4, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 4, 2026
@ryanbarlow97 ryanbarlow97 added UI/UX UI/UX changes including assets, menus, QoL, etc. Feature Bugfix Fixes a bug labels Jan 4, 2026
@ryanbarlow97 ryanbarlow97 added this to the v29 milestone Jan 4, 2026
@ryanbarlow97
Copy link
Contributor Author

@iiamlewis do you want it toggled on by default? I don't really see an issue to it being on by default

@VariableVince
Copy link
Contributor

VariableVince commented Jan 5, 2026

@ryanbarlow97 You're not asking me. But I'd definitely not want to have it turned off by default. That will confuse thousands (some asking on discord over and over, others just abandoning the idea of playing with their friends because they can't figure it out and move to the next game) just for saving a few knowing streamers one or two clicks.

Tryout33

@ryanbarlow97
Copy link
Contributor Author

ryanbarlow97 commented Jan 5, 2026

@ryanbarlow97 You're not asking me. But I'd definitely not want to have it turned off by default. That will confuse thousands (some asking on discord over and over, others just abandoning the idea of playing with their friends because they can't figure it out and move to the next game) just for saving a few knowing streamers one or two clicks.

Tryout33

image

really, this is that confusing?

it's a universal thing to have passwords/gameIDs hidden like this

@VariableVince
Copy link
Contributor

@ryanbarlow97 having once worked in customer service and also seeing the many easily answered questions/remarks in the OF discord, yes for some people it can actually be confusing. I'm weighing this against the few streamers the default on setting is meant to serve and from that conclude that it could be counterproductive. But we could choose to fafo it ;)

@ryanbarlow97
Copy link
Contributor Author

@ryanbarlow97 having once worked in customer service and also seeing the many easily answered questions/remarks in the OF discord, yes for some people it can actually be confusing. I'm weighing this against the few streamers the default on setting is meant to serve and from that conclude that it could be counterproductive. But we could choose to fafo it ;)

No, I was just asking as I wanted a consensus, I didn't set it up this way anyway so not a big problem

@iiamlewis
Copy link
Contributor

@ryanbarlow97 can we have it off by default and then toggleable to be turned on

@ryanbarlow97
Copy link
Contributor Author

@ryanbarlow97 can we have it off by default and then toggleable to be turned on

yes thats how it is now :)

@ryanbarlow97
Copy link
Contributor Author

closing because i dont wanna worry about fixing it with the new ui

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

Labels

Bugfix Fixes a bug Feature UI/UX UI/UX changes including assets, menus, QoL, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants