feat(theme): vote-leader auto-accent extension - #2
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the night-sync theme extension for the personalization batch:
packages/web/src/lib/theme/extensions/vote-leader.ts(+ colocated tests). Default export{ key: "vote-leader", useAccentOverride }, where the hook signature isuseAccentOverride(active: boolean = true): string | null— the engine calls it unconditionally on every provider render asuseAccentOverride(config.accentMode === "night-sync"), so rules-of-hooks hold in every mode while the fetch only fires when night-sync is actually on.useAccentOverride(active)returns theaccentHexof the nearest locked night (today or later) whose night vote has a leader (topGameSlug), resolved through the game registry, elsenull. It sharesqk.calendarLocks()+fetchCalendarLockswith existing consumers (5-minute staleTime restated), and the query isenabled: !!user && active— logged-out users and non-night-sync accent modes never hit the API. Deliberately reads only the night vote — the purchase-poll tally is hidden from non-admin clients.Dead code until the theme engine (
batch/theme-engine) lands its extension discovery (import.meta.glob("./extensions/*.ts{,x}"), excluding*.test.*per coordinator); seeded-QueryClient hook tests + typecheck are the acceptance.🤖 Generated with Claude Code
https://claude.ai/code/session_011r16ejkf3HB6tyZfTeA3Eb