Skip to content

Render the garage scene as a responsive card grid on narrow viewports - #27

Open
nice-jan-p wants to merge 5 commits into
issue-17-parking-spots-scenefrom
responsive-spot-cards
Open

Render the garage scene as a responsive card grid on narrow viewports#27
nice-jan-p wants to merge 5 commits into
issue-17-parking-spots-scenefrom
responsive-spot-cards

Conversation

@nice-jan-p

Copy link
Copy Markdown

Description: Render the garage scene as a responsive card grid on narrow viewports
Possible impact: Parking scene view, mobile layout, reservation flow, global CSS, fonts


Summary

Built with Claude Code from the parking-responsive-design/ handoff (kept untracked). Below 700px the wide garage illustration is unusable, so the "New design" scene variant now reflows into a fluid grid of spot cards; at ≥700px the wide stage renders exactly as before. Both renderings are always in the DOM and CSS media queries pick one, so SSR and client always agree. The classic grid variant is untouched.

  • Each 200px card crops the same garage artwork (/parking-bg.jpg) at its bay's real horizontal position (per-floor background-size, per-bay pan percentage), so each spot keeps its recognizable surroundings.
  • The outlined bay number reuses the scene's SVG halo technique and the wall-paint colors already sampled in BAY_LAYOUT.
  • Cars are the existing tintable SVG sprites (--car-hue, per-bay side/flip) instead of the prototype's CSS-drawn car.
  • One-tap interaction matching the scene: tap a free card to park, tap your own card to leave; other people's cards are inert (aria-disabled). Your spot gets a green YOURS badge and a sticky bottom bar with Cancel; the page-level reservation banner is suppressed only while the card view is active.
  • Real-time change glow and conflict shake mirror the scene; prefers-reduced-motion disables the animations.
  • English copy matching the app, keeping the "PODLAŽÍ -1/-2" floor badges (they mirror the artwork) and the "Park here" CTA.

Changes Made

  • Added: src/components/parking-cards/parking-cards.tsx — the card grid + sticky my-spot bar
  • Added: src/components/parking-cards/card-data.ts — pure helpers (artwork crop, floor grouping, labels), unit-tested in card-data.test.ts
  • Modified: src/components/parking-scene/parking-scene.tsx — car SVG defs hoisted out of the stage (so <use> resolves while the stage is hidden), cards mounted
  • Modified: src/global.css — design tokens + parking-cards section, 700px breakpoint
  • Modified: src/root.tsx — Baloo 2 + Nunito via Google Fonts

Test Plan

  • npm test — 98 tests green (12 new for card-data)
  • npm run lint and npm run build
  • Verified in a headless browser at 320 / 360 / 414 / 640 / 699 / 701 / 768 / 1024 px — correct crops and columns, clean flip at the breakpoint, desktop scene unchanged
  • Reserve → YOURS badge + sticky bar → Cancel releases; grid variant unaffected; no console errors

nice-jan-p and others added 5 commits July 30, 2026 16:23
Replace the CSS-grid of square spot-cards with a cartoon-garage scene:
cars parked in the painted bays of a fixed background illustration,
coloured per occupant, with name chips and dashed 'Park here' markers on
free bays. Interaction is self-service (click a free bay to park yourself,
click your own car to leave).

- new ParkingScene component (same prop contract as the old SpotsGrid)
- pure, unit-tested scene-data helpers (bay layout map, name parsing,
  deterministic per-name hue, inlined car SVG <defs>)
- background art + car SVGs added as assets
- unmapped spots fall back to a compact card strip so none are hidden
…wports

Below 700px the wide garage illustration is unusable, so the scene design
now reflows into a fluid grid of spot cards (repeat(auto-fill, minmax(148px,
1fr))). Each card crops the same garage artwork at its bay's real horizontal
position, draws the outlined bay number in the colors painted on the wall,
and reuses the tintable car SVGs. Tapping a free card parks you, tapping
your own card leaves, and a sticky bottom bar shows your reservation with a
Cancel action. The wide stage is untouched on desktop; CSS media queries
pick which rendering is visible, so SSR and client always agree.
@nice-jan-p
nice-jan-p marked this pull request as ready for review September 1, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant