Skip to content

Conversation

@ryanbarlow97
Copy link
Contributor

Description:

adds a hash for #news

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

@ryanbarlow97 ryanbarlow97 changed the title news url e.g. openfront.io/#news news url (openfront.io/#news) Jan 18, 2026
@ryanbarlow97 ryanbarlow97 added the UI/UX UI/UX changes including assets, menus, QoL, etc. label Jan 18, 2026
@ryanbarlow97 ryanbarlow97 added this to the v30 milestone Jan 18, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 18, 2026

Walkthrough

Adds News page routing with URL hash management. Multiple components detect and handle the #news hash: setting it when showing the news page, clearing it when navigating away, and routing back to the news page when closing modals in news context.

Changes

Cohort / File(s) Summary
Modal close handlers with hash management
src/client/JoinPrivateLobbyModal.ts, src/client/NewsModal.ts, src/client/components/BaseModal.ts
Each modal's close handler now checks the URL hash to determine the navigation target. If hash starts with #news or #page-news, they preserve the news context; otherwise they follow default behavior. JoinPrivateLobbyModal skips URL reset when in news context, NewsModal adds onClose() to clean hash, BaseModal routes to page-news instead of page-play when hash indicates news context.
Main application routing and initialization
src/client/Main.ts, src/client/Navigation.ts
Main.ts adds NewsModal integration and imports; detects #news hash during URL handling to route to news page. Navigation.ts implements hash management for news page: sets #news when showing news page, clears hash when leaving news, and respects hash on startup to select correct initial page.

Sequence Diagram

sequenceDiagram
    participant User
    participant Browser as Browser/URL
    participant Navigation
    participant Main as Main (Client)
    participant NewsModal
    participant BaseModal

    User->>Browser: Navigate with `#news` hash
    Browser->>Main: handleUrl() with `#news` detected
    Main->>Navigation: showPage("page-news")
    Navigation->>Browser: Set URL hash to `#news`
    Navigation->>Main: page-show dispatch

    User->>NewsModal: Open news
    NewsModal->>Navigation: showPage("page-news")
    Navigation->>Browser: Ensure hash is `#news`

    User->>NewsModal: Close modal
    NewsModal->>NewsModal: onClose()
    NewsModal->>Browser: Check hash starts with `#news`
    NewsModal->>Browser: Reset state, remove `#news` hash

    User->>BaseModal: Close modal in news context
    BaseModal->>Browser: Check hash for `#news` or `#page-news`
    BaseModal->>Navigation: showPage("page-news")
    Navigation->>Browser: Maintain `#news` hash
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🗞️ A news page springs to life today,
With hashes marking out the way,
Close a modal, hash takes flight,
News context keeps the route in sight!
Navigation flows so clean and bright. 📰

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly corresponds to the main change: adding a hash-based URL route for the news page (#news).
Description check ✅ Passed The description accurately describes the core purpose of the changeset: adding a hash route for #news, with confirmations of screenshots, translations, and tests.

✏️ Tip: You can configure your own custom pre-merge checks in the 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.

@ryanbarlow97 ryanbarlow97 marked this pull request as draft January 20, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UI/UX UI/UX changes including assets, menus, QoL, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants