Commit graph

411 commits

Author SHA1 Message Date
Jon Seager
bfe65d23ff
feat: add /health endpoint for Fly.io health checks
- Add lightweight GET /health returning {"status":"ok"}
- Update fly.toml to use /health instead of /
2026-02-08 15:37:35 +00:00
Jon Seager
dbdb15a492
feat(home): add stats cards and horizontal scroll to data section
- Add build_stat_cards() with shuffled order from stats cache
- Remove gear from homepage data cards and StatsView
- Add StatCard view struct for icon/value/label display
- Convert data cards from grid to horizontal scroll with chip-scroll
- Add stats section with 6 randomized stat cards
2026-02-08 15:21:19 +00:00
Jon Seager
f144526288
feat(stats): add world-map theme awareness and highlight color
- Add --highlight-rgb CSS custom property for light and dark themes
- Add MutationObserver to world-map for theme change detection
- Read choropleth colors from CSS custom properties instead of hardcoded values
- Simplify stats_map partial to use text-highlight class
2026-02-08 15:20:44 +00:00
Jon Seager
66c5cd0d6c
feat(stats): add full stats page with consumption, brewing, and charts
- Refactor stats handler to load_or_compute with cache fallback
- Add donut charts for brewer and grinder usage (with XSS-safe labels)
- Add bar charts for origins, flavours, grind weight, and brew time
- Add consumption cards (total brewed, avg per brew, bags consumed)
- Add roast summary section (top origins, processes, producers)
- Register donut-chart.js static asset route
- Add Recompute Stats button to admin page
2026-02-08 15:20:29 +00:00
Jon Seager
97c00f2e33
feat(stats): add pre-computed stats cache with background recomputation
- Add CachedStats domain types (roast summary, consumption, brewing)
- Extend StatsRepository with summary queries and cache get/store
- Add StatsInvalidator + background task with 2s debounce
- Add invalidate() calls to all entity create/update/delete handlers
- Add POST /api/v1/stats/recompute endpoint for manual refresh
- Add stats_cache migration and include in database reset
- Add GeoStats::from_counts() and Serialize/Deserialize derives
- Add 6 integration tests for stats API
- Document Stats Cache pattern in CLAUDE.md
2026-02-08 15:20:01 +00:00
Jon Seager
0b321068aa
refactor(domain): extract shared formatting helpers
- Add format_weight() and format_relative_time() in domain/formatting.rs
- Replace ad-hoc weight format strings across views and timeline events
- Move relative_date() body to domain layer with explicit now param
- Remove hardcoded "g" suffix from bag templates (now in format_weight)
- Document formatting helpers in CLAUDE.md
2026-02-08 15:14:39 +00:00
Jon Seager
585eb77799
feat(home): add floating chevron scroll buttons to card sections
Extract <chip-scroll> custom element into its own file and wrap
Recent Brews and Open Bags horizontal scrollers with desktop-only
chevron navigation that half-overlaps the card edges.
2026-02-08 11:51:13 +00:00
Jon Seager
7f99ffc993
feat(stats): add geographic stats page with choropleth world map
- New /stats page with Roasters, Roasts, Cups, and Cafes tabs
- Interactive choropleth world map (SVG) colored by country counts
- Clickable country chips that highlight individual countries on the map
- Horizontal chip scroller with chevron navigation on desktop
- Datastar-powered tab switching without page reload
- Domain layer: country name → ISO code mapping, flag emoji generation
- StatsRepository trait with four aggregate SQL queries
- <world-map> and <chip-scroll> custom elements for Datastar compatibility
2026-02-08 11:03:15 +00:00
Jon Seager
6245a2a42d
style(tables): remove small-caps from headers and simplify bag status
- Replace small-caps + tracking-wide thead with plain text-text-secondary
  across all 7 list tables
