# howlinbash/swayze architecture

> Architecture diagram of the GitHub repository howlinbash/swayze, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/howlinbash/swayze
- Repository: https://github.com/howlinbash/swayze

## Overview

##### Main Components

A. Core Application Layer:
- Root Application Component (App.tsx)
- Configuration Layer (config.ts)
- Main Entry Point (index.tsx)

B. State Management Layer:
- Redux Charts System
- State Machine Layer
- Reducers & Selectors

C. UI Component Layer:
- Components
- Game Interface Elements
- Visual Design System

D. Game Logic Layer:
- Game Machine
- Action Handlers
- Event System

**[Browser Entry Point]**
- ↓
**[React Application Core]**
- ↓
- [State Layer]
- ↙     ↓    ↘
**[Machine] [Redux] [Hooks]**
- ↘     ↓    ↙
- [UI Components Layer]
- ↓
**[Game Interface Elements]**

##### Detailed Component Relationships

A. State Management Flow:
- [Redux Store] ←→ [State Machine]
- ↓
- [Game Actions] → [Reducers]
- ↓
- [State Selectors]

B. UI Component Hierarchy:
- [Layout]
- ↓
- [Display Board]
- ↓
- [Reel Components]
- ↓
- [Marquee Elements]

##### Implementation Details to Highlight

- Event flow from user interactions through the state machine
- How the redux-charts system integrates with the game machine
- Demonstrate the relationship between actions.ts, events.ts, and writes.ts
- How the UI components consume state and trigger actions

Create distinct sections for:

##### Additional Notes

- Annotations for key state transformations
- Main game loop mechanism

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Browser
        Entry["Browser Entry Point"]
    end

    subgraph Core["Core Application Layer"]
        App["App Component"]:::react
        Config["Configuration"]:::config
        Index["Main Entry Point"]:::react
    end

    subgraph State["State Management Layer"]
        direction TB
        ReduxCharts["Redux Charts System"]:::state
        StateMachine["State Machine Layer"]:::state
        Reducers["Reducers"]:::state
        Selectors["Selectors"]:::state
        Store["Store"]:::state
        MachineImpl["Machine Implementation"]:::state
    end

    subgraph UI["UI Component Layer"]
        direction TB
        Layout["Layout"]:::ui
        DisplayBoard["Display Board"]:::ui
        Reel["Reel Components"]:::ui
        Marquee["Marquee Elements"]:::ui
    end

    subgraph Game["Game Logic Layer"]
        direction TB
        GameMachine["Game Machine"]:::game
        ActionHandlers["Action Handlers"]:::game
        EventSystem["Event System"]:::game
        StateWriters["State Writers"]:::game
    end

    subgraph Support["Supporting Systems"]
        direction TB
        Hooks["Custom Hooks"]:::support
        DesignSystem["Design System"]:::support
        AssetMgmt["Asset Management"]:::support
        Types["Type Definitions"]:::support
    end

    Entry --> Index
    Index --> App
    App --> Layout

    Layout --> DisplayBoard
    DisplayBoard --> Reel
    DisplayBoard --> Marquee

    StateMachine <--> ReduxCharts
    ReduxCharts --> Store
    Store --> MachineImpl

    GameMachine --> ActionHandlers
    ActionHandlers --> EventSystem
    EventSystem --> StateWriters

    StateMachine --> Reducers
    Reducers --> Selectors
    Selectors --> UI

    UI --> Hooks
    UI --> DesignSystem
    UI --> AssetMgmt

    %% Click Events
    click App "https://github.com/howlinbash/swayze/blob/master/src/App.tsx"
    click Config "https://github.com/howlinbash/swayze/blob/master/src/config.ts"
    click Index "https://github.com/howlinbash/swayze/blob/master/src/index.tsx"
    click ReduxCharts "https://github.com/howlinbash/swayze/tree/master/src/redux-charts/"
    click StateMachine "https://github.com/howlinbash/swayze/tree/master/src/machine/"
    click Reducers "https://github.com/howlinbash/swayze/blob/master/src/reducers.ts"
    click Selectors "https://github.com/howlinbash/swayze/blob/master/src/selectors.ts"
    click DisplayBoard "https://github.com/howlinbash/swayze/blob/master/src/ui/display-board.tsx"
    click Layout "https://github.com/howlinbash/swayze/blob/master/src/ui/layout.tsx"
    click Reel "https://github.com/howlinbash/swayze/blob/master/src/ui/reel.tsx"
    click Marquee "https://github.com/howlinbash/swayze/blob/master/src/ui/marquee.tsx"
    click GameMachine "https://github.com/howlinbash/swayze/blob/master/src/machine/chart.ts"
    click ActionHandlers "https://github.com/howlinbash/swayze/blob/master/src/machine/actions.ts"
    click EventSystem "https://github.com/howlinbash/swayze/blob/master/src/machine/events.ts"
    click StateWriters "https://github.com/howlinbash/swayze/blob/master/src/machine/writes.ts"
    click Hooks "https://github.com/howlinbash/swayze/blob/master/src/hooks/use-interval.ts"
    click DesignSystem "https://github.com/howlinbash/swayze/tree/master/src/design/"
    click AssetMgmt "https://github.com/howlinbash/swayze/tree/master/src/faces/"
    click Types "https://github.com/howlinbash/swayze/blob/master/src/d.ts"
    click Store "https://github.com/howlinbash/swayze/blob/master/src/redux-charts/store.ts"
    click MachineImpl "https://github.com/howlinbash/swayze/blob/master/src/redux-charts/machine.ts"

    %% Styles
    classDef react fill:#61DAFB,stroke:#333,stroke-width:2px
    classDef config fill:#F7DF1E,stroke:#333,stroke-width:2px
    classDef state fill:#764ABC,stroke:#333,stroke-width:2px,color:#fff
    classDef ui fill:#FF6B6B,stroke:#333,stroke-width:2px
    classDef game fill:#9B51E0,stroke:#333,stroke-width:2px,color:#fff
    classDef support fill:#A8A8A8,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["React Components"]:::react
        L2["Configuration"]:::config
        L3["State Management"]:::state
        L4["UI Components"]:::ui
        L5["Game Logic"]:::game
        L6["Support Systems"]:::support
    end
```
