Skip to content

feat(client): play-page identity bubble + Streaming Now panel - #4766

Open
Zixer1 wants to merge 6 commits into
openfrontio:mainfrom
Zixer1:feat/streaming-now-helix
Open

feat(client): play-page identity bubble + Streaming Now panel#4766
Zixer1 wants to merge 6 commits into
openfrontio:mainfrom
Zixer1:feat/streaming-now-helix

Conversation

@Zixer1

@Zixer1 Zixer1 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What

The play-page top-strip redesign from the streaming-now work, ported onto current main:

  1. Identity row — flag + tag/username + skin in one surface bubble, with the selected skin/pattern filling the bubble the way the player's territory looks in game (cosmetic-background). Replaces the separate mobile/desktop SELECT FLAG / cosmetics buttons. Flag button goes transparent inside the bubble; username/tag get a text shadow so they stay readable over a skin.
  2. Streaming Now panel (Add a "Streaming Now" tab on the mainpage, showing who is streaming on twitch the game #3485) — compact streamer cards (avatar, platform badge, viewer count) in a fixed-size horizontal slider, each linking out to the stream. Sits as the right column of the top strip, stretched to the news + identity height.

Layout behavior

  • The 2fr/1fr top-strip split only exists while the panel is live (has-[.streaming-live]): when nobody streams, news + identity keep the full row — the page is pixel-identical to having no panel.
  • Desktop only: the panel is hidden below lg and skips polling entirely there.
  • pattern-input became cosmetics-input on main; the identity row uses it, keeping the no-crazygames class and the cosmetics-input-mobile id the iframe rule targets.

Feed

GET /live-streams.json, served like news.json with a bundled off fallback, validated fail-closed (https-only url/avatarUrl and a URL-safe channel charset, so a bad entry can't reach href/src or smuggle path segments into derived watch URLs). Fetches share a 10s timeout. Refreshes every 90s. Filled by the infra side (curated YouTube + a Twitch roster polled via Helix) — openfrontio/infra#480. Until that deploys with its Twitch secrets, the panel simply never shows.

Tests

StreamingNow.test.ts: watch-URL derivation, viewer-count formatting, schema fail-closed cases (unknown platform, malformed channels, non-URL avatar, javascript:/http: schemes), and the bundled fallback shipping disabled. Locally green: prettier, eslint, tsc, vitest (incl. the en.json sort check).

Homepage panel showing who is live playing OpenFront (issue openfrontio#3485): compact
streamer cards (avatar, platform badge, viewers) in a fixed-size horizontal
slider, each linking out to the stream.

Fed by /live-streams.json, served like news.json with a bundled OFF fallback
and validated fail-closed (https-only URLs so an injected entry can't reach
href/src). The list refreshes every 90s while the page is open. The host stays
display:none until at least one stream is live, so the layout is untouched
when nobody is streaming.

The backend side (admin-curated YouTube + a Twitch roster polled via Helix by
a cron) lives in the infra repo; openfrontio/infra#480 completes it.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 720868dc-30ea-443a-9be5-bbf8120af5a7

📥 Commits

Reviewing files that changed from the base of the PR and between d616e18 and da3a24f.

📒 Files selected for processing (8)
  • src/client/Api.ts
  • src/client/FlagInput.ts
  • src/client/UsernameInput.ts
  • src/client/components/CosmeticBackground.ts
  • src/client/components/PlayPage.ts
  • src/client/components/StreamingNow.ts
  • src/core/ApiSchemas.ts
  • tests/client/components/StreamingNow.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/client/FlagInput.ts
  • src/core/ApiSchemas.ts
  • src/client/UsernameInput.ts
  • src/client/components/CosmeticBackground.ts
  • tests/client/components/StreamingNow.test.ts
  • src/client/components/StreamingNow.ts
  • src/client/components/PlayPage.ts

Walkthrough

Adds validated live-stream configuration and fallback loading, then renders a refreshable “Streaming Now” panel with localized labels, platform links, viewer counts, avatars, and tests. It also adds cosmetic background rendering and small input styling updates.

Changes

Streaming Now feature

Layer / File(s) Summary
Live-stream data contract and loading
src/core/ApiSchemas.ts, resources/live-streams.json, src/client/Api.ts
Defines live-stream validation, adds a disabled fallback configuration, and fetches validated data with fallback handling.
Streaming panel and page integration
src/client/components/StreamingNow.ts, src/client/components/PlayPage.ts, resources/lang/en.json
Adds stream refresh, sorted cards, viewer formatting, platform links and icons, localized labels, and page placement.
Streaming panel validation
tests/client/components/StreamingNow.test.ts
Tests URL generation, viewer formatting, schema defaults and rejection rules, and fallback configuration validity.

Cosmetic and input UI updates

Layer / File(s) Summary
Cosmetic background rendering
src/client/components/CosmeticBackground.ts
Loads player skin or pattern cosmetics and renders the selected background while responding to pattern setting changes.
Input appearance updates
src/client/FlagInput.ts, src/client/UsernameInput.ts
Updates button, label, and username input styling classes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PlayPage
  participant StreamingNow
  participant getLiveStreams
  participant live_streams_json as live-streams.json
  PlayPage->>StreamingNow: render streaming-now element
  StreamingNow->>getLiveStreams: refresh stream data
  getLiveStreams->>live_streams_json: fetch configuration
  live_streams_json-->>getLiveStreams: stream configuration
  getLiveStreams-->>StreamingNow: validated streams
  StreamingNow-->>PlayPage: render live stream cards
Loading

Possibly related PRs

Suggested labels: Feature, UI/UX

Suggested reviewers: evanpelle, celant

Poem

Live streams gather in a row,
With viewer counts that neatly glow.
Cosy backgrounds softly appear,
Styled inputs look crisp and clear.
When none are live, the panel sleeps.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: the play-page identity bubble and Streaming Now panel.
Description check ✅ Passed The description matches the changeset and describes the play-page redesign, panel behavior, feed, and tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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.

@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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@src/client/Api.ts`:
- Around line 1098-1116: Add a per-request AbortController in getLiveStreams,
pass its signal to fetch, and ensure the controller is aborted in a finally
block so recurring requests cannot remain pending indefinitely. Preserve the
existing status handling, validation, and liveStreamsFallback behavior.

In `@src/core/ApiSchemas.ts`:
- Around line 576-584: Harden LiveStreamSchema.channel validation before it is
interpolated into platform watch URLs by rejecting URL delimiters and
whitespace, or applying platform-specific Twitch and YouTube channel rules while
preserving valid channels. Add malformed Twitch and YouTube channel cases to
tests/client/components/StreamingNow.test.ts lines 69-102; update
src/core/ApiSchemas.ts lines 576-584 for the schema change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d1facf96-1ca5-4d6c-b5f7-8d5598f9cceb

📥 Commits

Reviewing files that changed from the base of the PR and between 02bf82d and 106eea7.

📒 Files selected for processing (7)
  • resources/lang/en.json
  • resources/live-streams.json
  • src/client/Api.ts
  • src/client/components/PlayPage.ts
  • src/client/components/StreamingNow.ts
  • src/core/ApiSchemas.ts
  • tests/client/components/StreamingNow.test.ts

Comment thread src/client/Api.ts Outdated
Comment thread src/core/ApiSchemas.ts
@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management Jul 29, 2026
Zixer1 added 4 commits July 28, 2026 21:18
- Desktop only: hidden below lg via classes, and the component skips
  polling entirely when connected under the breakpoint.
- Never on CrazyGames: a panel of Twitch/YouTube links is cross-promotion
  to external platforms, which their gameplay requirements prohibit. The
  Steam build keeps it: Valve's link restrictions cover store pages, not
  in-game community links, and the panel serves no ads.
Streams of this game are community content (the same CrazyGames rule that
bans game/platform cross-promotion explicitly allows community links), and
other games on the platform ship the same feature. Only the mobile gate
stays.
…ow design

Restores the full play-page design built on feat/streaming-now, adapted to
current main:

- Identity row: flag + tag/username + skin in one surface bubble, with the
  selected skin/pattern filling the bubble like the player's territory does
  in game (cosmetic-background). Replaces the separate mobile/desktop
  SELECT FLAG / cosmetics buttons; pattern-input became cosmetics-input on
  main, so the row uses that (keeps the no-crazygames class and the
  cosmetics-input-mobile id that the iframe rule targets).
- Top strip: news + identity left, Streaming Now right. The 2fr/1fr split
  only exists while the panel is live (has-[.streaming-live]), so news and
  identity keep the full row when nobody streams. Panel stays desktop-only.
- Flag button goes transparent inside the bubble; username/tag get a text
  shadow so they stay readable over a skin background.
@Zixer1 Zixer1 changed the title feat(client): Streaming Now panel on the play page feat(client): play-page identity bubble + Streaming Now panel Jul 29, 2026

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/client/components/CosmeticBackground.ts`:
- Around line 19-46: Update CosmeticBackground.connectedCallback and load so the
settings-change listener is registered before the initial load, preventing
updates during the request from being missed. Track each load invocation with a
request/version token and apply cosmetic values only when the component is still
connected and the result belongs to the latest active load; invalidate prior
loads on disconnectedCallback so stale results cannot update state after
reconnect or rapid changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e6a23efa-4536-402f-bc9e-97f4a1256428

📥 Commits

Reviewing files that changed from the base of the PR and between d616e18 and 05d4ca5.

📒 Files selected for processing (5)
  • src/client/FlagInput.ts
  • src/client/UsernameInput.ts
  • src/client/components/CosmeticBackground.ts
  • src/client/components/PlayPage.ts
  • src/client/components/StreamingNow.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/client/components/StreamingNow.ts
  • src/client/components/PlayPage.ts

Comment thread src/client/components/CosmeticBackground.ts
- Served-config fetches (featured-stream, live-streams) share one helper with
  a 10s timeout, so a fetch that never settles can't wedge a recurring poll.
- LiveStreamSchema restricts channel to a URL-safe handle charset (no slashes,
  queries, or whitespace), so an entry can't smuggle path/query segments into
  the derived watch URL; tests added.
- CosmeticBackground registers its settings listener before the initial load
  and guards overlapping loads with a generation counter.
@Zixer1

Zixer1 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Labels

None yet

Projects

Status: Development

Development

Successfully merging this pull request may close these issues.

1 participant