Commit graph

496 commits

Author SHA1 Message Date
Jon Seager
9291c3fe8c
fix(scan): stack form buttons vertically on mobile
The Save Roaster & Roast button text was wrapping awkwardly on narrow
screens. Buttons now stack full-width on mobile and revert to inline
layout on sm: breakpoint.
2026-02-09 20:11:46 +00:00
Jon Seager
eff29b048c
chore: enable agent teams experiment in dev shell 2026-02-09 19:57:42 +00:00
Jon Seager
05a40a35c2
fix(ui): use fixed 200px card width on mobile and desktop
Replace viewport-relative w-[45vw] with fixed w-[200px] so brew and
bag cards maintain consistent width across breakpoints instead of
shrinking on narrow screens.
2026-02-09 19:57:36 +00:00
Jon Seager
08c1ef05cf
fix: use gear model column for brew card grinder display
The grinder_model field was computed by splitting the concatenated
"make model" string on the first space, which broke for multi-word
brand names like "Weber Workshops". Fetch g_grinder.model directly
from the database instead.
2026-02-09 19:57:09 +00:00
Jon Seager
da206c1938
feat(ui): add entity links to detail page cards
Add roaster and roast slug parameters to coffee_card and roaster_card
macros, rendering entity names as links to their detail pages. Add cafe
link in the cup detail page. Pass slug fields through template structs
and route handlers.
2026-02-09 19:56:47 +00:00
Jon Seager
3c273feb18
feat(a11y): add ARIA attributes, token colors, toast, and tab-switch links
Add aria-required to required inputs, role=alert to error messages,
aria-label to icon-only list nav buttons, and progressbar ARIA to bag
status bars. Replace hardcoded red/green colors with error/success
design tokens across all templates. Add toast notifications for entity
creation and tab-switch links for empty add-form states. Increase scan
upload body limit to 10MB.
2026-02-09 19:56:11 +00:00
Jon Seager
aad927085b
refactor: extract location JS into static file with nearby keyboard nav
Move locateUser and nearbyKeydown functions from an Askama macro into
static/js/location.js served as a deferred script. Add arrow key, Enter,
and Escape navigation for nearby cafe search results.
2026-02-09 19:54:49 +00:00
Jon Seager
f4411fdc76
feat(a11y): add role=img and sr-only data to map and chart components
Add ARIA role=img with descriptive labels to world-map SVG and
donut-chart SVG. Include a screen-reader-only data table in world-map
for country/count pairs.
2026-02-09 19:54:42 +00:00
Jon Seager
8f79c5aaf3
feat(a11y): add combobox ARIA and keyboard nav to searchable-select
Add role=combobox, aria-expanded, aria-controls, and role=listbox/option
attributes. Support arrow key navigation, Enter to select, and Escape
to dismiss. Add aria-label to clear button.
2026-02-09 19:54:33 +00:00
Jon Seager
004f92e340
feat(css): add error/success design tokens, touch targets, and active state
Add error and success color tokens with dark mode support, increase
btn-adjust touch target to 44px on mobile, and add .ss-active highlight
class for keyboard navigation in searchable components.
2026-02-09 19:54:22 +00:00
Jon Seager
e0e49f8125
docs: add cover image to README 2026-02-09 17:47:29 +00:00
Jon Seager
36540a3b90
docs: rewrite README with docker quick start and new defaults
Restructure the quick start to lead with Docker, add install-from-git
as a secondary option, update the config table to reflect the new
localhost defaults and auto-enabled insecure cookies, and consolidate
the Docker section into the quick start.
2026-02-09 17:24:15 +00:00
Jon Seager
8e72961f1a
ci(deploy): push latest tag to GHCR alongside commit SHA tag 2026-02-09 17:23:58 +00:00
Jon Seager
000f20eab7
feat(server): auto-enable insecure cookies for localhost defaults
Default BREWLOG_RP_ID to "localhost" and BREWLOG_RP_ORIGIN to
"http://localhost:3000". When these localhost defaults are active,
insecure cookies are enabled automatically so local dev works without
setting BREWLOG_INSECURE_COOKIES. A warning is logged at startup when
insecure cookies are active.

The insecure_cookies flag is now threaded through AppState instead of
reading the env var at cookie-set time.
2026-02-09 17:23:09 +00:00
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