Commit Graph
100 Commits
Author SHA1 Message Date
LarsandClaude Opus 4.6 1644b34d5c fix: manual sleep entry creation + import overwrite protection
Deploy Development / deploy (push) Successful in 43s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Critical fixes:
1. Added "+ Schlaf erfassen" button back (was missing!)
   - Opens NewEntryForm component inline
   - Default: 450 min (7h 30min), quality 3
   - Collapsible detail view
   - Live plausibility check

2. Fixed import overwriting manual entries
   - Problem: ON CONFLICT WHERE clause didn't prevent updates
   - Solution: Explicit if/else logic
     - If manual entry exists → skip (don't touch)
     - If non-manual entry exists → UPDATE
     - If no entry exists → INSERT
   - Properly counts imported vs skipped

Test results:
✅ CSV import with drag & drop
✅ Inline editing
✅ Segment timeline view with colors
✅ Source badges (Manual/Apple Health)
✅ Plausibility check (backend + frontend)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:43:02 +01:00
LarsandClaude Opus 4.6 b52c877367 feat: complete sleep module overhaul - app standard compliance
Deploy Development / deploy (push) Successful in 45s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Backend improvements:
- Plausibility check: phases must sum to duration (±5 min tolerance)
- Auto-calculate wake_count from awake segments in import
- Applied to both create_sleep and update_sleep endpoints

Frontend complete rewrite:
- ✅ Drag & Drop CSV import (like NutritionPage)
- ✅ Inline editing (no scroll to top, edit directly in list)
- ✅ Toast notifications (no more alerts, auto-dismiss 4s)
- ✅ Source badges (Manual/Apple Health/Garmin with colors)
- ✅ Expandable segment timeline view (JSONB sleep_segments)
- ✅ Live plausibility check (shows error if phases ≠ duration)
- ✅ Color-coded sleep phases (deep/rem/light/awake)
- ✅ Show wake_count in list view

Design improvements:
- Stats card on top (7-day avg)
- Import drag zone with visual feedback
- Clean inline edit mode with validation
- Timeline view with phase colors
- Responsive button layout

Confirmed: Kernschlaf (Apple Health) = Leichtschlaf (light_minutes) ✓

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 13:09:34 +01:00
LarsandClaude Opus 4.6 da376a8b18 feat: store full datetime in sleep_segments JSONB
Deploy Development / deploy (push) Successful in 47s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Enhanced sleep_segments data structure:
- start: ISO datetime (2026-03-21T22:30:00) instead of HH:MM
- end: ISO datetime (2026-03-21T23:15:00) - NEW
- phase: sleep phase type
- duration_min: duration in minutes

Benefits:
- Exact timestamp for each segment (no date ambiguity)
- Can reconstruct complete sleep timeline
- Enables precise cycle analysis
- Handles midnight crossings correctly

Example:
[
  {"phase": "light", "start": "2026-03-21T22:30:00", "end": "2026-03-21T23:15:00", "duration_min": 45},
  {"phase": "deep", "start": "2026-03-21T23:15:00", "end": "2026-03-22T00:30:00", "duration_min": 75}
]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:57:20 +01:00
LarsandClaude Opus 4.6 9a9c597187 fix: sleep import groups segments by gap instead of date boundary
Deploy Development / deploy (push) Successful in 48s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Problem: Segments crossing midnight were split into different nights
- 22:30-23:15 (21.03) → assigned to 21.03
- 00:30-02:45 (22.03) → assigned to 22.03
But both belong to the same night (21/22.03)!

Solution: Gap-based grouping
- Sort segments chronologically
- Group segments with gap < 2 hours
- Night date = wake_time.date() (last segment's end date)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 12:09:25 +01:00
LarsandClaude Opus 4.6 b1a92c01fc feat: Apple Health CSV import for sleep data (v9d Phase 2c)
Deploy Development / deploy (push) Successful in 45s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 1s
Backend:
- New endpoint POST /api/sleep/import/apple-health
- Parses Apple Health sleep CSV format
- Maps German phase names (Kern→light, REM→rem, Tief→deep, Wach→awake)
- Aggregates segments by night (wake date)
- Stores raw segments in JSONB (sleep_segments)
- Does NOT overwrite manual entries (source='manual')

Frontend:
- Import button in SleepPage with file picker
- Progress indicator during import
- Success/error messages
- Auto-refresh after import

Documentation:
- Added architecture rules reference to CLAUDE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 11:49:09 +01:00
LarsandClaude Opus 4.6 b65efd3b71 feat: add missing migration 008 (vitals, rest days, sleep_goal_minutes)
Deploy Development / deploy (push) Successful in 44s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Creates rest_days table for rest day tracking
- Creates vitals_log table for resting HR + HRV
- Creates weekly_goals table for training planning
- Extends profiles with hf_max and sleep_goal_minutes columns
- Extends activity_log with avg_hr and max_hr columns
- Fixes sleep_goal_minutes missing column error in stats endpoint
- Includes stats error handling in SleepWidget

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 10:59:55 +01:00
LarsandClaude Opus 4.6 9e4d6fa715 fix: make sleep stats optional to prevent page crash
Deploy Development / deploy (push) Successful in 45s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
If stats endpoint fails, page will still load with empty stats.
This prevents 500 errors from blocking the entire sleep page.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 08:33:28 +01:00
LarsandClaude Opus 4.6 836bc4294b fix: convert empty strings to None for TIME fields in sleep router
Deploy Development / deploy (push) Successful in 43s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
PostgreSQL TIME type doesn't accept empty strings.
Converting empty bedtime/wake_time to None before INSERT/UPDATE.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 08:28:44 +01:00
LarsandClaude Opus 4.6 39d676e5c8 fix: migration 009 - change profile_id from VARCHAR(36) to UUID
Deploy Development / deploy (push) Successful in 43s
Build Test / build-frontend (push) Successful in 14s
Build Test / lint-backend (push) Successful in 0s
Profile IDs are UUID type in the profiles table, not VARCHAR.
This was causing foreign key constraint error on migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 08:22:58 +01:00
LarsandClaude Opus 4.6 ef81c46bc0 feat: v9d Phase 2b - Sleep Module Core (Schlaf-Modul)
Deploy Development / deploy (push) Successful in 45s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Add sleep_log table with JSONB sleep_segments (Migration 009)
- Add sleep router with CRUD + stats endpoints (7d avg, 14d debt, trend, phases)
- Add SleepPage with quick/detail entry forms and inline edit
- Add SleepWidget to Dashboard showing last night + 7d average
- Add sleep navigation entry with Moon icon
- Register sleep router in main.py
- Add 9 new API methods in api.js

Phase 2b complete - ready for testing on dev

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-22 08:17:11 +01:00
LarsandClaude Opus 4.6 40a4739349 docs: mark v9d Phase 1b as deployed to production
Deploy Development / deploy (push) Successful in 55s
Build Test / build-frontend (push) Successful in 14s
Build Test / lint-backend (push) Successful in 0s
- Successful production deployment confirmed (21.03.2026)
- Document complete learnable mapping system
- List all 4 migrations (004-007)
- Update roadmap: Phase 2 next

v9d Phase 1b complete:
- 29 training types
- DB-based learnable mapping system
- Apple Health import with German support
- Inline editing UX
- Auto-learning from bulk categorization

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 21:25:18 +01:00
LarsandClaude Opus 4.6 3be82dc8c2 feat: inline editing for activity mappings (improved UX)
Deploy Development / deploy (push) Successful in 43s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Edit form now appears at the position of the item being edited
- No scrolling needed - stays at same location
- Matches ActivityPage inline editing behavior
- Visual indicator: Accent border when editing
- Create form still appears at top (separate from list)

Benefits:
- Better UX - no need to scroll to top
- Easier to find edited item after saving
- Consistent with rest of app

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 19:46:11 +01:00
LarsandClaude Opus 4.6 829edecbdc feat: learnable activity type mapping system (DB-based, auto-learning)
Deploy Development / deploy (push) Successful in 43s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Replaces hardcoded mappings with database-driven, self-learning system.

Backend:
- Migration 007: activity_type_mappings table
  - Supports global and user-specific mappings
  - Seeded with 40+ default mappings (German + English)
  - Unique constraint: (activity_type, profile_id)
- Refactored: get_training_type_for_activity() queries DB
  - Priority: user-specific → global → NULL
- Bulk categorization now saves mapping automatically
  - Source: 'bulk' for learned mappings
- admin_activity_mappings.py: Full CRUD endpoints
  - List, Get, Create, Update, Delete
  - Coverage stats endpoint
- CSV import uses DB mappings (no hardcoded logic)

Frontend:
- AdminActivityMappingsPage: Full mapping management UI
  - Coverage stats (% mapped, unmapped count)
  - Filter: All / Global
  - Create/Edit/Delete mappings
  - Tip: System learns from bulk categorization
- Added route + admin link
- API methods: adminList/Get/Create/Update/DeleteActivityMapping

Benefits:
- No code changes needed for new activity types
- System learns from user bulk categorizations
- User-specific mappings override global defaults
- Admin can manage all mappings via UI
- Migration pre-populates 40+ common German/English types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 19:31:58 +01:00
LarsandClaude Opus 4.6 a4bd738e6f fix: Apple Health import - German names + duplicate detection
Deploy Development / deploy (push) Successful in 50s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 1s
Issue 1: Automatic training type mapping didn't work
- Root cause: Only English workout names were mapped
- Solution: Added 20+ German workout type mappings:
  - "Traditionelles Krafttraining" → hypertrophy
  - "Outdoor Spaziergang" → walk
  - "Innenräume Spaziergang" → walk
  - "Matrial Arts" → technique (handles typo)
  - "Cardio Dance" → dance
  - "Geist & Körper" → yoga
  - Plus: Laufen, Gehen, Radfahren, Schwimmen, etc.

Issue 2: Reimporting CSV created duplicates without training types
- Root cause: Import always did INSERT with new UUID, no duplicate check
- Solution: Check if entry exists (profile_id + date + start_time)
  - If exists: UPDATE with new data + training type mapping
  - If new: INSERT as before
- Handles multiple workouts per day (different start times)
- "Skipped" count now includes updated entries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 19:16:09 +01:00
LarsandClaude Opus 4.6 4d9ef5b33b docs: mark v9d Phase 1b as complete, ready for production
Deploy Development / deploy (push) Successful in 48s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Update status: Phase 1b complete on develop
- Document all 29 training types
- List all completed features
- Ready for testing and prod deployment
- Next: v9d Phase 2 (Ruhetage, Ruhepuls, HF-Zonen, Schlaf)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 19:02:56 +01:00
LarsandClaude Opus 4.6 d4826c8df4 feat: add training type badges to activity list (v9d Phase 1b complete)
Build Test / build-frontend (push) Waiting to run
Deploy Development / deploy (push) Has been cancelled
Build Test / lint-backend (push) Waiting to run
- Load training categories in ActivityPage
- Display colored badge next to activity name in list view
- Badge shows category icon + name with category color
- Only shown if training_category is set
- Completes v9d Phase 1b

Ready for testing and production deployment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 19:02:25 +01:00
LarsandClaude Opus 4.6 967d92025c fix: move TrainingTypeDistribution to History + improve admin form UX
Deploy Development / deploy (push) Successful in 43s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
UX improvements based on user feedback:

1. Move TrainingTypeDistribution from ActivityPage to History page
   - ActivityPage is for data entry, not visualization
   - History (Verlauf) shows personal development/progress
   - Chart now respects period selector (7/30/90/365 days)

2. Improve AdminTrainingTypesPage form styling
   - All input fields now full width (100%)
   - Labels changed from inline to headings above fields
   - Textareas increased from 2 to 4 rows
   - Added resize: vertical for textareas
   - Increased gap between fields from 12px to 16px
   - Follows style guide conventions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 16:56:35 +01:00
LarsandClaude Opus 4.6 eecc00e824 feat: admin CRUD for training types + distribution chart in ActivityPage
Deploy Development / deploy (push) Successful in 50s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Backend (v9d Phase 1b):
- Migration 006: Add abilities JSONB column + descriptions
- admin_training_types.py: Full CRUD endpoints for training types
  - List, Get, Create, Update, Delete
  - Abilities taxonomy endpoint (5 dimensions: koordinativ, konditionell, kognitiv, psychisch, taktisch)
  - Validation: Cannot delete types in use
- Register admin_training_types router in main.py

Frontend:
- AdminTrainingTypesPage: Full CRUD UI
  - Create/edit form with all fields (category, subcategory, names, icon, descriptions, sort_order)
  - List grouped by category with color coding
  - Delete with usage check
  - Note about abilities mapping coming in v9f
- Add TrainingTypeDistribution to ActivityPage stats tab
- Add admin link in AdminPanel (v9d section)
- Update api.js with admin training types methods

Notes:
- Abilities mapping UI deferred to v9f (flexible prompt system)
- Placeholders (abilities column) in place for future AI analysis

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 15:32:32 +01:00
LarsandClaude Opus 4.6 d164ab932d feat: add extended training types (cardio walk/dance, mind & meditation)
Deploy Development / deploy (push) Successful in 49s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Migration 005: Add cardio subcategories (Gehen, Tanzen)
- Migration 005: Add new category "Geist & Meditation" with 4 subcategories
  (Meditation, Atemarbeit, Achtsamkeit, Visualisierung)
- Update categories endpoint with mind category metadata
- Update Apple Health mapping: dance → dance, add meditation/mindfulness
- 6 new training types total

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 15:16:07 +01:00
LarsandClaude Opus 4.6 96b0acacd2 feat: automatic training type mapping for Apple Health import and bulk categorization
Deploy Development / deploy (push) Successful in 48s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Add get_training_type_for_apple_health() mapping function (23 workout types)
- CSV import now automatically assigns training_type_id/category/subcategory
- New endpoint: GET /activity/uncategorized (grouped by activity_type)
- New endpoint: POST /activity/bulk-categorize (bulk update training types)
- New component: BulkCategorize with two-level dropdown selection
- ActivityPage: new "Kategorisieren" tab for existing activities
- Update CLAUDE.md: v9d Phase 1b progress

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 15:08:18 +01:00
LarsandClaude Opus 4.6 08cead49fe feat(v9d): integrate training type UI components
Deploy Development / deploy (push) Successful in 44s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s
Phase 1b - UI Integration:
===========================

ActivityPage:
- Replace old activity type dropdown with TrainingTypeSelect
- Add training_type_id, training_category, training_subcategory to form
- Two-level selection (category → subcategory)

Dashboard:
- Add TrainingTypeDistribution card (pie chart)
- Shows last 28 days activity distribution by type
- Conditional rendering (only if activities exist)

Still TODO:
- History: Add type badge display (next commit)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 14:56:11 +01:00
LarsandClaude Opus 4.6 df01ee3de3 docs: mark v9d Phase 1 as deployed and tested
Deploy Development / deploy (push) Successful in 46s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Training types system: ✅ deployed to dev
- Logout button: ✅ tested and working
- Migration 004: ✅ applied successfully (23 types)
- API endpoints: ✅ functional

Next: Phase 1b (UI integration)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 13:46:55 +01:00
LarsandClaude Opus 4.6 410b2ce308 feat(v9d): add training types system + logout button
Deploy Development / deploy (push) Successful in 49s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Phase 1: Training Types Basis
=============================

Backend:
- Migration 004: training_types table + seed data (24 types)
- New router: /api/training-types (grouped, flat, categories)
- Extend activity_log: training_type_id, training_category, training_subcategory
- Extend ActivityEntry model: support training type fields

Frontend:
- TrainingTypeSelect component (two-level dropdown)
- TrainingTypeDistribution component (pie chart)
- API functions: listTrainingTypes, listTrainingTypesFlat, getTrainingCategories

Quick Win: Logout Button
========================
- Add LogOut icon button in app header
- Confirm dialog before logout
- Redirect to / after logout
- Hover effect: red color on hover

Not yet integrated:
- TrainingTypeSelect not yet in ActivityPage form
- TrainingTypeDistribution not yet in Dashboard
  (will be added in next commit)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 13:05:33 +01:00
LarsandClaude Opus 4.6 0aca5fda5d docs: update CLAUDE.md for v9c completion and new bug fixes
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 12s
- Mark v9c as deployed to production (21.03.2026)
- Add BUG-005 to BUG-008 (login/verify navigation fixes)
- Document TrialBanner mailto change (on develop)
- Mark v9d as in progress

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 12:56:18 +01:00
LarsandClaude Opus 4.6 526da02512 fix: change trial banner button to mailto contact link
Deploy Development / deploy (push) Successful in 50s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Replace subscription selection link with email contact for now.
Future: Central subscription system on jinkendo.de for all apps.

Button text:
- "Abo wählen" → "Abo anfragen"
- "Jetzt upgraden" → "Kontakt aufnehmen"

Opens mailto:mitai@jinkendo.de with pre-filled subject and body.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 12:52:13 +01:00
LarsandClaude Opus 4.6 3dc3774d76 fix: parse JSON error messages and redirect to dashboard
Deploy Development / deploy (push) Successful in 53s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
1. Parse JSON error responses to extract 'detail' field
   Fixes: {"detail":"..."} shown as raw JSON instead of clean text
2. Redirect 'already_verified' to '/' instead of '/login'
   Fixes: Users land on empty page when already logged in
3. Change button text: "Jetzt anmelden" → "Weiter zum Dashboard"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 12:35:04 +01:00
LarsandClaude Opus 4.6 1cd93d521e fix: email verification redirect and already-used token message
Deploy Development / deploy (push) Successful in 50s
Build Test / build-frontend (push) Successful in 14s
Build Test / lint-backend (push) Successful in 0s
1. Use window.location.href instead of navigate() for reliable redirect
2. Improve backend error message for already-used verification tokens
3. Show user-friendly message when token was already verified
4. Reduce redirect delay from 2s to 1.5s for better UX

Fixes:
- Empty page after email verification
- Generic error when clicking verification link twice

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 12:28:51 +01:00
LarsandClaude Opus 4.6 1521c2f221 fix: redirect to dashboard after successful login
Deploy Development / deploy (push) Successful in 47s
Build Test / build-frontend (push) Successful in 14s
Build Test / lint-backend (push) Successful in 0s
LoginScreen was not navigating after login, leaving users on empty page.
Now explicitly redirects to '/' (dashboard) after successful login.

This fixes the "empty page after first login" issue.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 12:09:37 +01:00
LarsandClaude Opus 4.6 2e68b29d9c fix: improve Dashboard error handling and add debug logging
Deploy Development / deploy (push) Successful in 43s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Add .catch() handler to load() Promise to prevent infinite loading state
- Add console.log statements for component lifecycle debugging
- Make EmailVerificationBanner/TrialBanner conditional on activeProfile
- Ensure greeting header always renders with fallback

This should fix the empty dashboard issue for new users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 11:56:09 +01:00
LarsandClaude Opus 4.6 e62b05c224 fix: prevent React StrictMode double execution in Verify
Deploy Development / deploy (push) Successful in 56s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Added hasVerified flag to prevent useEffect from running twice
in React 18 StrictMode (development mode).

This was causing:
1. First call: 200 OK - verification successful
2. Second call: 400 Bad Request - already verified
3. Error shown to user despite successful verification

The fix ensures verify() only runs once per component mount.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 11:38:03 +01:00
LarsandClaude Opus 4.6 ca9112ebc0 fix: email verification auto-login and user experience
Deploy Development / deploy (push) Successful in 37s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
AuthContext:
- Added setAuthFromToken() for direct token/profile set
- Used for email verification auto-login (no /login request)
- Properly initializes session with token and profile

Verify.jsx:
- Fixed auto-login: now uses setAuthFromToken() instead of login()
- Added "already_verified" status for better UX
- Auto-redirect to /login after 3s if already verified
- Shows friendly message instead of error

This fixes:
- 422 Unprocessable Entity error during auto-login
- Empty dashboard page after verification (now redirects correctly)
- "Ungültiger Link" error on second click (now shows "bereits bestätigt")

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 10:32:24 +01:00
LarsandClaude Opus 4.6 f843d71d6b feat: resend verification email functionality
Deploy Development / deploy (push) Successful in 36s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Backend:
- Added POST /api/auth/resend-verification endpoint
- Rate limited to 3/hour to prevent abuse
- Generates new verification token (24h validity)
- Sends new verification email

Frontend:
- Verify.jsx: Added "expired" status with resend flow
- Email input + "Neue Bestätigungs-E-Mail senden" button
- EmailVerificationBanner: Added "Neue E-Mail senden" button
- Shows success/error feedback inline
- api.js: Added resendVerification() helper

User flows:
1. Expired token → Verify page shows resend form
2. Email lost → Dashboard banner has resend button
3. Both flows use same backend endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 10:23:38 +01:00
LarsandClaude Opus 4.6 9fb6e27256 fix: email verification flow and trial system
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 14s
Build Test / lint-backend (push) Successful in 0s
Backend fixes:
- Fixed timezone-aware datetime comparison in verify_email endpoint
- Added trial_ends_at (14 days) for new registrations
- All datetime.now() calls now use timezone.utc

Frontend additions:
- Added EmailVerificationBanner component for unverified users
- Banner shows warning before trial banner in Dashboard
- Clear messaging about verification requirement

This fixes the 500 error on email verification and ensures new users
see both verification and trial status correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 10:20:06 +01:00
LarsandClaude Opus 4.6 49467ca6e9 docs: document automatic migrations system
Deploy Development / deploy (push) Successful in 36s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Updated CLAUDE.md to reflect new database migrations system:
- Added backend/migrations/ to directory structure
- Added schema_migrations table to database schema
- Updated deployment section with migration workflow
- Added reference to .claude/docs/technical/MIGRATIONS.md

The migrations system automatically applies SQL files (XXX_*.sql pattern)
on container startup, with tracking in schema_migrations table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 10:12:28 +01:00
LarsandClaude Opus 4.6 913b485500 fix: only process numbered migrations (XXX_*.sql pattern)
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Modified run_migrations() to only process files matching pattern: \d{3}_*.sql
This prevents utility scripts (check_features.sql) and manually applied
migrations (v9c_*.sql) from being executed.

Only properly numbered migrations like 003_add_email_verification.sql
will be processed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 10:08:56 +01:00
LarsandClaude Opus 4.6 22651647cb fix: add automatic migration system to db_init.py
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Added migration tracking and execution to db_init.py:
- Created schema_migrations table to track applied migrations
- Added run_migrations() to automatically apply pending SQL files
- Migrations from backend/migrations/*.sql are now applied on startup

This fixes the missing email verification columns (migration 003).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 10:07:37 +01:00
LarsandClaude Opus 4.6 9fa60434c1 fix: correct AuthContext import in Verify.jsx
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Fixed build error where AuthContext was imported directly instead of using the useAuth hook.
Changed from import { AuthContext } + useContext(AuthContext) to import { useAuth } + useAuth().

This was blocking the Docker build and production deployment of v9c.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:59:59 +01:00
LarsandClaude Opus 4.6 514b68e34f docs: v9c finalization complete
Deploy Development / deploy (push) Failing after 24s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Updates:
- Bug-Fixes: Added BUG-003 (chart extrapolation) and BUG-004 (history refresh)
- v9c Finalization: Self-registration + Trial UI marked as complete
- Moved open items to v9d

v9c is now feature-complete and ready for production deployment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:57:26 +01:00
LarsandClaude Opus 4.6 961897ce2f feat: add trial system UI with countdown banner
Deploy Development / deploy (push) Failing after 24s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Component:
- TrialBanner.jsx: Displays remaining trial days with urgency levels

Features:
- Calculates days left from profile.trial_ends_at
- Three urgency levels:
  * Normal (>7 days): Accent blue, "Abo wählen"
  * Warning (≤7 days): Orange, "Abo wählen"
  * Urgent (≤3 days): Red + ⚠️, "Jetzt upgraden"
- Auto-hides when no trial or trial ended
- Responsive flex layout
- Call-to-action button links to /settings?tab=subscription

Integration:
- Added to Dashboard after header greeting
- Uses activeProfile from ProfileContext
- Clean, non-intrusive design

UX:
- Clear messaging: "Trial endet in X Tagen"
- Special case: "morgen" for 1 day left
- Color-coded severity (blue → orange → red)
- Prominent CTA button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:56:35 +01:00
LarsandClaude Opus 4.6 86f7a513fe feat: add self-registration frontend
Deploy Development / deploy (push) Failing after 25s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Components:
- Register.jsx: Registration form with validation
- Verify.jsx: Email verification page with auto-login
- API calls: register(), verifyEmail()

Features:
- Form validation (name min 2, email format, password min 8, password confirm)
- Success screen after registration (check email)
- Auto-login after verification → redirect to dashboard
- Error handling for invalid/expired tokens
- Link to registration from login page

Routes:
- /register → public (no login required)
- /verify?token=xxx → public
- Pattern matches existing /reset-password handling

UX:
- Clean success/error states
- Loading spinners
- Auto-redirect after verify (2s)
- "Jetzt registrieren" link on login

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:55:23 +01:00
LarsandClaude Opus 4.6 c1562a27f4 feat: add self-registration with email verification
Backend:
- New endpoint: POST /api/auth/register
- New endpoint: GET /api/auth/verify/{token}
- Migration: Add email_verified, verification_token, verification_expires
- Helper: send_email() for reusable SMTP
- Validation: email format, password length (min 8), name
- Auto-login after verification (returns session token)
- Rate limit: 3 registrations per hour per IP

Features:
- Verification token valid for 24h
- Existing users marked as verified (grandfather clause)
- SMTP configured via .env (SMTP_HOST, SMTP_USER, SMTP_PASS)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:53:11 +01:00
LarsandClaude Opus 4.6 888b5c3e40 fix: [BUG-003] correlations chart shows all weight data with extrapolation
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Changes:
- Show all data points (kcal OR weight, not only both)
- Extrapolate missing kcal values at end (use last known value)
- Dashed lines (strokeDasharray) for extrapolated values
- Solid lines for real measurements
- Weight always interpolates gaps (connectNulls=true)

Visual distinction:
- Solid = Real measurements + gap interpolation
- Dashed = Extrapolation at chart end

Closes: BUG-003

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:51:20 +01:00
LarsandClaude Opus 4.6 d1675dcc80 fix: [BUG-004] import history refreshes after CSV import
Solution: Force remount ImportHistory via key prop
- Added importHistoryKey state (timestamp)
- Update key after import → triggers useEffect reload
- ImportHistory now updates immediately after import

Closes: BUG-004

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 09:50:35 +01:00
LarsandClaude Opus 4.6 770a49b5f3 fix: update version string to v9c
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:59:24 +01:00
LarsandClaude Opus 4.6 0ab13c282e docs: update CLAUDE.md for v9c completion
Deploy Development / deploy (push) Successful in 35s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 12s
Changes:
- Version: v9c-dev → v9c (komplett)
- Added nutrition module enhancements (manual entry, edit/delete, filters, import history)
- Documented bug fixes (BUG-001, BUG-002)
- Moved open items to v9d
- Two-level tab layout documented

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:47:04 +01:00
LarsandClaude Opus 4.6 1f1100c289 refactor: restructure nutrition page with two-level tabs
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Layout changes:
- Input tabs at top: ✏️ Einzelerfassung (default) | 📥 Import
- Single entry form shown by default (was hidden in data tab)
- Import panel + history only visible in Import tab
- Analysis section below (unchanged): OverviewCards + Analysis tabs

Benefits:
- Cleaner separation of input methods vs analysis
- Manual entry more discoverable (was buried in data tab)
- Import history only shown when relevant
- Reduces clutter on initial view

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:43:55 +01:00
LarsandClaude Opus 4.6 02ca9772d6 feat: add manual nutrition entry form with auto-detect
Deploy Development / deploy (push) Successful in 34s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s
Features:
- Manual entry form above data list
- Date picker with auto-load existing entries
- Upsert logic: creates new or updates existing entry
- Smart button text: "Hinzufügen" vs "Aktualisieren"
- Prevents duplicate entries per day
- Feature enforcement for nutrition_entries

Backend:
- POST /nutrition - Create or update entry (upsert)
- GET /nutrition/by-date/{date} - Load entry by date
- Auto-detects existing entry and switches to UPDATE mode
- Increments usage counter only on INSERT

Frontend:
- EntryForm component with date picker + macros inputs
- Auto-loads data when date changes
- Shows info message when entry exists
- Success/error feedback
- Disabled state while loading/saving

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:37:01 +01:00
LarsandClaude Opus 4.6 873f08042e feat: add date filter to nutrition data tab
Deploy Development / deploy (push) Successful in 33s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 1s
Added dropdown filter with options:
- Letzte 7 Tage
- Letzte 30 Tage (default)
- Letzte 90 Tage
- Letztes Jahr
- Alle anzeigen

Shows filtered count vs total count in title.
Handles large datasets (7+ years) efficiently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:33:03 +01:00
LarsandClaude Opus 4.6 0f072f4735 feat: add nutrition entry editing and import history
Deploy Development / deploy (push) Successful in 33s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Features:
- Import history panel showing all CSV imports with date, count, and range
- Edit/delete functionality for nutrition entries (inline editing)
- New backend endpoints: GET /import-history, PUT /{id}, DELETE /{id}

UI Changes:
- Import history displayed under import panel
- "Daten" tab now has edit/delete buttons per entry
- Inline form for editing macros (kcal, protein, fat, carbs)
- Confirmation dialog for deletion

Backend:
- nutrition.py: Added import_history, update_nutrition, delete_nutrition endpoints
- Groups imports by created date to show history

Frontend:
- NutritionPage: New DataTab and ImportHistory components
- api.js: Added nutritionImportHistory, updateNutrition, deleteNutrition

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:26:47 +01:00
LarsandClaude Opus 4.6 d833a60ad4 fix: [BUG-002] add missing Daten tab to show nutrition entries
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Problem: Imported nutrition data not visible in UI
Root Cause: NutritionPage only had analysis tabs, no raw data view
Solution: Added "Daten" tab with entries list showing date, kcal, macros
Tested: Entries now visible after CSV import

Closes: BUG-002

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 08:06:01 +01:00
LarsandClaude Opus 4.6 4d9c59ccf7 fix: [BUG-001] TypeError in nutrition_weekly endpoint
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Problem:
- /api/nutrition/weekly crashed with 500 Internal Server Error
- TypeError: strptime() argument 1 must be str, not datetime.date

Root Cause:
- d['date'] from PostgreSQL is already datetime.date object
- datetime.strptime() expects string input
- Line 156: wk=datetime.strptime(d['date'],'%Y-%m-%d').strftime('%Y-W%V')

Solution:
- Added type check before strptime()
- If date already has strftime method → use directly
- Else → parse as string first
- Works with both datetime.date objects and strings

Tested:
- /nutrition page loads without error
- Weekly aggregation works correctly
- Chart displays nutrition data

Closes: BUG-001

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:58:37 +01:00
LarsandClaude Opus 4.6 f2f089a223 docs: add pending features and known issues tracking
Deploy Development / deploy (push) Successful in 33s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
CLAUDE.md erweitert:
- Verweis auf PENDING_FEATURES.md (ausstehende Enforcement-Items)
- Verweis auf KNOWN_ISSUES.md (Bug-Tracking)

Lokal erstellt (in .claude/):

.claude/docs/PENDING_FEATURES.md:
- Dashboard-Assistent (keine Badges)
- Import-Endpoints ohne Enforcement (Activity CSV, Nutrition CSV)
- Weitere potenzielle Limitierungen (Export-Wiederholungen, etc.)
- Implementierungs-Richtlinien für späteres Nachziehen

.claude/docs/KNOWN_ISSUES.md:
- BUG-001: Nutrition Import-Seite zeigt keine bisherigen Importe
  (Daten vorhanden in Verlauf, aber Import-Panel zeigt keine Historie)
- Technische Schulden (alte AI-Limit-Checks, deprecated export_enabled)
- Bug-Meldung-Prozess dokumentiert

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:55:04 +01:00
LarsandClaude Opus 4.6 fed51453e4 docs: update CLAUDE.md with completed Phase 3+4 status
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 1s
Feature-Enforcement komplett:
- ✅ Phase 1-4 alle abgeschlossen
- 11 Features mit Monitoring, UI-Badges + Blocking
- Verweis auf neue FEATURE_ENFORCEMENT.md Dokumentation

Lokale Dokumentation erstellt:
- .claude/docs/architecture/FEATURE_ENFORCEMENT.md
- Vollständiger Guide für neue Feature-Integration
- Backend + Frontend Pattern mit Beispielen
- Checkliste + Debugging-Tipps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:44:51 +01:00
LarsandClaude Opus 4.6 ed057fe545 feat: complete Phase 4 enforcement UI for all features (frontend)
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Alle verbleibenden Screens mit proaktiver Limit-Anzeige:

- ActivityPage: Manuelle Einträge mit Badge + deaktiviertem Button
- Analysis: AI-Analysen (Pipeline + Einzelanalysen) mit Hover-Tooltip
- NutritionPage: Hat bereits Error-Handling (bulk import)

Konsistentes Pattern:
- Usage-Badge im Titel
- Button deaktiviert + Hover-Tooltip bei Limit
- "🔒 Limit erreicht" Button-Text
- Error-Handling für API-Fehler
- Usage reload nach erfolgreichem Speichern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:42:50 +01:00
LarsandClaude Opus 4.6 4b8e6755dc feat: complete Phase 4 enforcement for all features (backend)
Alle 11 Features blockieren jetzt bei Limit-Überschreitung:

Batch 1 (bereits erledigt):
- weight_entries, circumference_entries, caliper_entries

Batch 2:
- activity_entries
- nutrition_entries (CSV import)
- photos

Batch 3:
- ai_calls (einzelne Analysen)
- ai_pipeline (3-stufige Gesamtanalyse)
- data_export (CSV, JSON, ZIP)
- data_import (ZIP)

Entfernt: Alte check_ai_limit() Calls (ersetzt durch neue Feature-Limits)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:40:37 +01:00
LarsandClaude Opus 4.6 d13c2c7e25 fix: add dashboard weight enforcement and fix hover tooltips
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Dashboard QuickWeight: Feature limit enforcement hinzugefügt
- Hover-Tooltip Fix: Button in div wrapper (disabled buttons zeigen keine nativen tooltips)
- Error handling für Dashboard weight input
- Konsistentes UX über alle Eingabe-Screens

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:25:47 +01:00
LarsandClaude Opus 4.6 0f019f87a4 feat: add feature limit enforcement UI (Phase 4 Batch 1)
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Implementiert User-freundliches Limit-Feedback für Daten-Einträge:
- Button wird deaktiviert wenn Limit erreicht
- Hover-Tooltip erklärt warum ("Limit erreicht X/Y")
- Button-Text zeigt "🔒 Limit erreicht"
- Error-Handling für alle API-Fehler
- Usage-Badge wird nach Speichern aktualisiert

Betrifft: Weight, Circumference, Caliper Screens

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:14:34 +01:00
LarsandClaude Opus 4.6 cf522190c6 fix: correct indentation in auth.py _check_impl function
Deploy Development / deploy (push) Successful in 40s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Behebt IndentationError in Zeile 204 der _check_impl() Funktion.
Die Funktion wurde beim Connection-Pool-Fix erstellt, hatte aber
inkonsistente Einrückungen (8 statt 4 Spaces nach der ersten Zeile).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:06:53 +01:00
LarsandClaude Opus 4.6 329daaef1c fix: prevent connection pool exhaustion in features/usage
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
- Add optional conn parameter to get_effective_tier()
- Add optional conn parameter to check_feature_access()
- Pass existing connection in features.py loop
- Prevents opening 20+ connections simultaneously
- Fixes "connection pool exhausted" error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 07:02:42 +01:00
LarsandClaude Opus 4.6 cbcb6a2a34 feat: Phase 4 Batch 1 - enable enforcement for data entries
Deploy Development / deploy (push) Successful in 36s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Weight, Circumference, Caliper now BLOCK on limit exceeded
- Raise HTTPException(403) with user-friendly message
- Show used/limit and suggest contacting admin
- Phase 2 → Phase 4 transition

Phase 4: Enforcement (Batch 1/3)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 06:57:05 +01:00
LarsandClaude Opus 4.6 baad096ead refactor: consolidate badge styling to CSS classes
Deploy Development / deploy (push) Successful in 36s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Move all positioning logic from inline styles to CSS
- New classes: .badge-container-right, .badge-button-layout
- All badge styling now in UsageBadge.css (single source)
- Easier to maintain and adjust globally
- Mobile responsive adjustments in one place

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 06:54:45 +01:00
LarsandClaude Opus 4.6 30df150b6f refactor: make UsageBadge more subtle and better positioned
Deploy Development / deploy (push) Successful in 36s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Smaller font (0.65rem), more spacing (10px margin)
- Reduced opacity (0.6), hover effect (0.9)
- OK status now gray instead of green (less prominent)
- Position: right-aligned in headings (flex space-between)
- Buttons: badge on right side of main text, description below
- Much more discreet overall appearance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 06:50:12 +01:00
LarsandClaude Opus 4.6 c59c71a1c7 feat: add UsageBadge to action buttons (Phase 3)
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
- Weight page: badge on "Eintrag hinzufügen" heading
- Settings: badges on export buttons (ZIP/JSON)
- Analysis: badges on pipeline and individual analysis titles
- Shows real-time usage status (e.g., "7/5" with red color)

Phase 3: Frontend Display complete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 06:43:10 +01:00
LarsandClaude Opus 4.6 405abc1973 feat: add feature usage UI components (Phase 3)
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
- Add api.getFeatureUsage() endpoint call
- Create UsageBadge component (inline indicators)
- Create FeatureUsageOverview component (Settings table)
- Add "Kontingente" section to Settings page
- Color-coded status (green/yellow/red)
- Grouped by category
- Shows reset period and next reset date

Phase 3: Frontend Display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 06:39:52 +01:00
LarsandClaude Opus 4.6 d10f605d66 feat: add GET /api/features/usage endpoint (Phase 3)
Deploy Development / deploy (push) Successful in 36s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Add user-facing usage overview endpoint
- Returns all features with usage, limits, reset info
- Fully dynamic - automatically includes new features
- Phase 3: Frontend Display preparation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-21 06:32:43 +01:00
LarsandClaude Opus 4.6 4e846605e9 docs: update CLAUDE.md - Phase 2 complete
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 1s
- Mark Feature-Enforcement Phase 2 as complete
- Add 4-phase model status overview
- Document feature_logger.py and JSON logging
- Update DB schema section with user_feature_usage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 22:43:29 +01:00
LarsandClaude Opus 4.6 32d53b447d fix: pipeline typo and add features diagnostic script
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Fix NameError in insights.py pipeline endpoint (access -> access_calls)
- Add check_features.py diagnostic script for debugging

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 22:32:09 +01:00
LarsandClaude Opus 4.6 1298bd235f feat: add structured JSON logging for all feature usage (Phase 2)
Deploy Development / deploy (push) Successful in 35s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
- Create feature_logger.py with JSON logging infrastructure
- Add log_feature_usage() calls to all 9 routers after check_feature_access()
- Logs written to /app/logs/feature-usage.log
- Tracks all usage (not just violations) for future analysis
- Phase 2: Non-blocking monitoring complete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 22:18:12 +01:00
LarsandClaude Opus 4.6 ddcd2f4350 feat: v9c Phase 2 - Backend Non-Blocking Logging (12 Endpoints)
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 1s
PHASE 2: Backend Non-Blocking Logging - KOMPLETT

Instrumentierte Endpoints (12):
- Data: weight, circumference, caliper, nutrition, activity, photos (6)
- AI: insights/run/{slug}, insights/pipeline (2)
- Export: csv, json, zip (3)
- Import: zip (1)

Pattern implementiert:
- check_feature_access() VOR Operation (non-blocking)
- [FEATURE-LIMIT] Logging wenn Limit überschritten
- increment_feature_usage() NACH Operation
- Alte Permission-Checks bleiben aktiv

Features geprüft:
- weight_entries, circumference_entries, caliper_entries
- nutrition_entries, activity_entries, photos
- ai_calls, ai_pipeline
- data_export, data_import

Monitoring: 1-2 Wochen Log-Only-Phase
Logs zeigen: Wie oft würde blockiert werden?
Nächste Phase: Frontend Display (Usage-Counter)

Phase 1 (Cleanup) + Phase 2 (Logging) vollständig!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 21:59:33 +01:00
LarsandClaude Opus 4.6 73bea5ee86 feat: v9c Phase 1 - Feature consolidation & cleanup migration
Deploy Development / deploy (push) Successful in 33s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
PHASE 1: Cleanup & Analyse
- Feature-Konsolidierung: export_csv/json/zip → data_export (1 Feature)
- Umbenennung: csv_import → data_import
- Auto-Migration bei Container-Start (apply_v9c_migration.py)
- Diagnose-Script (check_features.sql)

Lessons Learned angewendet:
- Ein Feature für Export, nicht drei
- Migration ist idempotent (kann mehrfach laufen)
- Zeigt BEFORE/AFTER State im Log

Finaler Feature-Katalog (10 statt 13):
- Data: weight, circumference, caliper, nutrition, activity, photos
- AI: ai_calls, ai_pipeline
- Export/Import: data_export, data_import

Tier Limits:
- FREE: 30 data entries, 0 AI/export/import
- BASIC: unlimited data, 3 AI/month, 5 export/month, 3 import/month
- PREMIUM/SELFHOSTED: unlimited

Migration läuft automatisch auf dev UND prod beim Container-Start.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 18:57:39 +01:00
Lars 7040931816 claude.md überarbeitet
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
2026-03-20 18:22:45 +01:00
LarsandClaude Opus 4.6 ef8008a75d docs: update CLAUDE.md and add comprehensive membership system documentation
Deploy Development / deploy (push) Successful in 33s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Updates:
- CLAUDE.md: Reflect current v9c-dev status (enforcement disabled, history working)
- CLAUDE.md: Document simple AI limit system currently active
- CLAUDE.md: Update implementation status (admin UI complete, enforcement rolled back)

New Documentation:
- docs/MEMBERSHIP_SYSTEM.md: Complete v9c architecture documentation
  - Design decisions and rationale
  - Complete database schema (11 tables)
  - Backend API overview (7 routers, 30+ endpoints)
  - Frontend components (6 admin pages)
  - Feature enforcement rollback analysis
  - Lessons learned and next steps
  - Testing strategy
  - Deployment notes
  - Troubleshooting guide

The new doc provides complete reference for:
- Feature-Registry-Pattern implementation
- Tier system architecture
- Coupon system (3 types with stacking logic)
- User-Override system
- Access-Grant mechanics
- What went wrong with enforcement attempt
- Roadmap for v9d/v9e

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 15:44:29 +01:00
LarsandClaude Opus 4.6 e4f49c0351 fix: enable AI analysis history and correct pipeline scope
Deploy Development / deploy (push) Successful in 33s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Fixes two critical bugs in AI analysis storage:

1. History now works - analyses are saved, not overwritten
   - Removed DELETE statements before INSERT in insights.py
   - All analyses are now preserved per scope
   - Displayed in descending order by creation date

2. Pipeline saves under correct scope 'pipeline' instead of 'gesamt'
   - Changed scope from 'gesamt' to 'pipeline' in pipeline endpoint
   - Pipeline results now appear under correct category in history

3. Fixed pipeline appearing twice in UI
   - Filter now excludes both 'pipeline_*' and 'pipeline' from individual list
   - Pipeline only appears in dedicated section at top

Changes:
- backend/routers/insights.py: Removed DELETE, changed scope to 'pipeline'
- frontend/src/pages/Analysis.jsx: Fixed filter to exclude 'pipeline'

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 15:35:33 +01:00
LarsandClaude Opus 4.6 4fcde4abfb ROLLBACK: complete removal of broken feature enforcement system
Deploy Development / deploy (push) Successful in 32s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Reverts all feature enforcement changes (commits 3745ebd, cbad50a, cd4d912, 8415509)
to restore original working functionality.

Issues caused by feature enforcement implementation:
- Export buttons disappeared and never reappeared
- KI analysis counter not incrementing
- New analyses not saving
- Pipeline appearing twice
- Many core features broken

Restored files to working state before enforcement implementation (commit 0210844):
- Backend: auth.py, insights.py, exportdata.py, importdata.py, nutrition.py, activity.py
- Frontend: Analysis.jsx, SettingsPage.jsx, api.js
- Removed: FeatureGate.jsx, useFeatureAccess.js

The original simple AI limit system (ai_enabled, ai_limit_day) is now active again.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 15:19:56 +01:00
LarsandClaude Opus 4.6 8415509f4c fix: monthly reset now updates reset_at correctly
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Critical bug: usage limits were never resetting after first month because
reset_at timestamp was not updated during ON CONFLICT UPDATE.

This caused users to stay permanently blocked after reaching monthly limit once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 13:14:35 +01:00
Lars cd4d9124b0 fix: auto-apply feature fixes migration on startup
Deploy Development / deploy (push) Successful in 33s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
2026-03-20 12:58:07 +01:00
LarsandClaude Opus 4.6 cbad50a987 fix: add missing feature check endpoint and features
Build Test / build-frontend (push) Waiting to run
Deploy Development / deploy (push) Has been cancelled
Build Test / lint-backend (push) Waiting to run
Critical fixes for feature enforcement:
- Add GET /api/features/{feature_id}/check-access endpoint (was missing!)
- Add migration for missing features: data_export, csv_import
- These features were used in frontend but didn't exist in DB

This fixes:
- "No analysis available" when setting KI limit
- Export features not working
- Frontend calling non-existent API endpoint

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 12:57:29 +01:00
LarsandClaude Opus 4.6 3745ebd6cd feat: implement v9c feature enforcement system
Deploy Development / deploy (push) Successful in 34s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Backend:
- Add feature access checks to insights, export, import endpoints
- Enforce ai_calls, ai_pipeline, data_export, csv_import limits
- Return HTTP 403 (disabled) or 429 (limit exceeded)

Frontend:
- Create useFeatureAccess hook for feature checking
- Create FeatureGate/FeatureBadge components
- Gate KI-Analysen in Analysis page
- Gate Export/Import in Settings page
- Show usage counters (e.g. "3/10")

Docs:
- Update CLAUDE.md with implementation status

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 12:43:41 +01:00
LarsandClaude Opus 4.6 0210844522 docs: CRITICAL - document missing feature enforcement
Deploy Development / deploy (push) Successful in 52s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 12s
⚠️ MAJOR GAP IDENTIFIED: Feature limits don't work!
- Admin UI exists to configure limits
- But actual enforcement (check_feature_access) is NOT called in endpoints
- Users can exceed limits, use disabled features

Backend TODO (CRITICAL):
- Add feature checks to insights.py (AI analysis)
- Add feature checks to exportdata.py, importdata.py
- Add feature checks to nutrition.py, activity.py (imports)
- Add feature checks to photos.py, data entry endpoints

Frontend TODO (UX):
- Implement useFeatureAccess() hook
- Create <FeatureGate> component
- Hide disabled features
- Show limit counters & upgrade prompts

Estimated work: 2-3 hours

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 12:25:31 +01:00
LarsandClaude Opus 4.6 5da18de708 docs: update CLAUDE.md - v9c Phase 3 status and lessons learned
Deploy Development / deploy (push) Successful in 54s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 1s
- Mark Phase 3 as "MOSTLY DONE" (core features complete)
- Document all implemented admin/user pages
- Add AdminUserRestrictionsPage solution to "Bekannte Probleme"
- Detail effective value system, auto-remove redundant overrides
- List remaining v9c tasks: self-registration, trial UI, app settings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 12:14:45 +01:00
LarsandClaude Opus 4.6 4e592dddc5 fix: AdminUserRestrictionsPage - show effective values, auto-remove redundant overrides
Deploy Development / deploy (push) Successful in 54s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Major UX improvements:
- Display effective value in input (override if set, otherwise tier limit)
- Format NULL as "unlimited" (easy to type, no special char needed)
- Auto-remove override when value equals tier default
- "Zurück" button resets to tier default value
- Wider input field (120px) for "unlimited" text

This solves:
- User can now see and edit current effective values
- "unlimited" can be typed and saved
- Redundant overrides (value = tier default) are prevented
- No more confusion with empty fields vs actual values

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 12:08:29 +01:00
LarsandClaude Opus 4.6 adfa9ec139 fix: AdminUserRestrictionsPage - use same tier limits fallback as TierLimitsPage
Deploy Development / deploy (push) Successful in 54s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Use `null` (unlimited) instead of `feature.default_limit` when no
tier_limits entry exists. This fixes Selfhosted tier showing 0
instead of ∞ for features like AI analysis.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 11:57:26 +01:00
LarsandClaude Opus 4.6 85f5938d7d fix: AdminUserRestrictionsPage - use exact TierLimitsPage input system
Deploy Development / deploy (push) Successful in 58s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
- formatValue: NULL → '' (empty field with placeholder ∞)
- handleChange: Accept ONLY '∞' or 'unlimited' (no other formats)
- Input styling: Green only for '∞', empty fields normal color
- Simplified legend: Only ∞ or unlimited accepted
- Boolean features: Toggle buttons with 1/0 values
- Add package-lock.json to .gitignore

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 11:34:48 +01:00
LarsandClaude Opus 4.6 917c8937cf feat: accept multiple formats for unlimited in user overrides
Deploy Development / deploy (push) Successful in 54s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 1s
User can now input unlimited with:
- "unbegrenzt" (German)
- "unlimited" (English)
- "inf"
- "999999"
- "∞" (infinity symbol)

All map to NULL (unlimited) in database.

Updated legend to show:
- "unbegrenzt, inf, 999999" = Unbegrenzt
- Clear documentation for users

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 10:40:56 +01:00
LarsandClaude Opus 4.6 0c0b1ee811 fix: add missing Link import in SettingsPage
Deploy Development / deploy (push) Successful in 55s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 1s
Critical bug fix:
- Added missing "import { Link } from 'react-router-dom'"
- Caused Settings page to crash on render
- Route /settings now works again

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 10:36:00 +01:00
LarsandClaude Opus 4.6 a27f090616 feat: add SubscriptionPage - user-facing subscription info
Deploy Development / deploy (push) Successful in 53s
Build Test / build-frontend (push) Successful in 20s
Build Test / lint-backend (push) Successful in 0s
User can now view:
- Current tier (Free, Basic, Premium, Selfhosted) with icon
- Trial status and end date
- Access expiration date
- Feature limits with usage bars
- Progress indicators (green/orange/red based on usage)
- Reset period info (daily/monthly/never)

Coupon redemption:
- Input field for coupon code
- Auto-uppercase, monospace display
- Enter key support
- Success/error feedback
- Auto-refresh after redemption

Features:
- Clean card-based layout
- Visual tier badges with colors
- Progress bars for count limits
- Trial and access warnings
- Integrated in Settings page

Link added to SettingsPage:
- "👑 Abo-Status, Limits & Coupon einlösen"
- Easy access for all users

Phase 3 complete - all user-facing subscription features done!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 10:31:04 +01:00
LarsandClaude Opus 4.6 3eae7eb43f refactor: remove legacy permission system, use only feature-overrides
Deploy Development / deploy (push) Successful in 55s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
AdminPanel.jsx:
- Removed ai_enabled, ai_limit_day, export_enabled UI
- Kept only role selection (Admin/User)
- Added link to Feature-Overrides page
- Simplified perms state to only role
- Changed display to show tier and email

AdminUserRestrictionsPage.jsx:
- Removed legacy system warning
- Clean interface, no confusion

Result:
- ONE consistent permission system (feature-overrides)
- Clear separation: role in AdminPanel, limits in Feature-Overrides
- No data migration needed (no old users exist)
- System ready for production

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 08:51:49 +01:00
LarsandClaude Opus 4.6 b1a1925360 fix: move buttons to header and add legacy system warning
Deploy Development / deploy (push) Successful in 55s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Button position fixed:
- Moved from fixed bottom bar to header (like TierLimitsPage)
- No longer covers bottom navigation menu
- Always visible when user selected
- "Abbrechen" only shown when changes exist

Legacy system warning added:
- Yellow warning box explaining old permission system
- Old system: ai_enabled, ai_limit_day, export_enabled in profiles table
- New system: feature_restrictions table with overrides
- Warning: both systems can conflict, new system has priority
- Recommendation: use only feature-overrides going forward

This addresses:
1. UI overlap issue (buttons covering navigation)
2. System architecture confusion (two permission systems)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 08:45:06 +01:00
LarsandClaude Opus 4.6 ac56974e83 fix: make buttons always visible in AdminUserRestrictionsPage
Deploy Development / deploy (push) Successful in 1m2s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Bottom bar changes:
- Always visible when user selected (not hidden)
- Buttons disabled when no changes (clearer state)
- Moved outside inner block to prevent hiding

Action column changes:
- "↺ Zurück" button always visible per feature
- Disabled when no override exists (grayed out)
- Consistent button presence improves UX

This fixes the issue where buttons were not shown
because they were conditionally rendered.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 08:26:18 +01:00
LarsandClaude Opus 4.6 5ef6a80a1f fix: add tier limits display and improve buttons in AdminUserRestrictionsPage
Deploy Development / deploy (push) Successful in 58s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Added tier limits column:
- Shows current tier-limit value for each feature
- Loads from tier-limits matrix based on user's tier
- Visual display for boolean (✓ AN / ✗ AUS) and count features
- Clear comparison: Tier-Limit vs Override-Wert

Added per-feature reset button:
- "↺ Zurück zu Standard" button per feature
- Only shown when override exists
- Removes override with single click

Improved bottom bar buttons:
- Renamed "Zurücksetzen" to "Abbrechen" (clearer)
- Always visible (not hidden when no changes)
- Disabled state when no changes
- Shows "Keine Änderungen" when nothing to save

Better UX:
- Tier-Limit column shows what user gets without override
- Override input highlighted when active (accent-light background)
- Clear action buttons per row
- Global save/cancel at bottom

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 08:13:11 +01:00
LarsandClaude Opus 4.6 365fe3d068 fix: complete rewrite of AdminUserRestrictionsPage
Deploy Development / deploy (push) Successful in 58s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Fixed all reported bugs:
1. Initial values now correct (empty = no override, not defaults)
2. Save/Reset buttons always visible (fixed bottom bar)
3. Toggle buttons work correctly (can be toggled multiple times)
4. Simplified table columns (removed confusing Tier-Limit/Aktiv/Aktion)

New logic:
- Empty input = no override (user uses tier standard)
- Value entered = override set
- Change tracking with 3 actions: set, remove, toggle
- Clear status display: "Override aktiv" vs "Tier-Standard"

Simplified table structure:
- Feature (name + type)
- Override-Wert (input/toggle)
- Status (has override yes/no)

Better UX:
- Placeholder text explains empty = tier standard
- Status badge shows if override is active
- Fixed bottom bar always present
- Buttons disabled only when no changes
- Legend explains all input options

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 08:08:02 +01:00
LarsandClaude Opus 4.6 72d8dd8df7 feat: add AdminUserRestrictionsPage for individual user overrides
Deploy Development / deploy (push) Successful in 59s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 1s
Per-user feature limit overrides:
- Select user from dropdown (shows tier)
- View all features with tier limits
- Set individual overrides that supersede tier limits
- Toggle buttons for boolean features
- Text inputs for count features
- Remove overrides to revert to tier limits

Features:
- User info card (avatar, name, email, tier)
- Feature table grouped by category
- Visual indicators for active overrides
- Change tracking with fixed bottom save bar
- Conditional rendering based on limit type
- Info box explaining override priority

UX improvements:
- Clear "Tier-Limit" vs "Override" columns
- Active/Inactive status per feature
- Batch save with change counter
- Confirmation before removing overrides
- Legend for input values

Use cases:
- Beta testers with extended limits
- Support requests for special access
- Temporary feature grants
- Custom enterprise configurations

Integrated in AdminPanel navigation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 07:59:49 +01:00
LarsandClaude Opus 4.6 18991025bf feat: add AdminCouponsPage for coupon management
Deploy Development / deploy (push) Successful in 57s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 1s
Full CRUD interface for coupons:
- Create, edit, delete coupons
- Three coupon types supported:
  - Single-Use: one-time redemption per user
  - Multi-Use Period: unlimited redemptions in timeframe (Wellpass)
  - Gift: bonus system coupons

Features:
- Auto-generate random coupon codes
- Configure tier, duration, validity period
- Set max redemptions (or unlimited)
- View redemption history per coupon (modal)
- Active/inactive state management
- Card-based layout with visual type indicators

Form improvements:
- Conditional fields based on coupon type
- Date pickers for period coupons
- Duration config for single-use/gift
- Help text for each field
- Labels above inputs (consistent with other pages)

Integrated in AdminPanel navigation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 07:53:47 +01:00
LarsandClaude Opus 4.6 bc4db19190 refactor: improve AdminFeaturesPage form layout and UX
Deploy Development / deploy (push) Successful in 1m0s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
Layout improvements:
- Labels now above inputs (not beside)
- Inputs use full width for better readability
- Better spacing and visual hierarchy

Field changes:
- Removed "Einheit" field (unused, confusing)
- "Sortierung" renamed to "Anzeigereihenfolge" with help text
- Added help text under inputs for clarity

Conditional rendering:
- Boolean features: hide Reset-Periode and Standard-Limit
- Show info box explaining Boolean features
- Count features: show all relevant fields

Better UX:
- Clear explanations what each field does
- Visual feedback for different limit types
- Cleaner, more focused interface

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 07:47:00 +01:00
LarsandClaude Opus 4.6 69b6f38c89 refactor: change AdminFeaturesPage to configuration-only interface
Deploy Development / deploy (push) Successful in 56s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 1s
Philosophy change:
- Features are registered via code/migrations, not UI
- AdminFeaturesPage now only configures existing features
- No create/delete functionality

Changes:
- Removed "Neues Feature" button and create form
- Removed delete functionality
- Feature ID now read-only in edit mode
- Added info box explaining feature registration
- Improved status display (Aktiv/Inaktiv)
- Added legend for limit types and reset periods
- Focus on configuration: limit type, reset period, defaults, active state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:46:04 +01:00
LarsandClaude Opus 4.6 07a802dff6 feat: add admin pages for Features and Tiers management
Deploy Development / deploy (push) Successful in 56s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 13s
AdminFeaturesPage:
- Full CRUD for features registry
- Add/edit features with all properties
- Category, limit type, reset period configuration
- Default limits and sorting

AdminTiersPage:
- Full CRUD for subscription tiers
- Pricing configuration (monthly/yearly in cents)
- Active/inactive state management
- Card-based layout with edit/delete actions

Both pages:
- Form validation
- Success/error messaging
- Clean table/card layouts
- Integrated in AdminPanel navigation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:35:13 +01:00
LarsandClaude Opus 4.6 7d6d9dabf2 feat: add toggle buttons for boolean features in matrix editor
Deploy Development / deploy (push) Successful in 55s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Boolean features now show as visual toggle buttons (AN/AUS)
- Desktop: compact toggle (✓ AN / ✗ AUS)
- Mobile: full-width toggle (✓ Aktiviert / ✗ Deaktiviert)
- Prevents invalid values for boolean features
- Green when enabled, gray when disabled

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:28:31 +01:00
LarsandClaude Opus 4.6 8bb5d85c16 fix: show all tiers in admin matrix editor including selfhosted
Deploy Development / deploy (push) Successful in 56s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Remove active=true filter - admins need to configure all tiers
- Add reset_period to features query for frontend display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:19:32 +01:00
LarsandClaude Opus 4.6 759d5e5162 fix: improve AdminTierLimitsPage UX with responsive design
Deploy Development / deploy (push) Successful in 57s
Build Test / build-frontend (push) Successful in 13s
Build Test / lint-backend (push) Successful in 0s
- Fix input bug: cells now editable after deletion (temp value tracking)
- Add responsive design: mobile card view, desktop table view
- Mobile: accordion-style FeatureMobileCard with fixed bottom bar
- Desktop: enhanced table with better visual feedback
- Maintains PWA compatibility (no media query conflicts)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-20 06:17:52 +01:00
LarsandClaude Opus 4.6 9438b5d617 feat: add Tier Limits Matrix Editor (Admin UI)
Deploy Development / deploy (push) Successful in 55s
Build Test / build-frontend (push) Successful in 12s
Build Test / lint-backend (push) Successful in 0s
Phase 3 Frontend - First Component: Matrix Editor

New page: AdminTierLimitsPage
- Displays Tier x Feature matrix (editable table)
- Inline editing for all limit values
- Visual feedback for changes (highlighted cells)
- Batch save with validation
- Category grouping (data, ai, export, integration)
- Legend: ∞ = unlimited (NULL), ❌ = disabled (0), 1-999 = limit
- Responsive table with sticky column headers

Features:
- GET /api/tier-limits - Load matrix
- PUT /api/tier-limits/batch - Save all changes
- Change tracking (shows unsaved count)
- Reset button to discard changes
- Success/error messages

API helpers added (api.js):
- v9c subscription endpoints (user + admin)
- listFeatures, listTiers, getTierLimitsMatrix
- updateTierLimit, updateTierLimitsBatch
- listCoupons, redeemCoupon
- User restrictions, access grants

Navigation:
- Link in AdminPanel (Settings Page)
- Route: /admin/tier-limits

Ready for testing on Dev!

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 15:21:52 +01:00