Commit Graph

31 Commits

Author SHA1 Message Date
Samuel Enocsson 96edc606d3 fix: offer refresh button when round history is empty
When a player has rating_history (graph) but no round_history (per-round
detail), calculating a target produced a dead-end error. Now the modal
detects the NO_ROUNDS case and shows a button that triggers the existing
refresh-round-history endpoint and re-runs the calculation on success.
Handles the 24h rate-limit and other refresh errors explicitly.
2026-05-22 13:32:02 +02:00
Samuel Enocsson 1e66b9f94f feat: add target rating calculator (#2) 2026-05-22 13:21:41 +02:00
Samuel Enocsson fba1bea247 refactor: address review feedback — extract date helper, rename listener 2026-05-22 11:47:47 +02:00
Samuel Enocsson a63da6f3ca fix: preload player rating history to fix first-click chart render (#10) 2026-05-22 11:41:38 +02:00
Samuel Enocsson 15adddc2f1 re-swap table after refresh for consistent in-place updates
Release Please / release-please (push) Failing after 44s
Release Please / docker (push) Has been skipped
2026-05-21 16:11:32 +02:00
Samuel Enocsson b6c674e4c7 wire refresh button to update both rating and prediction 2026-05-21 16:04:15 +02:00
Samuel Enocsson 4b145094bf render flat delta pill for null values per design spec 2026-05-21 15:51:17 +02:00
Samuel Enocsson 96ae7d7dac fix CSS for rating row 2026-05-21 15:33:21 +02:00
Samuel Enocsson 9feb5c2c43 fix: remove sticky thead — overlapped table toolbar (#4)
The thead had position: sticky; top: var(--topbar-height), pinning it
to 64px from the viewport. Inside the new .table-card with a toolbar
above, this pulled the header up out of its natural flow and overlapped
the toolbar and first data row. Let thead flow normally — design
doesn't require sticky behavior.
2026-05-21 15:27:08 +02:00
Samuel Enocsson 259a3fadf1 chore: remove dead .refresh-section CSS (#4) 2026-05-21 15:17:09 +02:00
Samuel Enocsson 7af9d8d69e fix: null-safe icon selectors after table restructure (#4) 2026-05-21 15:16:09 +02:00
Samuel Enocsson 16d375ae10 refactor: design-fidelity pass on players page 2026-05-21 15:15:29 +02:00
Samuel Enocsson ac6008aa14 chore: delete dead progress.js (#4) 2026-05-21 14:38:06 +02:00
Samuel Enocsson cc223a4b8a fix: drop unused html field from renderDeltaPill (#3) 2026-05-21 14:38:06 +02:00
Samuel Enocsson 0ded27f9df fix: address code review findings — DRY delta-pill, var→const/let, tokenize colors 2026-05-21 14:38:06 +02:00
Samuel Enocsson b75e60da65 feat: redesign expanded row with detail-grid + history chart (#7) 2026-05-21 14:38:06 +02:00
Samuel Enocsson 83ceaf0ea3 feat: add KPI summary tiles above players table (#5) 2026-05-21 14:38:06 +02:00
Samuel Enocsson b51ae19ae1 feat: render sparklines + wire trend-chart pill toggle (#6) 2026-05-21 14:37:58 +02:00
Samuel Enocsson 3dcd3131a0 feat: add monthlyHistory[] per player via getMonthlyHistory + bulk fetch (#6)
Add getMonthlyHistory() to models/player for single-player use and
getAllMonthlyHistoriesFromDB() for bulk fetches (one query, grouped in
memory). Wire monthlyHistory into all player objects returned by
getPlayerDataFromDB and getAllRatingsFromDB. Bulk path pre-fetches in
one query to avoid N extra per-player queries.
2026-05-21 13:41:20 +02:00
Samuel Enocsson 3f7a1bb7bf chore: remove dead code orphaned by topbar redesign (#4)
The new topbar's "Refresh all" button replaces the old SSE-driven
"Load All" link and progress UI. With those gone, several pieces of
infrastructure had no callers left:

- GET /api/load-all-players, POST /api/populate-database, and
  GET /api/database-status — SSE endpoints with no frontend consumers
- #progress-section / #loading divs in players + courses pages
- .progress-container / .progress-bar / .progress-text / .loading CSS
- public/js/progress.js script (defines fetchRatingsWithProgress, never
  called, and loadAllPlayers, no longer wired) — to be deleted manually
  since the sandbox blocks rm
2026-05-21 13:15:53 +02:00
Samuel Enocsson de99d4ede7 fix: address code review for visual layer + topbar (#4) 2026-05-21 12:50:31 +02:00
Samuel Enocsson 8c977d6624 feat: shared visual layer + redesigned topbar (#4)
Introduce new design token set (paper/ink/line/accent + radius/shadow)
with backward-compat aliases for legacy --surface/--navy/--text names.
Swap DM Sans for Plus Jakarta Sans, add JetBrains Mono with tabular
numerics. Replace .app-header with sticky .topbar partial (brand +
segmented nav + Next update / Last refresh meta + Refresh all button).

Add POST /api/refresh-all that runs refreshAllPlayersInDB() with an
in-memory mutex and returns the rendered topbar so HTMX can swap it
in. "Next update" is computed as first Tuesday of next month
(approximation of PDGA's monthly cycle). "Last refresh" derives
from MAX(players.last_updated).
2026-05-21 12:37:31 +02:00
Samuel Enocsson 6e05d3014d refactor: remove tour feature and Tjing import
Release Please / release-please (push) Waiting to run
Release Please / docker (push) Blocked by required conditions
Tour functionality has moved to its own project (HyzrTour).
Removes all tour-related code, Tjing integration, and associated
views/styles/scripts. Keeps the saveCourseToDB ON CONFLICT fix.
2026-03-20 15:05:20 +01:00
Samuel Enocsson eb77b1f32b feat: add Tjing course import
Search and import courses with layouts from Tjing's GraphQL API.
Total par is calculated from individual hole data. Courses are saved
with a tjing.se link as unique identifier to prevent duplicates.
2026-03-20 08:45:16 +01:00
Samuel Enocsson 80616f6523 fix: use localStorage instead of sessionStorage for tour membership
Persists across browser sessions so players don't need to rejoin.
2026-03-20 07:39:43 +01:00
Samuel Enocsson a6250eb76a fix: move custom layout fields to own row in tour creation form 2026-03-20 07:39:43 +01:00
Samuel Enocsson 38cc93bc1c feat: allow custom layouts when creating tours
Courses without scraped layouts can now be used in tours by entering
a layout name and par manually. The layout is saved to the database
for reuse. All courses are shown in the dropdown, not just those with
existing layouts.
2026-03-20 07:39:43 +01:00
Samuel Enocsson 2ccb018bdf feat: add async tour system
Players can create tours with selected courses/layouts and a date range.
Others join via a 6-character tour code, play the courses, and report
their total strokes. Live leaderboard with points and +/- par display.

Includes: database schema, model, service, routes, views, and styling.
2026-03-20 07:39:43 +01:00
Samuel Enocsson 371a398446 Modernize UI design with new color system, typography and layout
- Add sticky dark header with nav replacing inline text links
- Introduce CSS custom properties design system (colors, spacing, shadows)
- Use DM Sans + JetBrains Mono fonts replacing Arial
- Modernize tables with uppercase headers and subtle hover states
- Add gradient fill and rounded line to rating chart
- Unify card sections across players and courses pages
- Add backdrop blur to modals
- Clean up inline styles to use CSS variables
2026-02-19 09:12:04 +01:00
Samuel Enocsson 7e5fa6cbf1 Add HTMX migration for server-rendered tables and lazy loading
- Add HTMX CDN to layout
- Replace client-side table rendering (displayRatings, displayCourses)
  with server-rendered EJS partials via hx-get
- Add server-side course search with debounced hx-trigger
- Lazy-load player history and course layouts via htmx.ajax()
- Render rating chart via htmx:afterSwap with data attributes
- Add partial routes: ratings-table, course-table, player-history,
  course-layouts
2026-02-19 08:29:56 +01:00
Samuel Enocsson 20bbdbbfcf Extract inline CSS/JS, add EJS templates with shared layout
- Extract CSS into public/css/{shared,players,courses}.css
- Extract JS into public/js/{chart,tooltips,progress,players,courses}.js
- Consolidate 5 duplicated tooltip blocks into setupTooltip() helper
- Add EJS view engine with layout partial and nav partial
- Convert HTML pages to EJS templates (index.ejs, courses.ejs)
- Add /courses route with redirect from /courses.html
- Remove old monolithic HTML files (1478 + 612 lines)
2026-02-18 22:32:03 +01:00