mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-04 20:28:04 +01:00
- Move files from root docs/ to proper subdirectories - Update all schema documentation to use 'name' (not 'display_name') - Consolidate duplicate testing documentation - Add notes about schema standardization in historical docs - Update 12+ documentation files for consistency Files moved: - EDIT_PROJECT_WRONG_DATA_BUG.md → fixes/ - PROJECT_EDITING_ANALYSIS.md → analysis/ - PROJECT_SHARING_ANALYSIS_AND_RECOMMENDATIONS.md → analysis/ - HANDOFF_SUMMARY_BITCOIN_BALANCE_MVP.md → changelog/ Files consolidated: - Merged 3 testing files into PUBLIC_PROFILES_TESTING.md Schema updates: - All docs now reference 'name' field consistently - Historical docs annotated with standardization notes
2.3 KiB
2.3 KiB
Profile Feature Documentation
Overview
The profile feature allows users to create and manage their profiles for accepting Bitcoin donations. It includes both Bitcoin and Lightning address support.
Architecture
Components
ProfileContext: Manages global profile stateCreateProfileForm: Handles profile creationProfilePage: Displays profile creation UI
Data Flow
- User authenticates
- Profile context checks for existing profile
- If no profile exists, user is redirected to create profile
- User fills out form with validation
- Profile is created in Supabase
- User is redirected to dashboard
Technical Details
Profile Schema
interface Profile {
id: string;
username: string | null;
name: string | null;
bio?: string;
avatar_url?: string;
banner_url?: string;
website?: string;
bitcoin_address?: string;
lightning_address?: string;
created_at: string;
updated_at: string;
}
Validation Rules
- Username: Required, 3-30 characters, alphanumeric with underscores/hyphens only. Must be unique.
- Name: Optional, max 100 characters. Displayed on profile. Auto-populated from username if not provided. (Standardized from display_name)
- Bio: Optional, max 500 characters
- Location: Optional, max 100 characters
- Bitcoin Address: Optional, must be valid format
- Lightning Address: Optional, must be valid email format
- Website: Optional, must be valid URL
- Avatar URL: Optional, must be valid URL
- Banner URL: Optional, must be valid URL
Security Considerations
- All profile operations require authentication
- User can only access their own profile
- Sensitive data is not stored in profile
Usage Examples
Creating a Profile
const { createProfile } = useProfile();
await createProfile({
username: 'johndoe',
name: 'John Doe',
bitcoin_address: '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa',
});
Accessing Profile Data
const { profile, loading, error } = useProfile();
Error Handling
- Form validation errors are displayed inline
- API errors are shown in a global error message
- Loading states are properly handled
Testing
- Unit tests for form validation
- Integration tests for Supabase operations
- E2E tests for complete flow