- Bag status: widen progress bar to fill cell, use thicker bar on desktop
- Bag status: replace pill with plain text for "Closed"
- Bag status: use text-xs instead of small-caps for amount labels
2026-02-08 09:56:59 +00:00
Jon Seager
6321fcc3e5
fix(auth): auto-redirect to homepage after passkey registration
Replace the intermediate success screen with an immediate redirect,
since the session cookie is already set at that point.
2026-02-08 09:52:05 +00:00
Jon Seager
ba319e3ab7
copy: remove second-person pronouns, use imperative tone
Replace "you/your" with impersonal alternatives across all
user-facing strings in templates, CLI output, error messages,
and documentation. Add copy style rule to CLAUDE.md.
2026-02-08 09:50:49 +00:00
Jon Seager
3f672d7c06
chore: fix lints 2026-02-08 09:40:37 +00:00
Jon Seager
35e1812879
refactor: rename Account to Admin across filenames, routes, and docs
- Rename account.{rs,html} → admin.{rs,html} in app, api, and templates
- Update route /account → /admin
- Rename AccountTemplate → AdminTemplate, account_page → admin_page
- Update nav link, test function names, and CLAUDE.md references
2026-02-08 09:39:37 +00:00
Jon Seager
de3ee1b4b7
docs: consolidate button style guide from 11 to 7 variants
Merge Secondary + Outlined accent + Outlined accent + icon into
Outlined, Card muted action into Card action, and Delete link into
Link. Each merged variant uses colour modifiers instead of separate
style guide rows.
2026-02-08 09:35:17 +00:00
Jon Seager
123d035417
style(ui): add icons to all primary buttons, align to Outlined style
- Add chevron_right icon macro
- Add icon to checkin "Next" and register "Go to Brewlog" buttons
- Align Back (checkin) and Cancel (scan_result_form) to Outlined
  style: inline-flex, font-medium
- Rename "Log Brew" → "Save Brew" for consistency with other forms
2026-02-08 09:35:11 +00:00
Jon Seager
4da9c65f56
style(account): normalize button styles, labels, and widths
- Replace icon-only delete/revoke buttons with outlined text buttons
- Rename: Add Passkey → New Passkey, Create Token → New Token,
  Download Backup → New Backup, Restore from Backup → Restore,
  Reset Database → Reset
- Add w-full sm:w-auto sm:min-w-44 to all action buttons for
  consistent sizing on mobile and desktop
- Align Cancel buttons to font-medium text-text (Outlined style)
2026-02-08 09:35:04 +00:00
Jon Seager
743362c1d2
style(home): rename Stats section to Data 2026-02-08 09:17:11 +00:00
Jon Seager
4d3c4657d8
style(bags): hide button labels on narrow bag cards
Use CSS container queries to show Brew/Close text labels only
when the button area is >= 10rem wide, going icon-only on
narrow mobile viewports.
2026-02-08 09:16:02 +00:00
Jon Seager
d60133b585
docs: rewrite CLAUDE.md design system and UI patterns
- Expand Component Classes table with tabs, timeline, text-2xs, small-caps
- Add Icons section with entity-type mapping and size-by-context tables
- Add Tabs section documenting desktop/mobile tab patterns
- Expand Buttons to 14 variants with font weight conventions
- Add Page Layout section with card padding rules
- Update Typography with font weight hierarchy and small-caps patterns
- Document empty state blurred placeholder pattern
- Remove references to non-existent .pill-accent class
2026-02-07 22:37:22 +00:00
Jon Seager
487ff75f48
style(ui): add icons to buttons and normalize button styles
- Add icons to all submit/action buttons (plus, beaker, key, check, etc.)
- Add pencil icons to "Change" buttons in multi-step flows
- Add icons to account page actions (passkeys, tokens, backup, reset)
- Add key icons to login/register passkey buttons
- Normalize primary button weight to font-semibold on account page
- Standardize secondary button hover to hover:bg-surface-alt
2026-02-07 22:37:07 +00:00
Jon Seager
ce4f32c63f
feat(icons): add icon macros, remap entity types, add icons to tabs and timeline
- Add new icon macros: coffee_bean, grinder, cup (redesigned), pencil,
  clipboard, check, x_mark, arrow_down_tray, arrow_up_tray
