# hugobarragon/react-quizzes architecture

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

- Interactive diagram: https://gitdiagram.com/hugobarragon/react-quizzes
- Repository: https://github.com/hugobarragon/react-quizzes

## Overview

##### Main Architectural Components

A. Core Components Layer:
- QuizzBuilder Component
- Quiz Component
- ToolBox Component (customizable input components)
- Translations System

B. Feature Modules:
- Form Preview System
- Drag & Drop System
- Element Management
- State Management (reducer pattern)

C. Shared Components:
- Reusable Components
- Custom Hooks
- Translation Services

**┌─ Builder Section ─────┐  ┌─ Delivery Section ──┐  ┌─ Shared Services ───┐**
- QuizzBuilder       │  │ - Quiz Component    │  │ - Translations      │
- FormBuilder        │  │ - Form Renderer     │  │ - ToolBox Registry  │
- DnD System         │  │ - Submit Handler    │  │ - State Management  │
- ┬─┘  └──────────┬─────────┘  └─────────┬──────────┘

- ┼───────────────────────┘

- Data Flow Layer

##### Component Relationships

- QuizzBuilder → ToolBox (uses components)
- QuizzBuilder → FormPreview (renders preview)
- Quiz → ToolBox (renders components)
- Both main components → Translations (i18n support)

##### State Flow

A state management section showing:
**┌─ Reducer Actions ─┐     ┌─ State Tree ──┐**
- Add Element    │ ──► │ - Form Data   │
- Delete Element │     │ - UI State    │
- Edit Element   │     │ - Validation  │
- ┬─┘     └──────────────┘
- ▲
- ┘

##### Important Details to Highlight

- Green: Core components
- Blue: Shared services
- Orange: User interaction points
- Purple: State management
- Gray: External dependencies

##### Technical Stack Indicators

- React
- TypeScript
- Ant Design
- Custom CSS Modules

##### Interaction Flows

- Builder → Preview
- Form Submission
- Translation Integration
- Custom Input Registration

##### Extensibility Points

Customization points:
- Custom ToolBox inputs
- Custom styles
- Language additions
- Custom submit handlers

##### Component Hierarchy

**QuizzBuilder**
- ToolBoxContainer
- FormPreview
- DnDWrapper
- ElementWrapper
- EditElement
- DeleteButton
- SettingsForm

Remember to:
- Use consistent styling
- Version information
- Document all customization points
- Clear data flow paths

- Drag & Drop functionality
- Rich text support
- Internationalization
- Custom input support
- Form building and delivery separation

This structure will provide a clear understanding of the system's architecture while maintaining the flexibility needed for customization and extension.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Builder
        QB[QuizzBuilder]:::core
        FB[FormBuilder]:::core
        DnD[DnD System]:::core
        FP[Form Preview]:::core
        EM[Element Management]:::core
        SM[Settings Management]:::core
    end

    subgraph Delivery
        QZ[Quiz Component]:::core
        FR[Form Renderer]:::core
        SH[Submit Handler]:::core
    end

    subgraph Services
        TB[ToolBox Registry]:::service
        TS[Translation System]:::service
        CP[Context Provider]:::service
        RD[Reducer/State]:::service
    end

    subgraph Shared
        RC[Reusable Components]:::shared
        CH[Custom Hooks]:::shared
        TT[Translated Text]:::shared
    end

    QB --> FB
    FB --> FP
    FB --> DnD
    FB --> EM
    EM --> SM
    QB --> TB
    QZ --> TB
    QB --> TS
    QZ --> TS
    QB --> CP
    QZ --> CP
    CP --> RD

    FB --> RC
    QZ --> RC
    FB --> CH
    QZ --> CH
    TS --> TT
    QB --> TT
    QZ --> TT

    classDef core fill:#90EE90,stroke:#333,stroke-width:2px
    classDef service fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef shared fill:#DDA0DD,stroke:#333,stroke-width:2px

    click QB "https://github.com/hugobarragon/react-quizzes/blob/master/src/QuizzBuilder/FormBuilder.tsx"
    click QZ "https://github.com/hugobarragon/react-quizzes/blob/master/src/Quiz/Quiz.tsx"
    click TB "https://github.com/hugobarragon/react-quizzes/blob/master/src/ToolBox/index.tsx"
    click TS "https://github.com/hugobarragon/react-quizzes/tree/master/src/translations"
    click FP "https://github.com/hugobarragon/react-quizzes/blob/master/src/QuizzBuilder/FormPreview/FormPreview.tsx"
    click DnD "https://github.com/hugobarragon/react-quizzes/blob/master/src/QuizzBuilder/FormPreview/DnDWrapper/index.tsx"
    click EM "https://github.com/hugobarragon/react-quizzes/blob/master/src/QuizzBuilder/FormPreview/ElementWrapper/ElementWrapper.tsx"
    click RD "https://github.com/hugobarragon/react-quizzes/tree/master/src/QuizzBuilder/reducer"
    click RC "https://github.com/hugobarragon/react-quizzes/tree/master/src/ReusableComponents"
    click CH "https://github.com/hugobarragon/react-quizzes/blob/master/src/customHooks.ts"
    click TT "https://github.com/hugobarragon/react-quizzes/blob/master/src/translations/TranslatedText.tsx"
    click TB "https://github.com/hugobarragon/react-quizzes/tree/master/src/ToolBox/Components"
    click SM "https://github.com/hugobarragon/react-quizzes/blob/master/src/QuizzBuilder/FormPreview/ElementWrapper/EditElement/SideDrawer/SettingsForm/SettingsForm.tsx"
    click CP "https://github.com/hugobarragon/react-quizzes/blob/master/src/QuizzContext.tsx"
```
