mirror of
https://github.com/TheRealOwenRees/chess-endgame-trainer.git
synced 2026-11-18 03:32:06 +00:00
landing page (#63)
* remove daisyui and rebuild styles * very basic setup of new design - missing components etc * basic navbar with reusable landing components * basic puzzle of the day * update todos * update todos * add curated landing puzzle cards with selectable board (#55) * update with footer * add button to solve today's puzzle * Make landing page a dead view Render the home page from PageController with a static board preview, link puzzle cards and CTAs to public-code play routes, count puzzles from the DB, and add a global footer. * Serve a marketing-only JS bundle on the landing page Build a small marketing entry point with phoenix_html and the plain-DOM navbar, select it on controller-rendered pages, and keep the full LiveView bundle for LiveView pages. * Add landing page SEO metadata Replace the Phoenix default title with a descriptive Lucid Chess title, and add description, canonical, Open Graph, and Twitter card tags to the landing page. * Complete the hero copy block Add the spark icon primitive and the Endgames, made clear eyebrow. The primary CTA keeps linking to the active puzzle rather than scrolling to the board. * Add a persisted global daily puzzle Assign one endgame per UTC day in a daily_puzzles table with a unique date, preferring endgames unused in the last 30 days and falling back to any. Concurrent first requests insert with on-conflict-ignore and read the winning row. The landing board now shows the daily puzzle. * remove unused CSS, nav links, time pill * allow devices to connect to dev server by changing IP address to 0.0.0.0 * Restore the colour-mode switch and add a dark palette * Use brand colour tokens on the play page * self host fonts - closes issue #62 * begin splitting CSS into modules * remove hover on hero chessboard, split more css modules * remove interactivity from hero chessboard * update todo
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# The landing page is a server-rendered dead view
|
||||
|
||||
The marketing home page is a controller-rendered page (a "dead view") rather
|
||||
than a LiveView. It shows a static board preview of the first curated endgame
|
||||
and links to `/endgames/<public code>/play`; the puzzle is not playable on the
|
||||
home page. Curated puzzle cards are ordinary links, and the puzzle count in the
|
||||
learning strip is read from the database on each request.
|
||||
|
||||
LiveView renders its first response on the server too, so the SEO argument is
|
||||
mostly about certainty: a dead view guarantees crawlers receive a complete
|
||||
document without a websocket connecting. It also drops the LiveSocket round
|
||||
trip and live-diff overhead from the page whose job is to be fast and
|
||||
indexable. The cost is losing the interactive demo: visitors must follow a
|
||||
link to try a puzzle, which is where attempts are recorded anyway.
|
||||
|
||||
## Consequences
|
||||
|
||||
- `HomeLive` and `HomeBoardComponent` are removed; all solving happens on
|
||||
`/endgames/:public_code/play`.
|
||||
- The board on the home page is `LandingComponents.board_preview/1` and is
|
||||
deliberately inert.
|
||||
- The "Try today's puzzle", "Begin with the basics", and each puzzle card link
|
||||
straight to the first/selected endgame's player URL, using its public code.
|
||||
- The puzzle count is request-time, not baked at build time, so it cannot go
|
||||
stale between deploys.
|
||||
- If the page feels slow in practice, the next step is a lighter
|
||||
marketing-only JS bundle without the LiveSocket — deferred until measured.
|
||||
@@ -0,0 +1,40 @@
|
||||
# Colour modes use a branded-inverse palette with role tokens
|
||||
|
||||
UI colour mode (`system`, `light`, `dark`) is a per-browser preference stored in
|
||||
`localStorage["phx:theme"]`; `system` follows `prefers-color-scheme` and updates
|
||||
live when the OS setting changes. The switch lives in the navbar
|
||||
(`Layouts.colour_mode_toggle/1`) and the mode is applied before first paint by
|
||||
the inline script in `root.html.heex`.
|
||||
|
||||
Dark mode is a branded inverse of the landing page's paper/ink/mint/coral
|
||||
palette, not Phoenix's stock slate. The raw swatches are role-overloaded —
|
||||
`--ink` is both body text and the fill behind white text; `--coral-dark` is both
|
||||
small text on paper and the hover fill under white text — so `app.css` defines a
|
||||
role layer (`--color-canvas`, `--color-body`, `--color-coral-control`, …) that
|
||||
templates and stylesheets use. A colour mode overrides only the roles; light
|
||||
mode reads them from the raw palette. The roles are exposed as `--color-*`, so
|
||||
they also generate Tailwind utilities (`bg-canvas`, `text-muted`,
|
||||
`border-hairline`) for templates that use utilities instead of named classes.
|
||||
|
||||
The chessboard is deliberately excluded. Chessground's brown board and cburnett
|
||||
pieces stay identical in both modes, as does the landing-page preview board.
|
||||
The board is content: recolouring it would make the same position look
|
||||
different without helping the player, and the piece SVGs are tuned for the
|
||||
brown board. Only the furniture around it — frame, time pill, promotion
|
||||
picker — adapts.
|
||||
|
||||
## Consequences
|
||||
|
||||
- Adding or changing a colour mode means redefining role values, not hunting
|
||||
selectors. Templates and `app.css` never reference the raw swatches.
|
||||
- The Phoenix semantic tokens (`primary`, `base-*`, `accent`, …) are retuned to
|
||||
the brand in both modes, so admin and auth screens do not turn blue in dark
|
||||
mode. The missing `warning` and `error` dark values are now defined.
|
||||
- Content colours (`--color-board-*`, `--color-piece-*`,
|
||||
`--color-on-deep-*`) are intentionally identical across modes.
|
||||
- The admin preview board (`assets/css/_board.css`) was left out of scope; it
|
||||
remains light-only until revisited.
|
||||
- Light-mode WCAG contrast failures are a knowing deferral, tracked in #61. The
|
||||
role split means fixing them is a value change, not a refactor.
|
||||
- The GDPR/ePrivacy position for the `localStorage` preference is tracked in
|
||||
#60.
|
||||
Reference in New Issue
Block a user