Repository navigation
Closed
Description
Feature: Currency Preference Database Storage
Overview
Save user's selected currency preferences to the database for authenticated users, ensuring preferences persist across sessions and devices.
Parent Issue
Part of #37 - Add Settings Page with Authentication and User Management
Current Status
- ✅ Currency picker UI implemented in Settings
- ✅ Currency switching works for current session
- ✅ 21 supported currencies available
- ❌ Preferences not saved to database for authenticated users
- ❌ Guest mode still uses localStorage only
Requirements
Database Storage
- Save currency preference to Supabase for authenticated users
- Load saved currency on app startup for authenticated users
- Maintain localStorage fallback for guest users
- Implement proper RLS policies for user preferences
User Experience
- Automatic currency loading when user signs in
- Seamless transition from guest to authenticated user
- Currency preference migration during sign-up
- Visual feedback when preference is saved
Data Migration
- Transfer guest currency selection to user account on authentication
- Handle conflicts if user has different currencies on different devices
- Preserve guest preferences until user chooses to override
Technical Implementation
- Update
useCurrency.tscomposable for database operations - Add currency preference API functions
- Integrate with user preferences table
- Update Settings page to show save status
- Handle online/offline scenarios
Database Integration
user_preferences:
- currency_code (text) // e.g., 'USD', 'EUR', 'GBP'
- currency_symbol (text) // e.g., '$', '€', '£'
- currency_name (text) // e.g., 'US Dollar', 'Euro'Implementation Details
Currency Loading Priority
- Authenticated Users: Database preference
- Fallback: localStorage value
- Default: USD if no preference found
Save Behavior
- Guest Users: localStorage only
- Authenticated Users: Database + localStorage backup
- Auto-save: Immediate save when currency is changed
Migration Flow
Guest User Changes Currency → localStorage
Guest User Signs In → Transfer localStorage → Database
User Changes Currency → Save to Database
Acceptance Criteria
- Authenticated users' currency preferences persist across sessions
- Currency loads automatically when user signs in
- Guest users can still change currency (localStorage)
- Smooth migration from guest to authenticated preferences
- Currency changes are saved immediately for authenticated users
- Fallback to localStorage works when offline
- Clear indication in Settings when preference is saved vs local-only
Technical Considerations
- Handle race conditions during sign-in currency loading
- Implement proper error handling for database save failures
- Consider currency preference conflicts across devices
- Optimize database queries for quick app startup
- Maintain backward compatibility with existing localStorage usage
Priority
High - Users expect their preferences to be saved
Dependencies
- Database schema for user_preferences table
- User preferences integration composable updates
Related Issues
- Add Settings Page with Authentication and User Management #37 - Parent issue for Settings page
- Database Schema Updates issue (to be created)
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat: implement user preferences system with database integration
feat: Add Settings page with authentication UI and improved components (
laminko commentedon Jun 23, 2025
✅ Issue Completed Successfully
Currency preference database storage has been fully implemented with seamless guest/authenticated user support:
💰 Currency Storage Features Implemented:
📁 Key Implementation Files:
🎯 Core Requirements Met:
🔧 Technical Implementation:
🔗 Related Issues:
Currency preferences now work seamlessly for both guest and authenticated users with proper database persistence.
🤖 Generated with Claude Code
Release: Major authentication and user management features (#50)
Release v1.3.0: Facebook OAuth UI removal and version bump (#51)