# boscop-fr/assistant-rgaa architecture

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

- Interactive diagram: https://gitdiagram.com/boscop-fr/assistant-rgaa
- Repository: https://github.com/boscop-fr/assistant-rgaa

## Overview

##### Main components
- Browser Extension Core:
- Background scripts (located in the src/background folder) that handle extension lifecycle tasks, browser APIs, and inter-component communication.
- Content scripts and injected pages (found in the pages directory and possibly triggered by the background scripts) that form the interactive UI components.
- UI Modules:
- Panel: A central user interface with rich interactions (src/panel) powered by state slices, Redux-like store management, and custom UI React components.
- Options and Default Panel: Separate UI modules (src/options and src/default-panel) that provide configuration pages and specific layouts.
- Minimap: A dedicated section (src/minimap) for overview and navigation, which is also a distinct UI block.
- Data & Configuration:
- Static datasets (within the data directory) that include JSON files of instructions, references, and helper data for various versions of the RGAA guidelines.
- Configuration, build, and formatting utilities (like bin scripts, package.json, rspack.config.mjs, etc.) that support development and deployment.
- Styles and Assets:
- Multiple CSS directories (css/) segmented for common styling, panel-specific styles, helpers, minimap, and options. It shows a careful separation of style concerns.
- Testing and Documentation:
- End-to-end tests (e2e) and fixtures that confirm UI and functionality.
- Detailed documentation (in the doc folder) including architectural overviews, installation instructions, and details about data mapping.

##### Relationships and Interactions
- How the background scripts serve as the central orchestrator that communicates with UI components (panel, options, default panel, and minimap) via messaging interfaces.
- Data flow from static JSON data (helper/instructions/references) up through the business logic and into the UI components.
- Separation of concerns: the core logic is segregated into distinct directories (background, helpers, panel, options), each managing a part of the extension’s overall functionality.

##### Architectural Patterns and Design Principles
- The modular separation (different UI modules, a dedicated background process, and clearly isolated CSS themes) is a key principle here.
- Usage of state management (Redux-like slices in the panel and helpers) reflects an interactive, reactive design, especially for the UI panels.
- The project follows a component-based architecture (as seen in the use of React components in src, with clear folders like components, slices, and utilities).

##### Relevant Technologies and Frameworks
- It’s clearly using TypeScript (look at .ts and .tsx files) and React (React components in src/panel, src/helpers, etc.).
- Background scripts use browser APIs and likely WebExtension conventions.
- Testing frameworks include Jest and Playwright, as supported by configuration files and end-to-end tests in the e2e folder.

##### Essential Elements
- Use clear labels for each component (e.g., “Background Process”, “Panel UI”, “Helpers Module”, “Options Page”, “Default Panel”, “Minimap Component”, “Data/JSON Configuration”, “CSS/Styling”).
- From the static JSON data (from the data folder) into the helper functions.
- From background processes to UI components (e.g., for commands or state updates).
- From user events in the various UI modules that trigger state updates in Redux-like slices.
- For logic layers (background vs. UI modules) and for differentiating between configuration/data sources and actively running components.
- Optionally, even include testing components as a side note to denote quality assurance portions of the system.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Browser Extension Core"
        BP["Background Process\n(src/background)"]:::core
        CP["Content Scripts & Pages\n(pages)"]:::core
    end

    subgraph "UI Modules"
        PUI["Panel UI\n(src/panel)"]:::ui
        HELP["Helpers Module\n(src/helpers)"]:::ui
        OPT["Options Page\n(src/options)"]:::ui
        DP["Default Panel\n(src/default-panel)"]:::ui
        MM["Minimap Component\n(src/minimap)"]:::ui
    end

    DC["Data & Configuration\n(data & build)"]:::data
    SA["Styles & Assets\n(css, fonts, img)"]:::styles
    TD["Testing & Documentation\n(e2e, doc)"]:::testing

    BP -->|"messaging"| PUI
    BP -->|"messaging"| HELP
    BP -->|"messaging"| OPT
    BP -->|"messaging"| DP
    BP -->|"messaging"| MM

    CP -->|"triggers"| PUI
    CP -->|"triggers"| OPT
    CP -->|"triggers"| DP

    DC -->|"providesData"| PUI
    DC -->|"providesData"| HELP
    DC -->|"providesData"| OPT
    DC -->|"providesData"| DP
    DC -->|"providesData"| MM

    PUI -->|"usesStyles"| SA
    HELP -->|"usesStyles"| SA
    OPT -->|"usesStyles"| SA
    DP -->|"usesStyles"| SA
    MM -->|"usesStyles"| SA

    TD -->|"verifies"| BP
    TD -->|"verifies"| PUI

    classDef core fill:#9fdfbf,stroke:#333,stroke-width:2px;
    classDef ui fill:#bee1f4,stroke:#333,stroke-width:2px;
    classDef data fill:#f9e2ae,stroke:#333,stroke-width:2px;
    classDef styles fill:#d4a5a5,stroke:#333,stroke-width:2px;
    classDef testing fill:#f4c2c2,stroke:#333,stroke-width:2px;

    click BP "https://github.com/boscop-fr/assistant-rgaa/tree/main/src/background"
    click CP "https://github.com/boscop-fr/assistant-rgaa/tree/main/pages"
    click PUI "https://github.com/boscop-fr/assistant-rgaa/tree/main/src/panel"
    click HELP "https://github.com/boscop-fr/assistant-rgaa/tree/main/src/helpers"
    click OPT "https://github.com/boscop-fr/assistant-rgaa/tree/main/src/options"
    click DP "https://github.com/boscop-fr/assistant-rgaa/tree/main/src/default-panel"
    click MM "https://github.com/boscop-fr/assistant-rgaa/tree/main/src/minimap"
    click DC "https://github.com/boscop-fr/assistant-rgaa/tree/main/data"
    click SA "https://github.com/boscop-fr/assistant-rgaa/tree/main/css"
    click TD "https://github.com/boscop-fr/assistant-rgaa/tree/main/e2e"
```
