5.2 KiB
Profile Tab Enhancement Design Document
Overview
This document outlines the design and implementation of the enhanced Profile tab for the POWR app. The enhancement includes a tabbed interface with separate screens for profile overview, activity feed, progress analytics, and settings.
Motivation
The original Profile tab was limited to displaying basic user information. With the growing social and analytics features of the app, we need a more comprehensive profile experience that:
- Showcases the user's identity and achievements
- Displays workout activity in a social feed format
- Provides analytics and progress tracking
- Offers easy access to settings and preferences
By moving analytics and progress tracking to the Profile tab, we create a more cohesive user experience that focuses on personal growth and achievement.
Design
Tab Structure
The enhanced Profile tab is organized into four sub-tabs:
- Overview: Displays user profile information, stats summary, and quick access to recent records and activity
- Activity: Shows a chronological feed of the user's workout posts
- Progress: Provides analytics and progress tracking with charts and personal records
- Settings: Contains profile editing, privacy controls, and app preferences
Navigation
The tabs are implemented using Expo Router's Tabs
component, with appropriate icons for each tab:
- Overview: User icon
- Activity: Activity icon
- Progress: BarChart2 icon
- Settings: Settings icon
Data Flow
The Profile tab components interact with several services:
- NDK Services: For user profile data and authentication
- WorkoutService: For accessing workout history
- AnalyticsService: For calculating statistics and progress metrics
Implementation Details
New Components and Files
-
Tab Layout:
app/(tabs)/profile/_layout.tsx
: Defines the tab structure and navigation
-
Tab Screens:
app/(tabs)/profile/overview.tsx
: Profile information and summaryapp/(tabs)/profile/activity.tsx
: Workout activity feedapp/(tabs)/profile/progress.tsx
: Analytics and progress trackingapp/(tabs)/profile/settings.tsx
: User settings and preferences
-
Services:
lib/services/AnalyticsService.ts
: Service for calculating workout statistics and progress datalib/hooks/useAnalytics.ts
: React hook for accessing the analytics service
Analytics Service
The AnalyticsService provides methods for:
- Workout Statistics: Calculate aggregate statistics like total workouts, duration, volume, etc.
- Exercise Progress: Track progress for specific exercises over time
- Personal Records: Identify and track personal records for exercises
The service is designed to work with both local and Nostr-based workout data, providing a unified view of the user's progress.
Authentication Integration
The Profile tab is integrated with the Nostr authentication system:
- Unauthenticated users see a login prompt in the Overview tab
- All tabs show appropriate UI for unauthenticated users
- The NostrLoginSheet is accessible from the Overview tab
User Experience
Overview Tab
The Overview tab provides a comprehensive view of the user's profile:
- Profile picture and banner image
- Display name and username
- About/bio text
- Summary statistics (workouts, templates, programs)
- Recent personal records
- Recent activity
- Quick actions for profile management
Activity Tab
The Activity tab displays the user's workout posts in a chronological feed:
- Each post shows the workout details
- Posts are formatted similar to the social feed
- Empty state for users with no activity
Progress Tab
The Progress tab visualizes the user's fitness journey:
- Period selector (week, month, year, all-time)
- Workout summary statistics
- Workout frequency chart
- Exercise distribution chart
- Personal records list
- Empty states for users with no data
Settings Tab
The Settings tab provides access to user preferences:
- Profile information editing
- Privacy settings
- Notification preferences
- Account management
Future Enhancements
- Workout Streaks: Track and display workout consistency
- Goal Setting: Allow users to set and track fitness goals
- Comparison Analytics: Compare current performance with past periods
- Social Integration: Show followers/following counts and management
- Achievement Badges: Gamification elements for workout milestones
Technical Considerations
Performance
- The AnalyticsService uses caching to minimize recalculations
- Data is loaded asynchronously to keep the UI responsive
- Charts and visualizations use efficient rendering techniques
Data Privacy
- Analytics are calculated locally on the device
- Sharing controls allow users to decide what data is public
- Personal records can be selectively shared
Conclusion
The enhanced Profile tab transforms the user experience by providing a comprehensive view of the user's identity, activity, and progress. By centralizing these features in the Profile tab, we create a more intuitive and engaging experience that encourages users to track their fitness journey and celebrate their achievements.