# bastien-baloup/detective-box-2-app architecture

> Architecture diagram of the GitHub repository bastien-baloup/detective-box-2-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bastien-baloup/detective-box-2-app
- Repository: https://github.com/bastien-baloup/detective-box-2-app

## Overview

##### Main Components Architecture

Frontend Layer:
- Sub-components:
- Pages (Home, Login, Choice, Agent Pages)
- Core Components (Audio, Video, Navigation)
- Game Components (Fouilles, Quizz, Timer)
- Asset Management (tiles, sounds, images)

State Management:
- Context Providers (fetchContext)
- Reducers (eventReducer)
- Custom Hooks (useApi, useError, useEvent, useLieu)

Asset Structure:
- Complex asset hierarchy:
- Fouilles (investigation scenes)
- Audio/Visual Resources
- Tile-based Navigation System

##### Data Flow

- User interaction flow
- State updates
- Asset loading paths
- API communications (indicated by api.js)

##### Key Architectural Patterns

Highlight:
- Component composition pattern (Layout, ProviderPile)
- Feature-based organization (fouilles, components, pages)
- Asset management structure (public/fouilles/*)
- State management pattern (context + reducer)

##### Specific Implementation Details

- Authentication flow (Login/Signup components)
- Game progression system (Progression component)
- Investigation mechanics (Fouilles modals)
- Media handling (Audio/Video components)

##### Technical Specifications

Notes indicating:
- React + Vite architecture
- SCSS styling structure
- Static asset organization
- API integration points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        App["Client Application (React)"]
        click App "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/App.jsx"
    end

    subgraph StateManagement
        Context["Context Provider"]
        click Context "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/utils/context/fetchContext.jsx"
        Reducer["Event Reducer"]
        click Reducer "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/utils/reducer/eventReducer.js"
        Hooks["Custom Hooks"]
        click Hooks "https://github.com/Bastien-Baloup/detective-box-2-app/tree/main/src/utils/hooks/"
    end

    subgraph GameFeatures
        Fouilles["Investigation Modals"]
        click Fouilles "https://github.com/Bastien-Baloup/detective-box-2-app/tree/main/src/components/fouilles/"
        Audio["Audio Player"]
        click Audio "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/Audio.jsx"
        Video["Video Player"]
        click Video "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/Video.jsx"
        Timer["Timer"]
        click Timer "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/Timer.jsx"
        Quiz["Quiz System"]
        click Quiz "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/Quizz.jsx"
    end

    subgraph Pages
        Home["Home Page"]
        click Home "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/pages/Home.jsx"
        Login["Login Page"]
        click Login "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/pages/Login.jsx"
        Choice["Choice Interface"]
        click Choice "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/pages/Choice.jsx"
        AgentPages["Agent Pages"]
        click AgentPages "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/pages/Adele.jsx"
    end

    subgraph AssetManagement
        Scenes["Investigation Scenes"]
        click Scenes "https://github.com/Bastien-Baloup/detective-box-2-app/tree/main/public/fouilles/"
        SceneData["Scene Data"]
        click SceneData "https://github.com/Bastien-Baloup/detective-box-2-app/tree/main/src/assets/fouilles/"
        NavTiles["Navigation Tiles"]
        click NavTiles "https://github.com/Bastien-Baloup/detective-box-2-app/tree/main/src/assets/fouilles/"
    end

    subgraph CoreUI
        Layout["Layout Component"]
        click Layout "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/Layout.jsx"
        Nav["Navigation"]
        click Nav "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/Nav.jsx"
        Providers["Provider Stack"]
        click Providers "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/ProviderPile.jsx"
        ErrorHandler["Error Handling"]
        click ErrorHandler "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/components/ErrorPopup.jsx"
    end

    subgraph APILayer
        APIService["API Service"]
        click APIService "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/api.js"
        APIHook["API Hook"]
        click APIHook "https://github.com/Bastien-Baloup/detective-box-2-app/blob/main/src/utils/hooks/useApi.js"
    end

    %% Relationships
    App --> Context
    App --> Providers
    Context --> Reducer
    Context --> Hooks
    
    App --> Layout
    Layout --> Nav
    Layout --> ErrorHandler
    
    App --> Pages
    Pages --> GameFeatures
    GameFeatures --> AssetManagement
    
    App --> APILayer
    APILayer --> Context

    classDef core fill:#2374ab
    classDef state fill:#7209b7
    classDef game fill:#4caf50
    classDef asset fill:#ff9800
    classDef ui fill:#607d8b
    classDef api fill:#e91e63

    class App core
    class Context,Reducer,Hooks state
    class Fouilles,Audio,Video,Timer,Quiz game
    class Scenes,SceneData,NavTiles asset
    class Layout,Nav,Providers,ErrorHandler ui
    class APIService,APIHook api

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["State Management"]:::state
        L3["Game Features"]:::game
        L4["Asset Management"]:::asset
        L5["UI Components"]:::ui
        L6["API Layer"]:::api
    end
```
