Commit graph

532 commits

Author SHA1 Message Date
Jon Seager
43b5ccb34a
docs: trim CLAUDE.md from 972 to ~250 lines
Remove verbose reference tables, full template examples, and CSS class
catalogs discoverable from code and doc comments. Retain all gotchas,
workflow requirements, architecture overview, Datastar attribute table,
three-way response pattern, and stats cache checklist.
2026-02-09 16:43:19 +00:00
Jon Seager
1a71fb4158
chore: autoformat templates with prettier 2026-02-09 13:40:05 +00:00
Jon Seager
8d433d8e99
build: add prettier with jinja plugin to treefmt 2026-02-09 13:39:53 +00:00
Jon Seager
31dc620b0a
build: add treefmt and pre-commit 2026-02-09 11:35:21 +00:00
Jon Seager
6493c6495a
fix(homepage): show stats placeholder when database is empty
The stats recomputation task populates the cache with zero values on
startup, causing build_stat_cards() to return 6 cards even with an
empty database. Gate the stats section on stats.is_empty() in addition
to stat_cards.is_empty() so placeholders display correctly.
2026-02-09 10:13:11 +00:00
Jon Seager
2a3f9220c2
feat(homepage): show relative time on brew cards
Replace roaster name with relative timestamp below the roast name
and reduce header height for tighter layout.
2026-02-09 09:30:54 +00:00
Jon Seager
d2ff4eb854
docs: update CLAUDE.md and README.md for recent refactors
- Update architecture tree for coffee/auth/analytics subdirectory split
- Fix infrastructure/ai/ (dir) to infrastructure/ai.rs (file)
- Fix stale file paths in gotchas #8, #11, #12
- Update OG image path from /og-image.png to /static/og-image.png
- Expand detail pages section from 3 to 7 pages
- Add map_with_legend_1 macro, fix Used-by columns
- Document <donut-chart> web component
- Add check-in, scanning, timeline, stats to README feature list
2026-02-08 18:30:25 +00:00
Jon Seager
edc0021792
refactor: split large directories into coffee/auth/analytics subdirs
- Restructure domain/, repositories/, and routes/api/ into themed
  subdirectories: coffee/, auth/, analytics/ (and system/ for routes)
- Convert super:: relative imports to crate:: absolute paths
- Promote macro visibility from pub(super) to pub(crate)
- Add pub use re-exports for backward-compatible import paths
2026-02-08 18:16:16 +00:00
Jon Seager
0fd4214b6c
refactor(static): prefix all static asset routes with /static/
Move static asset URLs from root-level paths to /static/ prefix
mirroring the filesystem layout (e.g. /styles.css → /static/css/styles.css,
/components/*.js → /static/js/components/*.js).
2026-02-08 18:07:10 +00:00
Jon Seager
a9fd069a3c
feat(timeline): add country flags to detail rows, allow multiple cards open
- Add flag emojis to Origin and Country detail rows in timeline events
- Change expanded-card signal from single-value to comma-separated list
  so multiple timeline cards can be open simultaneously
- Build subtitle before adding flags to keep condensed text clean
2026-02-08 18:04:31 +00:00
Jon Seager
639d748384
feat(lists): add flag emojis to country/origin columns
- Add country_flag to RoasterView and CafeView
- Add origin_flag to RoastView
- Display flag prefixes in roaster, cafe, and roast list partials
- Swap country/city column order in cafe list
2026-02-08 17:59:37 +00:00
Jon Seager
f0eb346086
feat(detail): add roast detail page, simplify lists and actions
- Add roast detail page at /roasters/{slug}/roasts/{slug}
- Remove expand/collapse detail rows from all 7 list views
- List rows now navigate directly to entity detail pages
- Replace three-dots action button with chevron-right link
- Add delete buttons to brew and cup detail pages
- Restyle all delete buttons: outlined with red text
- Remove share buttons from all detail pages
- Update timeline card links to point at detail pages
- Make homepage activity cards clickable with hover effect
- Replace all vanilla JS delete/close with Datastar actions
- Extract render_redirect_script helper for Datastar redirects
- Update delete macro with referer-based routing for detail pages
2026-02-08 17:48:49 +00:00
Jon Seager
958c8de6cc
feat(detail): add roaster, cafe, and gear detail pages
- Add detail page routes, templates, and view models for roasters, cafes,
  and gear, following the existing pattern from bags/brews/cups
- Add map_with_legend_1 macro for single-country detail maps
- Redirect to detail page after entity creation instead of list page
- Check referer in create handlers to return list fragment only from data page
- Update bag delete button to use red background style
- Update datastar tests to include referer header for create assertions
2026-02-08 17:20:46 +00:00
Jon Seager
ccbd229d75
style(stats): add bg-surface to cards/pills/tabs, reorder tabs
- Add bg-surface background to roast stats, consumption, and country pill cards
- Update tab CSS: bg-surface background, hover:border-accent/40 instead of bg-surface-alt
- Add hover:border-accent/40 to clickable country pill buttons
- Make Roasts the first and default tab on the stats page
2026-02-08 16:47:30 +00:00
Jon Seager
4fd72d654a
feat(bags): add bag detail page, extract shared detail page macros
- Create /bags/:id detail page with coffee, roaster, map, and bag info cards
- Extract shared template macros into detail_cards.html (coffee_card, roaster_card, map_with_legend, share_button)
- Extract build_coffee_info() and build_roaster_info() view model helpers
- Refactor brew.html and cup.html to use shared macros
- Make bag cards on homepage clickable, linking to detail page
- Add Close Bag and Delete actions on bag detail page
- Unify homepage card styling (bg-surface, hover:border-accent/40)
- Update CLAUDE.md with detail page patterns
2026-02-08 16:43:04 +00:00
Jon Seager
9e5dff7f5f
feat(web): add Open Graph and Twitter Card meta tags
- Add og:title, og:description, og:image, og:type, og:site_name and
  twitter:card meta tags to base template with Askama block overrides
- Create static 1200x630 OG image served at /og-image.png
- Override OG blocks with entity-specific content on brew, cup, and
  stats detail pages
- Reuse BREWLOG_RP_ORIGIN as base URL for absolute og:image URLs via
  OnceLock initialized at server startup
2026-02-08 16:19:34 +00:00
Jon Seager
f5e319ce03
feat(ui): add empty states for stats and data sections
Show blurred placeholder cards with "No stats yet" / "No data yet"
labels when no data exists, instead of hiding the sections entirely.
2026-02-08 16:10:32 +00:00
Jon Seager
ffee36ea41
feat(home): make brew cards clickable, linking to detail page
Change brew card from div to anchor element with hover border effect.
Brew Again button uses preventDefault to avoid navigating to the detail
page when clicked.
2026-02-08 16:10:21 +00:00
Jon Seager
eaf558a524
feat(routes): redirect to detail page after creating brews and cups
Update create_brew, create_cup, and submit_checkin to navigate to the
new detail pages instead of reloading or redirecting to home.
2026-02-08 16:10:11 +00:00
Jon Seager
b17aaab5f4
feat(detail): add shareable brew and cup detail pages
Add /brews/:id and /cups/:id routes with full coffee, roaster, gear,
and recipe information. Each page includes a world map highlighting
relevant countries, tasting note pills, and a share button that copies
the URL to the clipboard.
2026-02-08 16:10:01 +00:00
Jon Seager
9237a386e0
refactor(domain): extract country utilities into dedicated module
Move COUNTRY_MAP, country_to_iso(), iso_to_flag_emoji() and their tests
from country_stats.rs into a new countries.rs module for reuse by the
detail page view models.
2026-02-08 16:09:46 +00:00
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