Player: Add OSD clock overlay in fullscreen#1322
Conversation
- useOsdClockSettings hook: localStorage-backed enabled/format/position - ClockOverlay component: ticks every second, Intl.DateTimeFormat for 12h/24h/auto - Settings → Player: new OSD Clock category with toggle + two dropdowns - Player.js: renders ClockOverlay only when fullscreen && enabled Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
happy to reopen your pr if you read how new features should be implemented per repo guidelines thank you |
where can i read "how new features should be implemented"? |
you can check the previous merged prs by other contributors and check stremio-core and other repos under stremio org for more info how stremio works, check contribution guide as well |
Im sorry I didnt find any contribution guide in here. |
profile.settings has no OSD clock fields yet in stremio-core, so this can't be wired through core.transport.dispatch. Use a Context/Provider/ hook (mirrors the Discord RPC precedent's structure) instead of the localStorage-backed useState hook it replaces; settings reset on reload until the fields exist upstream.
…nvention Replace ClockOverlay's custom absolute-positioning CSS with a .clock-overlay-layer class in Player/styles.less, following the same --safe-area-inset-left/right/bottom pattern as .nav-bar-layer and .control-bar-layer. Position (top-left/center/right) is now a modifier class resolved by Player.js, not inline styles. Converts the component to .tsx and has it read settings from useOsdClock() directly.
Replace hardcoded strings ('Show clock', 'Clock format', 'Clock
position', etc.) with SCREAMING_SNAKE_CASE keys passed through t(),
matching every other label in this file. Keys aren't in
stremio-translations yet; i18next falls back to the key string.
|
@kKaskak could you reopen this when you get a chance? I don't have permission to reopen it myself since you closed it, but the branch now has fixes for the points from the earlier review (full details in the updated PR description above):
If anything's still not lining up with repo conventions, I'd really appreciate a pointer to the specific line or pattern you'd want it to follow instead of general guidance — I want to make sure I'm fixing the right thing rather than guessing, and I'm happy to keep iterating on this. |
Summary
Re-submission of the OSD clock overlay for #48 (fullscreen only, with a Settings → Player → Clock overlay section for show/format/position), addressing feedback from the earlier review.
What changed since the last review
localStorageto an in-memory React Context (useOsdClock), structured like the existing Discord RPC feature (Context + Provider + hook, with a sibling purehelpers.tsfor time formatting). This isn't wired throughcore.transport.dispatch/profile.settings— those fields don't exist in stremio-core's RustSettingsstruct yet, and adding them is a separate stremio-core PR. Until then, settings live in React state mounted at the app root (survive navigating in/out of the player, reset on a full page reload) — calling this out explicitly as a deliberate, temporary limitation rather than leaving it implicit.SETTINGS_OSD_CLOCK_*SCREAMING_SNAKE_CASE keys, consistent with every other label inSettings/Player/Player.tsx. Not yet instremio-translations; i18next falls back to the key string..clock-overlay-layerclass inPlayer/styles.less, following the same--safe-area-inset-left/right/bottomconvention as.nav-bar-layer/.control-bar-layer, with position (top-left/center/right) applied as a modifier class instead of inline styles.Files changed
src/common/OsdClock/— new Context/Provider/hook + pure helpers, replacesuseOsdClockSettings.jssrc/routes/Player/ClockOverlay/— rewritten (.tsx) to consume the hook directlysrc/routes/Player/styles.less— adds.clock-overlay-layersrc/routes/Player/Player.js— wires upuseOsdClock()and the layer classNamesrc/routes/Settings/Player/Player.tsx— i18n key labelssrc/App/App.js— mountsOsdClockProvider