# tomsquest/fynodoro architecture

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

- Interactive diagram: https://gitdiagram.com/tomsquest/fynodoro
- Repository: https://github.com/tomsquest/fynodoro

## Overview

##### Main Components Identification
The system can be broken down into these primary components:

a. User Interface Layer (ui/)
- Main UI component (ui.go)
- Settings interface (settings.go)
- Custom UI components (integer_entry.go, tappable_text.go)
- Utility components (format_duration.go, range_validator.go)
- Notification system (notify.go)

b. Core Business Logic (pomodoro/)
- Pomodoro timer implementation (pomodoro.go)
- Test suite (pomodoro_test.go)

c. Preferences Management (pref/)
- Configuration handling (pref.go)

d. Assets Management (assets/)
- Desktop integration (fynodoro.desktop)
- Sound notifications (notification.mp3)
- Notification script (notify.sh)

**┌─────────────────────────────────────────────────┐**
- UI Layer                       │
- ┌─────────────┐  ┌──────────┐  ┌──────────┐   │
- Main UI   │  │ Settings │  │  Custom   │   │
- (ui.go)    │  │          │  │ Components│   │
- ┘  └──────────┘  └──────────┘   │

- ┼─────────────┼─────────────┼─────────┤
- ▼             ▼             ▼          │
- ┌─────────────────────────────────┐        │
- Pomodoro Core Logic      │        │
- (pomodoro.go)          │        │
- ┘        │

- ┼──────────────────────────┤
- ┌─────────▼────────┐                  │
- Preferences    │                  │
- (pref.go)     │                  │
- ┬┘                  │

- ┼────────────────────┤
- ┌───────────────▼──────────────┐      │
- Asset Manager         │      │
- (Sounds, Desktop Integration)│      │
- ┬─┘      │
- ┼─────────┘

- ▼
- System Services
- (Desktop Notifications)

##### Important Elements to Highlight
- The Fyne toolkit integration
- The notification system flow
- Configuration persistence
- Timer state management
- Desktop integration points

##### Implementation Details to Note
- The application follows a clean separation between UI and business logic
- Preferences are centrally managed
- Asset handling is isolated
- Custom UI components extend the base Fyne toolkit

##### Key Interactions
- User input → Timer control
- Timer events → Notification system
- Settings changes → Preferences storage
- Preferences → Timer configuration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef pref fill:#e67e22,stroke:#d35400,color:white
    classDef asset fill:#9b59b6,stroke:#8e44ad,color:white
    classDef system fill:#95a5a6,stroke:#7f8c8d,color:white

    subgraph UI["User Interface Layer"]
        MainUI["Main UI"]
        Settings["Settings Interface"]
        CustomUI["Custom UI Components"]
        UIUtils["UI Utilities"]
        NotifyUI["Notification UI"]
    end

    subgraph Core["Core Business Logic"]
        PomCore["Pomodoro Timer"]
        PomTest["Test Suite"]
    end

    subgraph Pref["Preferences Management"]
        PrefHandler["Preferences Handler"]
    end

    subgraph Assets["Assets Management"]
        Desktop["Desktop Integration"]
        Sound["Sound Notifications"]
        NotifyScript["Notification Script"]
    end

    subgraph System["System Services"]
        SysNotify["Desktop Notifications"]
    end

    %% Relationships
    MainUI --> PomCore
    Settings --> PrefHandler
    CustomUI --> MainUI
    UIUtils --> MainUI
    NotifyUI --> SysNotify
    PomCore --> NotifyUI
    PomCore --> PrefHandler
    PrefHandler --> Sound
    NotifyUI --> Sound
    NotifyScript --> SysNotify

    %% Click Events
    click MainUI "https://github.com/tomsquest/fynodoro/blob/master/ui/ui.go"
    click Settings "https://github.com/tomsquest/fynodoro/blob/master/ui/settings.go"
    click CustomUI "https://github.com/tomsquest/fynodoro/blob/master/ui/integer_entry.go"
    click UIUtils "https://github.com/tomsquest/fynodoro/blob/master/ui/format_duration.go"
    click NotifyUI "https://github.com/tomsquest/fynodoro/blob/master/ui/notify.go"
    click PomCore "https://github.com/tomsquest/fynodoro/blob/master/pomodoro/pomodoro.go"
    click PomTest "https://github.com/tomsquest/fynodoro/blob/master/pomodoro/pomodoro_test.go"
    click PrefHandler "https://github.com/tomsquest/fynodoro/blob/master/pref/pref.go"
    click Desktop "https://github.com/tomsquest/fynodoro/blob/master/assets/fynodoro.desktop"
    click Sound "https://github.com/tomsquest/fynodoro/blob/master/assets/notification.mp3"
    click NotifyScript "https://github.com/tomsquest/fynodoro/blob/master/assets/notify.sh"

    %% Style Applications
    class MainUI,Settings,CustomUI,UIUtils,NotifyUI ui
    class PomCore,PomTest core
    class PrefHandler pref
    class Desktop,Sound,NotifyScript asset
    class SysNotify system

    %% Legend
    subgraph Legend
        UI_L["UI Component"]:::ui
        Core_L["Core Logic"]:::core
        Pref_L["Preferences"]:::pref
        Asset_L["Assets"]:::asset
        Sys_L["System Services"]:::system
    end
```
