# lucashsu95/custom-training architecture

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

- Interactive diagram: https://gitdiagram.com/lucashsu95/custom-training
- Repository: https://github.com/lucashsu95/custom-training

## Overview

##### Main System Components

a) Core Application Layer:
- User Interface (React Components)
- State Management (Provider Components)
- Data Storage (IndexedDB)
- Question Processing Engine

b) Feature Modules:
- Training Module
- Question Management Module
- Settings Module

**┌─ Presentation Layer ─────────────────────────┐**
- UI Components (src/components)             │
- Pages (src/pages)                         │
- Business Logic Layer ──────────────────────┤
- Question Processing (src/classes)         │
- Providers (src/provider)                  │
- Hooks (src/hooks)                        │
- Data Layer ──────────────────────────────┤
- IndexedDB Storage                        │
- JSON Assets                              │
- ┘

##### Component Relationships to Highlight

- User Interface → Question Provider
- Question Provider → IndexedDB Storage
- Training Components → Question Processing
- File Uploader → JSON Assets

##### Special Features to Emphasize

Create dedicated sections for:
- Question Types (Multiple Choice, Fill in Blank, Matching, Vocabulary)
- Training Modes (Auto Training, Direct Practice)
- Progress Tracking System
- Theme Management

##### Technical Details

Annotations for:
- React + Vite Framework
- Shadcn/UI Components
- TailwindCSS Styling
- IndexedDB for Local Storage

##### Data Flow Patterns

Flows:
- Question Upload → Storage → Training
- User Input → Question Processing → Score Calculation
- Settings → Training Configuration

##### Key Architectural Patterns

Highlight:
- Component-based Architecture
- Provider Pattern for State Management
- Hook-based Logic Separation
- Factory Pattern for Question Types

This system design should emphasize:
##### The training algorithm implementation

Keep the focus on how the components interact to deliver the core functionality of question management and training features.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Presentation Layer"
        UI["UI Components"]
        Pages["Pages/Views"]
        Theme["Theme Management"]
        
        subgraph "Question Types"
            MC["Multiple Choice"]
            FB["Fill in Blank"]
            MT["Matching"]
            VC["Vocabulary"]
        end
    end

    subgraph "Business Logic Layer"
        QPE["Question Processing Engine"]
        Factory["Component Factory"]
        API["API Interface"]
        
        subgraph "State Management"
            QP["Question Provider"]
            SP["Settings Provider"]
        end
        
        subgraph "Training Module"
            AT["Auto Training"]
            TIP["Training in Progress"]
            SB["State Board"]
        end
        
        subgraph "Question Management"
            MQ["Manage Questions"]
            FU["File Uploader"]
            QT["Questions Table"]
        end
    end

    subgraph "Data Layer"
        IDB["IndexedDB Storage"]
        JSON["JSON Assets"]
        InitQ["Question Initialization"]
    end

    UI --> QP
    UI --> SP
    Pages --> QP
    QP --> IDB
    FU --> JSON
    QPE --> QP
    Factory --> MC
    Factory --> FB
    Factory --> MT
    Factory --> VC
    InitQ --> IDB
    API --> QP
    MQ --> QT
    FU --> MQ
    AT --> TIP
    TIP --> SB

    %% Click events for component mapping
    click UI "https://github.com/lucashsu95/custom-training/tree/main/src/components/ui"
    click Pages "https://github.com/lucashsu95/custom-training/tree/main/src/pages"
    click Theme "https://github.com/lucashsu95/custom-training/blob/main/src/provider/ThemeProvider.jsx"
    click QPE "https://github.com/lucashsu95/custom-training/blob/main/src/classes/Question.js"
    click QP "https://github.com/lucashsu95/custom-training/blob/main/src/provider/QuestionProvider.jsx"
    click SP "https://github.com/lucashsu95/custom-training/blob/main/src/provider/SettingProvider.jsx"
    click IDB "https://github.com/lucashsu95/custom-training/blob/main/src/hooks/useIndexedDB.js"
    click JSON "https://github.com/lucashsu95/custom-training/tree/main/src/assets"
    click MC "https://github.com/lucashsu95/custom-training/blob/main/src/components/training/item/MultipleChoiceItem.jsx"
    click FB "https://github.com/lucashsu95/custom-training/blob/main/src/components/training/item/FillInTheBlankItem.jsx"
    click MT "https://github.com/lucashsu95/custom-training/blob/main/src/components/training/item/MatchingItem.jsx"
    click VC "https://github.com/lucashsu95/custom-training/blob/main/src/components/training/item/VocabularyItem.jsx"
    click AT "https://github.com/lucashsu95/custom-training/blob/main/src/pages/AutoTraining.jsx"
    click TIP "https://github.com/lucashsu95/custom-training/blob/main/src/pages/TrainingInProgress.jsx"
    click SB "https://github.com/lucashsu95/custom-training/blob/main/src/components/training/StateBoard.jsx"
    click MQ "https://github.com/lucashsu95/custom-training/blob/main/src/pages/ManageQuestions.jsx"
    click FU "https://github.com/lucashsu95/custom-training/blob/main/src/components/manage/FileUploader.jsx"
    click QT "https://github.com/lucashsu95/custom-training/blob/main/src/components/manage/QuestionsTable.jsx"
    click Factory "https://github.com/lucashsu95/custom-training/blob/main/src/utils/componentFactory.js"
    click API "https://github.com/lucashsu95/custom-training/blob/main/src/classes/API.js"
    click InitQ "https://github.com/lucashsu95/custom-training/blob/main/src/hooks/useInitializeQuestions.js"

    classDef ui fill:#3b82f6,color:white
    classDef data fill:#22c55e,color:white
    classDef logic fill:#f97316,color:white
    classDef state fill:#a855f7,color:white
    classDef external fill:#6b7280,color:white

    class UI,Pages,Theme,MC,FB,MT,VC ui
    class IDB,JSON,InitQ data
    class QPE,Factory,API logic
    class QP,SP state
    class AT,TIP,SB,MQ,FU,QT external
```
