feat(featured-stream): mobile flick-to-dismiss - #4673
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughFeaturedStream now supports touch flick-to-dismiss behavior. Dismissal lasts for the current page visit, removes the panel, tears down Twitch playback, and prevents later remounting or re-probing. The viewport helper and boundary behavior are tested. ChangesFeatured stream dismissal
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant FeaturedStream
participant TwitchPlayer
User->>FeaturedStream: Drag panel beyond viewport edge
FeaturedStream->>FeaturedStream: Check isOffFrame
FeaturedStream->>FeaturedStream: Dismiss panel
FeaturedStream->>TwitchPlayer: Tear down player
FeaturedStream-->>User: Render no panel
Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
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/FeaturedStream.ts`:
- Around line 335-342: Update the pointer event wiring so pointer cancellation
no longer invokes onDragUp(). Add a dedicated cancel handler that only clears
the active drag state, without running dismiss or stream-opening logic, while
preserving onDragUp() for normal pointer releases.
- Around line 356-367: Update dismiss() to invalidate callbacks from the current
player before or during teardown, either by incrementing mountGen or ensuring
callbacks reject when dismissed. Preserve the existing timer cleanup and
teardownPlayer behavior so delayed fresh() callbacks cannot return true or
recreate recheckTimer after dismissal.
🪄 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
Run ID: 02edf5a2-9c5d-4a57-ba7d-7d0e83de0118
📒 Files selected for processing (2)
src/client/FeaturedStream.tstests/client/components/FeaturedStream.test.ts
69fcf08 to
13ee1f0
Compare
On touch devices, dragging the featured-stream panel off the edge of the screen hides it for the current page visit. Not persisted, so it returns on the next load or refresh. Desktop is unchanged (the same drag still snaps to the nearest corner). Dismiss tears down the Twitch player and stops re-probing, so nothing keeps streaming behind a hidden panel, and leaving a game won't resurrect it.
13ee1f0 to
eae5573
Compare
On touch devices, dragging the featured-stream panel off the edge of the
screen dismisses it for the current page visit. Desktop is unchanged:
the same drag still snaps to the nearest corner, exactly as today.
On small screens the panel can get in the way. This gives mobile users a
quick, familiar "flick it away" gesture to hide it, without a persistent
opt-out they might set once and forget.
- **Touch only**, gated on `matchMedia("(pointer: coarse)")`. Mouse
users keep corner-snap.
- **Trigger:** on drag release, if the panel's center has left the
viewport (more than half of it is off-screen), it is dismissed.
- **Not persisted.** Dismiss is in-memory only, so a refresh or the next
visit brings the panel back. It's a "not now", not a permanent hide.
- Dismiss tears down the Twitch player and stops the offline re-probe,
so nothing keeps streaming behind a hidden panel, and leaving a game
does not resurrect it.
Added unit coverage for the new pure `isOffFrame(cx, cy, vw, vh)` helper
(inside the viewport vs past each edge). Existing FeaturedStream tests
still pass.
Follow-up to #4335 (now merged).
… lobby wait (#4698) Three related changes to the homepage featured-stream panel. ## 1. Exclude the embed off the open web (ToS) Never mount the Twitch embed on **CrazyGames** or the **desktop (Steam) shell**, and never load the Twitch SDK there. Matches how the app already suppresses its own promos off-web via `window.adsEnabled`: - **CrazyGames:** [only SDK-served ads are allowed](https://docs.crazygames.com/requirements/ads/) and no external cross-promotion; a Twitch embed serves Twitch's own ads and is third-party content. - **Steam:** Steam [does not support advertising models in games](https://partner.steamgames.com/doc/marketing/advertising); a live Twitch player carries Twitch ad breaks, and the desktop shell can't satisfy Twitch's `parent`-domain requirement. ## 2. Close button for ad-free users Ad-free users (any shop purchase makes a user `adfree` for life, which zeroes `window.adsEnabled`) get an `×` in the minimized bar. The close is remembered **for the current day** (the day is stored in `localStorage`), so the panel stays gone across reloads that day and resets for the next day's stream. Ad-supported users keep minimize only; their mobile flick stays session-only. The minimized state is scoped to the day the same way. ## 3. Keep the panel through the lobby wait The panel used to hide the moment you joined a lobby (`join-lobby`). Now it stays up through the **queue/lobby wait** and hides only once the game actually starts. `Main.ts` dispatches a new `game-starting` event at `prestart` (the real start moment); the panel hides on that instead of on `join-lobby`, and reappears on `leave-lobby`. > Heads-up for maintainers: (1) and (2) couple this OFM widget to OF's own ad/entitlement signals (`crazyGamesSDK.isOnCrazyGames()`, `isDesktopShell()`, `window.adsEnabled`); (3) adds a small shared `game-starting` document event in `Main.ts`. Flagging in case you'd rather gate/signal differently. ## Tests Verified locally: prettier, eslint, tsc, tests all green. Reuses the existing `common.close` i18n key (no locale-file changes). Follow-up to #4335 / #4673. Sizing (Twitch's 400×300 minimum) landed in #4696.
… lobby wait (#4698) Three related changes to the homepage featured-stream panel. ## 1. Exclude the embed off the open web (ToS) Never mount the Twitch embed on **CrazyGames** or the **desktop (Steam) shell**, and never load the Twitch SDK there. Matches how the app already suppresses its own promos off-web via `window.adsEnabled`: - **CrazyGames:** [only SDK-served ads are allowed](https://docs.crazygames.com/requirements/ads/) and no external cross-promotion; a Twitch embed serves Twitch's own ads and is third-party content. - **Steam:** Steam [does not support advertising models in games](https://partner.steamgames.com/doc/marketing/advertising); a live Twitch player carries Twitch ad breaks, and the desktop shell can't satisfy Twitch's `parent`-domain requirement. ## 2. Close button for ad-free users Ad-free users (any shop purchase makes a user `adfree` for life, which zeroes `window.adsEnabled`) get an `×` in the minimized bar. The close is remembered **for the current day** (the day is stored in `localStorage`), so the panel stays gone across reloads that day and resets for the next day's stream. Ad-supported users keep minimize only; their mobile flick stays session-only. The minimized state is scoped to the day the same way. ## 3. Keep the panel through the lobby wait The panel used to hide the moment you joined a lobby (`join-lobby`). Now it stays up through the **queue/lobby wait** and hides only once the game actually starts. `Main.ts` dispatches a new `game-starting` event at `prestart` (the real start moment); the panel hides on that instead of on `join-lobby`, and reappears on `leave-lobby`. > Heads-up for maintainers: (1) and (2) couple this OFM widget to OF's own ad/entitlement signals (`crazyGamesSDK.isOnCrazyGames()`, `isDesktopShell()`, `window.adsEnabled`); (3) adds a small shared `game-starting` document event in `Main.ts`. Flagging in case you'd rather gate/signal differently. ## Tests Verified locally: prettier, eslint, tsc, tests all green. Reuses the existing `common.close` i18n key (no locale-file changes). Follow-up to #4335 / #4673. Sizing (Twitch's 400×300 minimum) landed in #4696.
What
On touch devices, dragging the featured-stream panel off the edge of the screen dismisses it for the current page visit. Desktop is unchanged: the same drag still snaps to the nearest corner.
Why
On small screens the panel can get in the way. This gives mobile users a quick "flick it away" gesture to hide it, without a persistent opt-out they might set once and forget.
Behavior
matchMedia("(pointer: coarse)"). Mouse users keep corner-snap.Tests
Added unit coverage for the pure
isOffFramehelper. Existing FeaturedStream tests pass.Follow-up to #4335 (merged).