# tesonemgs5/turni architecture

> Architecture diagram of the GitHub repository tesonemgs5/turni, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tesonemgs5/turni
- Repository: https://github.com/tesonemgs5/turni

## Overview

Calendario Turni is a web, Android, and Windows app for managing work shifts. The principal workflow is organizing calendars and shift models, then importing or reviewing turn data and producing reports or exports. Supporting branches cover local backup, optional Supabase account/synchronization, document handling, and Android widgets and app updates. The source index and excerpts establish several module dependencies; unsampled UI wiring and some platform behavior are therefore omitted rather than inferred.

Main entry points: [`src/06-Logica.jsx`](https://github.com/tesonemgs5/turni/blob/master/src/06-Logica.jsx) (App logic), [`src/04-Rotazione.jsx`](https://github.com/tesonemgs5/turni/blob/master/src/04-Rotazione.jsx) (Shift rotation), [`src/07-Turni.jsx`](https://github.com/tesonemgs5/turni/blob/master/src/07-Turni.jsx) (Shift records), [`src/05-Comuni.jsx`](https://github.com/tesonemgs5/turni/blob/master/src/05-Comuni.jsx) (Shared controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Shift management"]
  node_app["App shell<br/>[01-App.jsx]"]
  node_calendar["Calendars<br/>[03-Calendario.jsx]"]
  node_logic["App logic<br/>[06-Logica.jsx]"]
  node_shifts["Shift records<br/>[07-Turni.jsx]"]
end

subgraph group_domain["Models and reports"]
  node_models_ui["Model management<br/>[02-Modelli.jsx]"]
  node_rotation["Shift rotation<br/>[04-Rotazione.jsx]"]
  node_common["Shared controls<br/>[05-Comuni.jsx]"]
  node_model_select["Model selectors"]
  node_rotation_calc["Rotation calculations"]
  node_model_order["Model ordering"]
  node_report_models["Report configuration"]
  node_report_history["Report history"]
  node_pdf_shifts["Shift PDF<br/>[14-pdf-turni.js]"]
  node_pdf_cot["COT PDF<br/>[30-pdf-cot.js]"]
  node_ocr["OCR engines<br/>[35-ocr-motori.js]"]
end

subgraph group_data["Persistence and documents"]
  node_supabase[("Supabase client<br/>[11-supabase.js]")]
  node_auth["Account access<br/>[10-auth.jsx]"]
  node_backup["State backup"]
  node_file_export["File export<br/>[18-scarica-file.js]"]
  node_documents["Documents<br/>[32-documenti.js]"]
  node_documents_ui["Document interface"]
end

subgraph group_platform["Platform integrations"]
  node_android["Android host<br/>[MainActivity.java]"]
  node_widget_plugin["Widget bridge"]
  node_widget_provider["Home-screen widget"]
  node_update_plugin["Native updater"]
  node_update_ui["Update prompts"]
  node_update_flow["Update flow"]
  node_update_plan["Update plan"]
end

node_user(("User"))

node_user -.->|"uses"| node_app
node_models_ui -->|"renders cards"| node_rotation
node_models_ui -->|"uses controls"| node_common
node_rotation -->|"renders selectors"| node_model_select
node_rotation -->|"uses controls"| node_common
node_rotation -->|"uses calculations"| node_rotation_calc
node_rotation -->|"updates inclusion"| node_report_models
node_common -->|"renders selectors"| node_model_select
node_model_select -->|"orders sections"| node_model_order
node_shifts -->|"uses parsing"| node_rotation
node_shifts -->|"uses dialogs"| node_common
node_shifts -->|"reads PDF"| node_pdf_shifts
node_shifts -->|"reads with OCR"| node_ocr
node_logic -->|"exports files"| node_file_export
node_logic -->|"updates rotation state"| node_rotation
node_logic -->|"synchronizes data"| node_supabase
node_logic -->|"uses backup"| node_backup
node_logic -->|"orders models"| node_model_order
node_logic -->|"uses report settings"| node_report_models
node_logic -->|"uses report history"| node_report_history
node_logic -->|"uses documents"| node_documents
node_auth -->|"authenticates"| node_supabase
node_backup -->|"uses remote storage"| node_supabase
node_documents_ui -->|"uses document logic"| node_documents
node_android -->|"registers"| node_widget_plugin
node_android -->|"registers"| node_update_plugin
node_widget_plugin -->|"delegates to"| node_widget_provider
node_update_ui -->|"executes updates"| node_update_flow
node_update_ui -->|"reads release details"| node_update_plan

click node_app "https://github.com/tesonemgs5/turni/blob/master/src/01-App.jsx"
click node_calendar "https://github.com/tesonemgs5/turni/blob/master/src/03-Calendario.jsx"
click node_logic "https://github.com/tesonemgs5/turni/blob/master/src/06-Logica.jsx"
click node_shifts "https://github.com/tesonemgs5/turni/blob/master/src/07-Turni.jsx"
click node_models_ui "https://github.com/tesonemgs5/turni/blob/master/src/02-Modelli.jsx"
click node_rotation "https://github.com/tesonemgs5/turni/blob/master/src/04-Rotazione.jsx"
click node_common "https://github.com/tesonemgs5/turni/blob/master/src/05-Comuni.jsx"
click node_model_select "https://github.com/tesonemgs5/turni/blob/master/src/23-tendine-modelli.jsx"
click node_rotation_calc "https://github.com/tesonemgs5/turni/blob/master/src/25-calcoli-rotazione.js"
click node_model_order "https://github.com/tesonemgs5/turni/blob/master/src/26-ordine-modelli.js"
click node_report_models "https://github.com/tesonemgs5/turni/blob/master/src/27-report-modelli.js"
click node_report_history "https://github.com/tesonemgs5/turni/blob/master/src/40-cronologia-report.js"
click node_pdf_shifts "https://github.com/tesonemgs5/turni/blob/master/src/14-pdf-turni.js"
click node_pdf_cot "https://github.com/tesonemgs5/turni/blob/master/src/30-pdf-cot.js"
click node_ocr "https://github.com/tesonemgs5/turni/blob/master/src/35-ocr-motori.js"
click node_supabase "https://github.com/tesonemgs5/turni/blob/master/src/11-supabase.js"
click node_auth "https://github.com/tesonemgs5/turni/blob/master/src/10-auth.jsx"
click node_backup "https://github.com/tesonemgs5/turni/blob/master/src/22-backup-stato.jsx"
click node_file_export "https://github.com/tesonemgs5/turni/blob/master/src/18-scarica-file.js"
click node_documents "https://github.com/tesonemgs5/turni/blob/master/src/32-documenti.js"
click node_documents_ui "https://github.com/tesonemgs5/turni/blob/master/src/33-documenti-ui.jsx"
click node_android "https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/MainActivity.java"
click node_widget_plugin "https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/TurniWidgetPlugin.java"
click node_widget_provider "https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/TurniWidgetProvider.java"
click node_update_plugin "https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/TurniUpdatePlugin.java"
click node_update_ui "https://github.com/tesonemgs5/turni/blob/master/src/12-avviso-aggiornamento.jsx"
click node_update_flow "https://github.com/tesonemgs5/turni/blob/master/src/37-aggiornamento-flusso.js"
click node_update_plan "https://github.com/tesonemgs5/turni/blob/master/src/36-aggiornamento-piano.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_calendar,node_logic,node_shifts,node_user toneBlue
class node_models_ui,node_rotation,node_common,node_model_select,node_rotation_calc,node_model_order,node_report_models,node_report_history,node_pdf_shifts,node_pdf_cot,node_ocr toneAmber
class node_supabase,node_auth,node_backup,node_file_export,node_documents,node_documents_ui toneMint
class node_android,node_widget_plugin,node_widget_provider,node_update_plugin,node_update_ui,node_update_flow,node_update_plan toneRose
```

## Components

### Shift management

- [App shell](https://github.com/tesonemgs5/turni/blob/master/src/01-App.jsx): `src/01-App.jsx`
- [Calendars](https://github.com/tesonemgs5/turni/blob/master/src/03-Calendario.jsx): `src/03-Calendario.jsx`
- [App logic](https://github.com/tesonemgs5/turni/blob/master/src/06-Logica.jsx): `src/06-Logica.jsx`
- [Shift records](https://github.com/tesonemgs5/turni/blob/master/src/07-Turni.jsx): `src/07-Turni.jsx`

### Models and reports

- [Model management](https://github.com/tesonemgs5/turni/blob/master/src/02-Modelli.jsx): `src/02-Modelli.jsx`
- [Shift rotation](https://github.com/tesonemgs5/turni/blob/master/src/04-Rotazione.jsx): `src/04-Rotazione.jsx`
- [Shared controls](https://github.com/tesonemgs5/turni/blob/master/src/05-Comuni.jsx): `src/05-Comuni.jsx`
- [Model selectors](https://github.com/tesonemgs5/turni/blob/master/src/23-tendine-modelli.jsx): `src/23-tendine-modelli.jsx`
- [Rotation calculations](https://github.com/tesonemgs5/turni/blob/master/src/25-calcoli-rotazione.js): `src/25-calcoli-rotazione.js`
- [Model ordering](https://github.com/tesonemgs5/turni/blob/master/src/26-ordine-modelli.js): `src/26-ordine-modelli.js`
- [Report configuration](https://github.com/tesonemgs5/turni/blob/master/src/27-report-modelli.js): `src/27-report-modelli.js`
- [Report history](https://github.com/tesonemgs5/turni/blob/master/src/40-cronologia-report.js): `src/40-cronologia-report.js`
- [Shift PDF](https://github.com/tesonemgs5/turni/blob/master/src/14-pdf-turni.js): `src/14-pdf-turni.js`
- [COT PDF](https://github.com/tesonemgs5/turni/blob/master/src/30-pdf-cot.js): `src/30-pdf-cot.js`
- [OCR engines](https://github.com/tesonemgs5/turni/blob/master/src/35-ocr-motori.js): `src/35-ocr-motori.js`

### Persistence and documents

- [Supabase client](https://github.com/tesonemgs5/turni/blob/master/src/11-supabase.js): `src/11-supabase.js`
- [Account access](https://github.com/tesonemgs5/turni/blob/master/src/10-auth.jsx): `src/10-auth.jsx`
- [State backup](https://github.com/tesonemgs5/turni/blob/master/src/22-backup-stato.jsx): `src/22-backup-stato.jsx`
- [File export](https://github.com/tesonemgs5/turni/blob/master/src/18-scarica-file.js): `src/18-scarica-file.js`
- [Documents](https://github.com/tesonemgs5/turni/blob/master/src/32-documenti.js): `src/32-documenti.js`
- [Document interface](https://github.com/tesonemgs5/turni/blob/master/src/33-documenti-ui.jsx): `src/33-documenti-ui.jsx`

### Platform integrations

- [Android host](https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/MainActivity.java): `android/app/src/main/java/com/turni/app/MainActivity.java`
- [Widget bridge](https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/TurniWidgetPlugin.java): `android/app/src/main/java/com/turni/app/TurniWidgetPlugin.java`
- [Home-screen widget](https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/TurniWidgetProvider.java): `android/app/src/main/java/com/turni/app/TurniWidgetProvider.java`
- [Native updater](https://github.com/tesonemgs5/turni/blob/master/android/app/src/main/java/com/turni/app/TurniUpdatePlugin.java): `android/app/src/main/java/com/turni/app/TurniUpdatePlugin.java`
- [Update prompts](https://github.com/tesonemgs5/turni/blob/master/src/12-avviso-aggiornamento.jsx): `src/12-avviso-aggiornamento.jsx`
- [Update flow](https://github.com/tesonemgs5/turni/blob/master/src/37-aggiornamento-flusso.js): `src/37-aggiornamento-flusso.js`
- [Update plan](https://github.com/tesonemgs5/turni/blob/master/src/36-aggiornamento-piano.js): `src/36-aggiornamento-piano.js`

### Other components

- **User**

## Connections

- User → App shell: uses (evidence: `README.md`)
- Model management → Shift rotation: renders cards (evidence: `src/02-Modelli.jsx`)
- Model management → Shared controls: uses controls (evidence: `src/02-Modelli.jsx`)
- Shift rotation → Model selectors: renders selectors (evidence: `src/04-Rotazione.jsx`)
- Shift rotation → Shared controls: uses controls (evidence: `src/04-Rotazione.jsx`)
- Shift rotation → Rotation calculations: uses calculations (evidence: `src/04-Rotazione.jsx`)
- Shift rotation → Report configuration: updates inclusion (evidence: `src/04-Rotazione.jsx`)
- Shared controls → Model selectors: renders selectors (evidence: `src/05-Comuni.jsx`)
- Model selectors → Model ordering: orders sections (evidence: `src/23-tendine-modelli.jsx`)
- Shift records → Shift rotation: uses parsing (evidence: `src/07-Turni.jsx`)
- Shift records → Shared controls: uses dialogs (evidence: `src/07-Turni.jsx`)
- Shift records → Shift PDF: reads PDF (evidence: `src/07-Turni.jsx`)
- Shift records → OCR engines: reads with OCR (evidence: `src/07-Turni.jsx`)
- App logic → File export: exports files (evidence: `src/06-Logica.jsx`)
- App logic → Shift rotation: updates rotation state (evidence: `src/06-Logica.jsx`)
- App logic → Supabase client: synchronizes data (evidence: `src/06-Logica.jsx`)
- App logic → State backup: uses backup (evidence: `src/06-Logica.jsx`)
- App logic → Model ordering: orders models (evidence: `src/06-Logica.jsx`)
- App logic → Report configuration: uses report settings (evidence: `src/06-Logica.jsx`)
- App logic → Report history: uses report history (evidence: `src/06-Logica.jsx`)
- App logic → Documents: uses documents (evidence: `src/06-Logica.jsx`)
- Account access → Supabase client: authenticates (evidence: `src/10-auth.jsx`)
- State backup → Supabase client: uses remote storage (evidence: `src/22-backup-stato.jsx`)
- Document interface → Documents: uses document logic (evidence: `src/02-Modelli.jsx`)
- Android host → Widget bridge: registers (evidence: `android/app/src/main/java/com/turni/app/MainActivity.java`)
- Android host → Native updater: registers (evidence: `android/app/src/main/java/com/turni/app/MainActivity.java`)
- Widget bridge → Home-screen widget: delegates to (evidence: `android/app/src/main/java/com/turni/app/TurniWidgetPlugin.java`)
- Update prompts → Update flow: executes updates (evidence: `src/12-avviso-aggiornamento.jsx`)
- Update prompts → Update plan: reads release details (evidence: `src/12-avviso-aggiornamento.jsx`)