- Remove orphaned building and wrench macros
- Remap entity icons: roast→coffee_bean, roaster→fire, gear→grinder
- Replace pill labels with entity-type icons in homepage activity rows
- Add entity-type icons to timeline cards and tab buttons
- Fix brew/bag card action icons (cup→beaker)
- Add entity_type field to TimelineEventView, add roaster detail picks
2026-02-07 22:36:48 +00:00
Jon Seager
af9344202d
refactor(css): add text-2xs and small-caps utilities, replace inline styles
- Add @utility text-2xs (0.65rem) and small-caps (font-variant) to input.css
- Replace inline style="font-variant: small-caps" with .small-caps class
  across all list partials and base.html footer
- Add gap support to .tab and .tab-mobile for icon+label layout
- Reduce mobile top padding (py-4 md:py-10) on main container
- Rename CSS section header from "Scrollbar hide" to "Utilities"
2026-02-07 22:36:28 +00:00
Jon Seager
0258ca6840
style(home): replace empty state placeholders with blurred skeletons
- Show blurred skeleton cards with overlay text for empty brews,
  bags, and activity sections instead of plain dashed borders
- Use 6 skeleton cards for brew/bag sections to fill desktop width
- Skeleton structure mirrors real card layout (title, details, buttons)
2026-02-07 21:48:11 +00:00
Jon Seager
81308fdef2
style(ui): restyle cards, buttons, and icons for consistency
- Redesign brew cards: replace pill badges with text notes, add
  full-width Brew Again button with cup icon, adjust card height
- Redesign bag cards: move Brew/Close buttons below progress bar,
  add Close button label, reduce card height
- Restyle account page buttons (Sign Out, Restore, Reset, Cancel)
  to use consistent bordered-accent pattern
- Replace thin logout icon with Font Awesome person-running SVG
- Update homepage stats labels and quick action buttons to text-sm
- Add empty state placeholders for brews, bags, and activity sections
- Enlarge logo click target, swap theme toggle icons, add font-medium
  to mobile tab selector
- Remove small-caps from scan input "or" labels
2026-02-07 21:42:38 +00:00
Jon Seager
66dd9d6c1d
style(tables): improve headers, pagination, and date columns
- Add small-caps to all table column headers
- Show Added date in normal font size with time as smaller subtext
- Show Finished date in normal font size in bag table
- Rename "Previous" to "Prev" in pagination controls
- Use orange text and subtle hover on Prev/Next buttons and Rows select
2026-02-07 20:59:16 +00:00
Jon Seager
2fdd780a05
style(data): improve data page layout and spacing
- Wrap tab bar, search, and table in gap-4 container for tighter spacing
- Change search placeholder from "Search..." to "Filter..."
- Remove border/padding wrapper around tab bar and search
2026-02-07 20:59:08 +00:00
Jon Seager
4ee89e2336
style(ui): simplify scan input and normalize form text
- Remove check-in and add links from scan input partial
- Add "or" separator between camera and text input
- Remove redundant text-sm from input fields (now in .input-field CSS)
- Fix label text size and color in check-in form
2026-02-07 20:59:02 +00:00
Jon Seager
3741d2e281
style(home): redesign quick actions and stat labels
- Replace scan input bar with 3-column grid: Scan, Check In, Add
- Use small-caps labels on stat counters
2026-02-07 20:58:56 +00:00
Jon Seager
411d520cb3
feat(add): add extraction bars to roaster and roast forms
- Remove top-level scan section and scan_input import
- Add per-form extraction bars with camera + describe input
- Rename form signals from _add-* prefix to match extraction endpoints
- Add per-form extracting/error signals to guard datastar-fetch events
- Make Log Brew button full width
2026-02-07 20:58:50 +00:00
Jon Seager
dd3714f0a1
style(ui): restyle buttons, tabs, and form inputs
- Change btn-adjust to grey border with orange text and subtle hover
- Add font-family/font-size to .input-field for consistency
- Redesign desktop tabs: bordered, orange text, equal width, accent
  border on active instead of filled background
