Commit Graph

76 Commits

Author SHA1 Message Date
c51cd23d5e feat: enhanced AI usage logging (model, provider, response) and fixed build blockers 2025-12-27 00:10:55 +01:00
30a716f3e2 feat: Add UserStatusBadge showing subscription level and credits
New component in header shows:
- Subscription plan badge (Starter/Bronze/Silver/Gold with icons)
- AI credits balance with sparkle icon

Also includes SQL migration for user_subscriptions RLS fix
2025-12-26 23:02:20 +01:00
1017ec2c57 fix: Add Glengyle distillery (producer of Kilkerran)
Glengyle is the actual distillery name, Kilkerran is the brand.
AI returns 'Glengyle' which was being mismatched to 'Glenglassaugh'.
2025-12-26 22:34:49 +01:00
883b2b61b4 feat: Add Fuse.js distillery name normalization
New: src/lib/distillery-matcher.ts
- normalizeDistillery(): Fuzzy matches AI responses against distilleries.json
- cleanBottleName(): Removes distillery from bottle name to avoid duplication
- normalizeWhiskyData(): Combined helper for both operations

Example transformations:
- 'ARDNAHOE DISTILLERY CO LTD' → 'Ardnahoe'
- 'Laphroaig 10 Year Old' → '10 Year Old' (with distillery in separate field)

Integration:
- gemini-vision.ts now normalizes results after AI response
- Enables consistent distillery names for enrichment cache
2025-12-26 22:20:31 +01:00
daf6c86633 feat: Add distillery enrichment cache
Caches AI enrichment results per distillery to save API calls:
- New table: enrichment_cache (distillery, tags, hit_count)
- New service: cache-enrichment.ts (get, save, increment, stats)
- enrich-data.ts checks cache before AI query
- Saves to cache after successful AI response
- Returns cached: true/false flag for transparency

Benefits:
- 0 API cost for repeated distillery scans
- Near-instant response for cached distilleries
- Shared across all users
2025-12-26 22:12:27 +01:00
537081cd1f fix: Add 'use client' to impressum page for onClick handlers 2025-12-26 22:05:34 +01:00
e6278e5ec6 feat: Add footer with legal links (Impressum, Datenschutz, Einstellungen) 2025-12-26 22:02:00 +01:00
f1990ebf2d feat: Add bot-proof Impressum page
- Email displayed as user[at]domain with onClick handler
- Phone displayed split with dashes
- All contact info clickable but not easily scraped
- Ready to fill in at src/app/impressum/page.tsx
2025-12-26 21:58:37 +01:00
f21b2738ad feat: Add onboarding tutorial and improved empty states
Onboarding Tutorial:
- 5-step walkthrough for new users
- Welcome, Scan, Taste, Sessions, Ready steps
- Skippable, stores completion in localStorage
- Beautiful full-screen overlay with animations

Empty States:
- SessionList: Visual empty state with icon and description
- BuddyList: Visual empty state with icon and description
- Reusable EmptyState component ready for more usage

Layout: Added OnboardingTutorial and CookieBanner
2025-12-26 21:43:26 +01:00
af54d8061c fix: Use username field instead of display_name in profile
- Updated profile-actions.ts to use username column
- Updated ProfileForm.tsx to use username
- Updated settings page to pass username
- Matches database schema (profiles.username)
2025-12-26 21:35:41 +01:00
f74090c8a5 feat: Link profile button to /settings page
- Added router.push('/settings') to onProfile handler
- User icon in bottom nav now navigates to settings
2025-12-26 21:33:36 +01:00
6c37481d17 feat: Add EU cookie banner and user settings page
Cookie Banner:
- GDPR-compliant consent banner
- Shows on first visit, stores consent in localStorage
- Two options: Accept All / Only Essential
- Dark theme with smooth animations

Settings Page (/settings):
- Profile form: display name editing
- Password change with validation
- Cookie settings info section
- Privacy links and account info

