# the-best-codes/jiujitsumeter architecture

> Architecture diagram of the GitHub repository the-best-codes/jiujitsumeter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/the-best-codes/jiujitsumeter
- Repository: https://github.com/the-best-codes/jiujitsumeter

## Overview

##### Main Components

a. Client-Side Components:
- Mobile Application Layer (React Native/Expo)
- Local Storage System
- UI Components Layer
- Internationalization System
- Theme/Styling System

b. Supporting Infrastructure:
- Firebase Functions (noted by the /functions directory)

**┌─ Presentation Layer ─────────────────────┐**
- Tab Navigation                         │
- Class Management Screens               │
- Statistics Screens                     │
- Settings Screens                       │
- ┬────────────────────┬──┘

**┌──────────────────┴────────────────────┴──┐**
- Business Logic Layer                      │
- Hooks                                   │
- Utils                                   │
- State Management                        │
- ┬────────────────────────┘

**┌──────────────────┴────────────────────────┐**
- Data Layer                                │
- Local Storage                           │
- Firebase Functions                      │
- ┬─┘

##### Component Relationships to Highlight

a. UI Layer:
- Tab navigation structure connecting:
- Home (index.tsx)
- Levels
- Stats
- Settings
- Reusable components (ClassPicker, DateTimePicker, etc.)

b. Business Logic:
- Hooks to their respective UI components
- Utility functions' relationships with components
- Theme and internationalization flow

c. Data Layer:
- Local storage interactions
- Firebase function connections

##### Implementation Details

- Data flow direction
- Component dependencies
- Event handling paths

Specific technical details:
- React Native/Expo framework
- Local storage implementation
- Firebase Functions role
- TypeScript integration

##### Notes

- Keep the focus on the mobile-first architecture
- Privacy-centric design
- Scalability of the internationalization system
- Modular component structure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Mobile Application Layer"
        TabNav["Tab Navigation"]:::ui
        HomeScreen["Home Screen"]:::ui
        LevelsScreen["Levels Screen"]:::ui
        StatsScreen["Stats Screen"]:::ui
        SettingsScreen["Settings Screen"]:::ui
    end

    subgraph "UI Components Layer"
        ClassList["Class List"]:::ui
        ClassPicker["Class Picker"]:::ui
        DateTimePicker["DateTime Picker"]:::ui
        LessonPicker["Lesson Picker"]:::ui
        TabBarIcon["TabBar Icon"]:::ui
        
        subgraph "Data Visualization"
            ClassDist["Class Distribution"]:::ui
            LessonDist["Lesson Distribution"]:::ui
            TimeDist["Time Distribution"]:::ui
        end
    end

    subgraph "Business Logic Layer"
        Hooks["Custom Hooks"]:::logic
        DateUtils["Date Utilities"]:::logic
        Constants["Constants"]:::logic
        
        subgraph "Theme System"
            ThemeLogic["Theme Logic"]:::logic
            ColorScheme["Color Scheme"]:::logic
            ThemeColor["Theme Color"]:::logic
        end
        
        subgraph "Class Management"
            EditClass["Edit Class Log"]:::logic
            CustomClass["Edit Custom Class"]:::logic
        end
    end

    subgraph "Data Layer"
        LocalStorage["Local Storage"]:::storage
        Firebase["Firebase Functions"]:::external
        I18n["Internationalization"]:::logic
        Locales["Language Files"]:::storage
    end

    %% Relationships
    TabNav --> HomeScreen & LevelsScreen & StatsScreen & SettingsScreen
    HomeScreen --> ClassList
    ClassList --> ClassPicker
    ClassPicker --> DateTimePicker
    ClassPicker --> LessonPicker
    StatsScreen --> ClassDist & LessonDist & TimeDist
    
    Hooks --> ThemeLogic
    ThemeLogic --> ColorScheme
    ColorScheme --> ThemeColor
    
    EditClass & CustomClass --> LocalStorage
    I18n --> Locales
    
    %% Component click events
    click TabNav "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/app/(tabs)/_layout.tsx"
    click HomeScreen "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/app/(tabs)/index.tsx"
    click LevelsScreen "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/app/(tabs)/levels.tsx"
    click StatsScreen "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/app/(tabs)/stats.tsx"
    click SettingsScreen "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/app/(tabs)/settings.tsx"
    click ClassList "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/ClassList.tsx"
    click ClassPicker "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/ClassPicker.tsx"
    click DateTimePicker "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/DateTimePicker.tsx"
    click LessonPicker "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/LessonPicker.tsx"
    click TabBarIcon "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/navigation/TabBarIcon.tsx"
    click ClassDist "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/ClassDistribution.tsx"
    click LessonDist "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/LessonDistribution.tsx"
    click TimeDist "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/components/TimeDistribution.tsx"
    click LocalStorage "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/utils/storage.ts"
    click I18n "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/i18n.ts"
    click Locales "https://github.com/The-Best-Codes/JiuJitsuMeter/tree/master/locales"
    click ThemeLogic "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/styles/theme.ts"
    click ColorScheme "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/constants/Colors.ts"
    click ThemeColor "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/hooks/useThemeColor.ts"
    click Hooks "https://github.com/The-Best-Codes/JiuJitsuMeter/tree/master/hooks"
    click DateUtils "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/utils/dateUtils.ts"
    click Constants "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/utils/constants.ts"
    click Firebase "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/functions/index.js"
    click EditClass "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/app/EditClassLog.tsx"
    click CustomClass "https://github.com/The-Best-Codes/JiuJitsuMeter/blob/master/app/EditCustomClass.tsx"

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef logic fill:#e67e22,stroke:#d35400,color:white
    classDef storage fill:#2ecc71,stroke:#27ae60,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        UI["UI Component"]:::ui
        Logic["Business Logic"]:::logic
        Storage["Storage"]:::storage
        External["External Service"]:::external
    end
```