- Redesign mobile tab selector: bordered dropdown with orange text,
  rounded container, subtle active background
2026-02-07 20:58:41 +00:00
Jon Seager
6829239bfc
style(ui): shrink open bag cards and add manual-add button to quick bar
- Reduce open bag card height from 280px to 222px
- Add a + button next to the places icon in the scan input bar
  that links to /add for manual entry
2026-02-07 20:07:23 +00:00
Jon Seager
df4469ff69
feat(brews): make Brew Again navigate to pre-filled add form
Instead of immediately creating a duplicate brew via inline POST,
the Brew Again button now links to the add-brew page with query
params that pre-fill all fields (bag, grinder, grind setting,
brewer, filter paper, water volume/temp, brew time, quick notes).
This lets users review and adjust parameters before brewing.
2026-02-07 19:57:23 +00:00
Jon Seager
51f8122201
feat(ui): improve form UX with collapsible equipment and clickable controls
- Split equipment into separate Grinder and Brewer collapsible sections
  with summary bars showing current selection
- Make all summary bars, matched-entity cards, and searchable-select
  selected values clickable anywhere to change (not just the X/Change button)
- Fix stepper buttons broken after manual input by switching from
  data-attr:value to data-bind with Number() coercion
- Merge Water + Brew Time into single Recipe section
- Make all add/confirm buttons full-width
- Add sticky submit button on mobile
- Fix missing closing > on cafe indicator div
- Fix broken Askama syntax on checkin page from formatter
2026-02-07 12:10:56 +00:00
Jon Seager
cc4f9068d9
style(ui): polish brew form and stepper buttons
- Hide native number input spin buttons across browsers
- Fix brew time field width to match sibling fields
- Restyle .btn-adjust with accent-subtle fill instead of border
- Remove (M:SS) hint from brew time label
2026-02-07 11:29:51 +00:00
Jon Seager
4eed3658f2
style(account): improve API token UX
- Replace token dismiss button with close icon in top-right corner
- Add terminal icon to token rows matching passkey layout
- Remove token row from DOM immediately on revoke
- Focus token name input when opening the create form
- Clear token name input after successful creation
2026-02-07 11:25:30 +00:00
Jon Seager
902d52b171
feat(brews): add brew time field
- Add brew_time INTEGER column to brews table (nullable, stored as seconds)
- Display as M:SS format with stepper control (+/-5s) in add form
- Replace ratio with brew time in brew list Recipe column
- Show brew time in brew cards and timeline events
- Add --brew-time CLI flag and update bootstrap script (1:45-2:45 range)
2026-02-07 11:24:07 +00:00
Jon Seager
ed0cb2fd39
fix(build): pass git hash to Nix builds via env var
- build.rs checks GIT_HASH env var before shelling out to git
- flake.nix injects self.shortRev into the build environment
- Remove version number from footer, keep only commit hash
2026-02-07 11:17:03 +00:00
Jon Seager
9ceb1a2b69
feat(timeline): add expand/collapse all toggle per month
- Add "Expand all" / "Collapse all" link under each month heading
- Individual cards remain toggleable even when month is expanded
- Three signals coordinate state: _expandedMonths (month-level),
  _expandedCard (single card), _collapsedCards (individual overrides)
2026-02-07 11:03:52 +00:00
Jon Seager
b774f356e6
feat(timeline): add collapsible cards with condensed view
Cards start collapsed showing category, relative date, title, and
subtitle. Clicking expands to reveal full timestamp, detail rows,
tasting notes, and external links. Uses a single Datastar signal
for expand state.