New files:
- src/hooks/useCookieConsent.ts
- src/components/CookieBanner.tsx
- src/components/ProfileForm.tsx
- src/components/PasswordChangeForm.tsx
- src/services/profile-actions.ts
- src/app/settings/page.tsx
2025-12-26 21:30:00 +01:00
9c5f538efb refactor: Consolidate all AI calls to use OpenRouter provider switch
- bulk-scan.ts: Now uses OpenRouter for batch analysis
- scan-label.ts: Now uses OpenRouter with Gemini fallback
- analyze-bottle.ts: Now uses OpenRouter with Gemini fallback
- All AI calls now respect AI_PROVIDER env variable
- Uses Nebius/FP8 provider preferences consistently
- Unified logging: [FunctionName] Using provider: openrouter/gemini
2025-12-26 21:21:56 +01:00
e978499b54 feat: Switch enrichment to use OpenRouter provider
- enrichData now uses same AI provider switch as vision
- Both scan and enrichment use OpenRouter by default
- Added retry logic for rate limits
- Uses Nebius/FP8 provider preferences
- Logs which provider is being used
2025-12-26 00:16:48 +01:00
ce49c9e347 feat: Route OpenRouter requests via Nebius with FP8 quantization
- Added OPENROUTER_PROVIDER_PREFERENCES config
- Prioritizes Nebius provider for better availability/speed
- Uses FP8 quantization for quality/speed balance
- Falls back to other providers if Nebius unavailable
2025-12-26 00:12:42 +01:00
8cf51d4aea fix: Add retry logic for OpenRouter 429 rate limit errors
- Retries up to 3 times with exponential backoff (2s, 4s, 8s)
- Also handles 503 service unavailable errors
- Logs retry attempts for debugging
- Only retries rate limit errors, other errors fail immediately
2025-12-26 00:06:21 +01:00
fb2a8d0f7b feat: Add OpenRouter as AI provider with easy switch
- Added openrouter.ts with provider configuration
- Default provider: OpenRouter with google/gemma-3-27b-it
- Switch to Gemini via AI_PROVIDER=gemini in .env.local
- Both providers use same credit system
- OpenRouter uses OpenAI-compatible API

To switch providers, set in .env.local:
AI_PROVIDER=openrouter  # default
AI_PROVIDER=gemini      # Google Gemini
2025-12-25 23:56:24 +01:00
2286867447 feat: Improve Bottle Split UX
- Add 'Split starten' button to bottle detail page
- Support flexible sample sizes (1-20cl) instead of fixed 5/10cl
- Preselect bottle when coming from bottle page
- Save sample sizes/shipping defaults to localStorage
- Update schema: sample_sizes JSONB array
- Update server actions and UI for dynamic sizes
2025-12-25 22:46:58 +01:00
0c7786db90 feat: Bottle Split System (Flaschenteilung)
- Add bottle_splits and split_participants tables with RLS
- Implement soft-lock: pending requests count as reserved
- Create /splits/create wizard (3 steps: bottle, pricing, shipping)
- Create /splits/[slug] public page with price calculator
- Create /splits/manage host dashboard with participant workflow
- Add SplitProgressBar component for visual volume display
- Status workflow: PENDING -> APPROVED -> PAID -> SHIPPED
- Forum export (BBCode format)
- Saved defaults in localStorage for glass/shipping costs
2025-12-25 22:36:38 +01:00
75461d7c30 feat: Buddy System & Bulk Scanner
- Add Buddy linking via QR code/handshake (buddy_invites table)
- Add Bulk Scanner for rapid-fire bottle scanning in sessions
- Add processing_status to bottles for background AI analysis
- Fix offline OCR with proper tessdata caching in Service Worker
- Fix Supabase GoTrueClient singleton warning
- Add collection refresh after offline sync completes

