POWR/docs/features/library/library_overview.md
DocNR 969163313a fix(auth): Improve authentication state handling and avatar display
* Add style prop to UserAvatar component for better customization
* Refactor UserAvatar to use getAvatarSeed utility for consistent avatar generation
* Fix React hook ordering issues in profile/overview.tsx to prevent crashes during auth state changes
* Add proper state initialization and cleanup during authentication transitions
* Ensure consistent fallback avatar display for unauthenticated users

These changes improve stability during login/logout operations and provide better visual continuity with Robohash avatars when profile images aren't available.
2025-04-02 21:11:25 -04:00

4.2 KiB

Library Tab

Last Updated: 2025-04-01
Status: Active
Related To: Exercise Management, Template Management, Content Discovery

Overview

The Library tab serves as the centralized hub for managing fitness content in the POWR app, including exercises and workout templates. It provides an organized, searchable interface that supports both locally created content and Nostr-based discovery while maintaining offline usability.

Key Components

Navigation Structure

The Library is organized into three main sections using Material Top Tabs:

  1. Templates (Default Tab) - Workout templates for quick start
  2. Exercises - Individual exercise library
  3. Programs - Multi-day workout programs (placeholder for future)

Templates Management

Templates Tab Status

The Templates section provides organized access to workout templates from various sources:

Feature Status Description
Basic Template List Organized display of all templates
Favorites Section Quick access to favorite templates
Source Badges Visual indicators for Local/POWR/Nostr sources
Recently Used 🟡 Partially implemented history tracking
Usage Statistics Not yet implemented

Template Display

Each template card shows:

  • Template title
  • Workout type indication
  • Exercise preview (first 3)
  • Source badges
  • Favorite toggle

Templates Search & Filtering

  • Real-time search functionality
  • Basic filtering by type/category
  • Advanced filters partially implemented

Exercise Management

Exercises Tab Status

The Exercises section organizes all available exercises:

Feature Status Description
Alphabetical List With quick scroll navigation
Categorization Muscle groups, movement types
Source Badges Visual indicators for content source
Recent Section Not yet implemented
Usage Tracking Not yet implemented

Exercise Display

Each exercise item shows:

  • Exercise name
  • Category/tags
  • Equipment requirements
  • Source badge

Exercise Search & Filtering

  • Real-time search functionality
  • Basic filters for category/equipment
  • Advanced filtering partially implemented

Technical Implementation

Data Architecture

The Library uses SQLite for persistent storage with the following key services:

  • LibraryService: Core data management
  • ExerciseService: Exercise CRUD operations
  • TemplateService: Template management
  • FavoritesService: Favorites functionality

Content Management

Feature Status Notes
Exercise Creation Full CRUD support
Template Creation Full CRUD support
Content Validation Basic validation implemented
Tag Management 🟡 Partial implementation
Media Support Planned for future

Performance Metrics

The Library meets key performance requirements:

  • Search response: < 100ms
  • Scroll performance: 60fps
  • Database operations: < 50ms

Offline-First Implementation

The Library is designed with offline-first principles:

  • Local storage for all core content
  • Offline content creation
  • Pending sync status indicators
  • Background synchronization when online

Nostr Integration

Nostr Status

While the types and schemas have been defined, the Nostr integration is still in progress:

  • Content discovery from relays
  • Publishing templates to Nostr
  • Social interactions (likes, shares)
  • Attribution and source tracking

Development Roadmap

Phase 1: Core Enhancements (Current)

  • Usage statistics and history tracking
  • Enhanced details views
  • Improved filtering system

Phase 2: Advanced Features

  • Media support
  • Performance metrics
  • Enhanced filtering

Phase 3: Nostr Integration

  • Event handling
  • Content synchronization
  • Offline capabilities