- Replace pill badge with small-caps category label
- Remove brew-again button from timeline cards
- Replace @ separators with · in brew detail values
2026-02-07 10:55:21 +00:00
Jon Seager
9feb0e78c3
style: shorten field placeholder for bag descriptions 2026-02-07 10:41:12 +00:00
Jon Seager
577c0e39d3
feat(ui): add horizontal scrolling recent brews on homepage
- Load last 10 brews instead of 3, display in horizontal scroll
- Extract brew card into reusable partial with portrait layout
- Add grinder_model field to BrewView for compact card display
- Move brew-again button to top-right icon, truncate long names
2026-02-07 10:40:20 +00:00
Jon Seager
55e549ceac
feat(tasting-notes): add Levenshtein fuzzy matching for typo tolerance
Add third-tier fuzzy matching using edit distance to catch common typos
and spelling variants in tasting notes (e.g. "cinamon", "smokey").
2026-02-07 10:33:05 +00:00
Jon Seager
a3cfc22f09
fix(ui): show native camera/gallery picker on mobile photo capture
Remove capture="environment" from the file input so mobile browsers
present the OS-native action sheet instead of opening the camera directly.
2026-02-07 10:27:32 +00:00
Jon Seager
8410b46a11
feat(ui): add horizontal scrolling open bags on homepage
- Load all open bags instead of limiting to 3
- Replace grid layout with horizontal scroll container using snap
- Redesign bag cards as portrait layout with icon actions
- Add scrollbar-hide CSS utility and x_mark icon
2026-02-07 10:22:48 +00:00
Jon Seager
f9adc849c2
style: reformat checkin and home page templates 2026-02-07 09:48:37 +00:00
Jon Seager
3747ab1e93
refactor(bootstrap): use --created-at flags instead of SQL timestamps
Replace ~880 lines of post-hoc SQL UPDATEs with inline --created-at
flags on every entity creation command. Also fix bag roast dates and
finished dates to match the backdated 6-month timeline.

Keep one small SQL block for enriching cafe timeline events with
Website and Position fields (not generated by Rust to_timeline_event).
2026-02-07 09:48:33 +00:00
Jon Seager
3fccfa2cd0
test: update test struct initializers for created_at field
Add `created_at: None` to all New*/Update* struct constructions in
integration tests so they compile with the new optional field.
2026-02-07 09:48:26 +00:00
Jon Seager
e01b6d0a1c
feat: add optional created_at to entity creation and updates
Add `created_at: Option<DateTime<Utc>>` through all layers so CLI users
can backdate entities at creation/update time. When omitted, falls back
to `Utc::now()`.

- Domain: add field to all New*/Update* structs with serde(default)
- Domain: timeline events use entity created_at instead of Utc::now()
- Repos: unify INSERT to explicit Rust-side created_at with unwrap_or_else
- Repos: add created_at to UPDATE dynamic query builders
- Routes: add field to submission structs and has_changes guards
- Clients: pass created_at through manual JSON client methods
- CLI: add --created-at flag with parse_created_at helper (RFC 3339 or YYYY-MM-DD)
2026-02-07 09:48:20 +00:00
Jon Seager
e58ea5758f
feat(backup): add database reset action to account page
- Add reset() method to BackupService that deletes all 8 coffee tables
  in a transaction, respecting FK constraint order
- Add POST /api/v1/backup/reset endpoint (requires auth)
- Add "Reset Database" button with double-confirmation to account page
- Stack data buttons vertically on mobile for better layout
2026-02-07 08:45:30 +00:00
Jon Seager
47feedb273
refactor(ui): simplify navigation and page layouts
- Replace dropdown hamburger menu with inline icon buttons for add,
  theme toggle, account/login
- Move sign-out button to account page header
- Remove unused icons (home, hamburger, close, checkin, timeline,
  squares) and add plus icon
- Simplify data page header (remove inline add button, now in nav)
2026-02-07 08:43:05 +00:00