New components:
- BuddyHandshake.tsx - QR code display and code entry
- BulkScanSheet.tsx - Camera UI with capture queue
- BottleSkeletonCard.tsx - Pending bottle display
- useBulkScanner.ts - Queue management hook
- buddy-link.ts - Server actions for buddy linking
- bulk-scan.ts - Server actions for batch processing
2025-12-25 22:11:50 +01:00
afe9197776 feat: improved local OCR with Strip & Match distillery detection
- Added comprehensive distillery database (200+ entries)
- Implemented Strip & Match heuristic for fuzzy matching
- Added contextual age detection from distillery lines
- Added whitespace normalization for OCR text
- Disabled local name extraction (too noisy, let Gemini handle it)
- Fixed confidence scale normalization in TastingEditor (0-1 vs 0-100)
- Improved extractName filter (60% letters required)
- Relaxed Fuse.js thresholds for partial matches
2025-12-25 13:14:08 +01:00
a1a91795d1 feat: optimize scan OCR with sharp preprocessing and 1024px resizing 2025-12-24 00:02:58 +01:00
c134c78a2c feat: improve AI resilience, add background enrichment loading states, and fix duplicate identifier in TagSelector 2025-12-23 11:38:16 +01:00
5e35710b67 feat: optimize scan flow with WebP compression and fix admin metrics visibility 2025-12-22 10:15:29 +01:00
f0588418c8 Industrial Dark UI Overhaul: Updated colors, typography, navigation, and component styling across the application 2025-12-22 00:05:31 +01:00
cf491d83b6 DramLog UI Overhaul: Rebranding, Navigation Improvements, and Scan Workflow Fixes
- Renamed app to DramLog and updated branding to Gold (#C89D46)
- Implemented new BottomNavigation with Floating Scan Button
- Fixed 'black screen' race condition in ScanAndTasteFlow
- Refactored TastingEditor and StatsDashboard for a cleaner editorial look
- Standardized colors and typography across the application
2025-12-21 23:41:33 +01:00
b57f5dc2ad feat: refine Scan & Taste UI, fix desktop scrolling, and resolve production login fetch error
- Reverted theme from gold to amber and restored legacy typography.
- Refactored ScanAndTasteFlow and TastingEditor for robust desktop scrolling.
- Hotfixed sw.js to completely bypass Supabase Auth/API requests to fix 'Failed to fetch' in production.
- Integrated full tasting note persistence (tags, buddies, sessions).
2025-12-21 22:29:16 +01:00
716afce2ae feat: move offline indicator to header, rename to Offline-Modus, and redesign tasting form 2025-12-21 00:13:33 +01:00
7d5091a139 fix: resolve pre-cache 404s and implement Bunker v7 with SWR 2025-12-20 23:44:37 +01:00
fdc1dd01e5 feat: Complete Flight Recorder with Session Closing and UI feedback 2025-12-19 21:06:16 +01:00
822dc18bfc style: Improve active session visibility and fix mobile timeline layout 2025-12-19 21:01:48 +01:00
e8c3032954 feat: Add Flight Recorder, Timeline, ABV Curve and Offline Bottle Caching with Draft Notes support 2025-12-19 20:45:20 +01:00
24e243fff8 feat: Upgrade to Next.js 16.1 & React 19.2, migrate to Supabase SSR with async client handling 2025-12-19 20:31:46 +01:00
60ca3a6190 feat: implement robust offline-first sync with Dexie.js
- Migrated to Dexie.js for IndexedDB management
- Added optimistic UI for tasting notes with 'Wartet auf Sync' badge
- Implemented background caching for tags and buddies
- Unified scanning and tasting sync in a global UploadQueue
2025-12-19 13:40:56 +01:00
b2a1d292da feat: implement advanced tagging system, tag weighting, and app focus refactoring
- Implemented reusable TagSelector component with i18n support
- Added tag weighting system (popularity scores 1-5)
- Created admin panel for tag management
- Integrated Nebius AI and Brave Search for 'Magic Scan'
- Refactored app focus: removed bottle status, updated counters, and displayed extended bottle details
- Updated i18n for German and English
- Added database migration scripts
2025-12-19 12:58:44 +01:00
9eb9b41061 feat: implement server-side image compression with sharp and cleanup RLS policies 2025-12-18 22:08:28 +01:00
17727243be feat: add global auth listener with hard reload on logout 2025-12-18 21:45:27 +01:00
6f32bfa17f feat: add visual eyecatcher to session detail header 2025-12-18 21:38:10 +01:00
ec9468f671 fix: resolve dynamic server usage error in debug-admin API route 2025-12-18 21:33:57 +01:00
42d8191c1a fix(pwa): add visibilitychange listener for Android sleep issues 2025-12-18 21:28:46 +01:00
087292f65d feat: improve PWA auth robustness and session management 2025-12-18 21:27:00 +01:00
7008bbfd84 feat: social UI optimization, collapsible sections, and admin fixes 2025-12-18 21:16:09 +01:00
a64e8f17a1 feat: session deletion, improved tasting deletion visibility, and PWA login loop fix 2025-12-18 21:02:44 +01:00
c63a348e6b fix: add defensive fallbacks for missing database relationships 2025-12-18 20:35:38 +01:00
869c8fe9c5 feat: add stop session button and update walkthrough 2025-12-18 17:20:49 +01:00
ca1621e765 feat: refine session workflow with global state, quick tasting, and statistics 2025-12-18 17:19:38 +01:00
0f56c8b0f4 feat: add gallery upload and fix mobile header issues
- Added 'Upload from Gallery' button to CameraCapture component
- Implemented secondary file input without 'capture' attribute to allow gallery selection on mobile
- Fixed overlapping header elements on mobile by making the header responsive
- Compacted 'Dram of the Day' button on small screens
- Added translations for the new gallery upload feature
2025-12-18 15:48:11 +01:00
960fa89fc1 fix: resolve relationship error in admin dashboard
- Fetched api_usage and profiles separately to avoid Supabase join errors when relationships are not explicitly defined in the schema cache.
- Updated Gemini AI tracking integration to ensure all calls are recorded correctly.
- Improved error handling in admin dashboard.
2025-12-18 15:43:40 +01:00
f25aad401e fix: add debug info to recent API calls display
Added total count display and error message output to help debug
why API calls are logged but not displayed in the UI.
2025-12-18 15:39:46 +01:00
1cfa9cab8c feat: add Gemini AI tracking and fix admin dashboard
- Integrated API tracking into analyze-bottle service
- Added credit balance check before Gemini API calls
- Deduct credits after successful Gemini analysis
- Track both successful and failed Gemini API calls
- Added debug logging to admin dashboard for recent API calls
- Fixed error handling in analyze-bottle

Now tracks both Google Search and Gemini AI API usage!
2025-12-18 15:35:02 +01:00