# danrasett/shiftreport architecture

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

- Interactive diagram: https://gitdiagram.com/danrasett/shiftreport
- Repository: https://github.com/danrasett/shiftreport

## Overview

ShiftReport guides staff through shift handover and inventory, then supports report review and payroll. SmartShell supplies operational data; the app stores reports and related records through its Supabase adapter, with local storage also used for caching and drafts. The graph follows documented capabilities and visible imports/calls; some screen internals and the database migration were not sampled, so their detailed interactions are not inferred.

Main entry points: [`src/utils/storage.ts`](https://github.com/danrasett/shiftreport/blob/master/src/utils/storage.ts) (Reports and records), [`App.tsx`](https://github.com/danrasett/shiftreport/blob/master/App.tsx) (Navigation and access), [`src/screens/ShiftScreen.tsx`](https://github.com/danrasett/shiftreport/blob/master/src/screens/ShiftScreen.tsx) (Shift handover), [`src/utils/smartshell.ts`](https://github.com/danrasett/shiftreport/blob/master/src/utils/smartshell.ts) (SmartShell client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App workflow"]
  node_app["Navigation and access<br/>[App.tsx]"]
  node_auth["Sign-in and roles<br/>[AuthContext.tsx]"]
  node_dashboard["Dashboard"]
  node_shift["Shift handover<br/>[ShiftScreen.tsx]"]
  node_goods["Inventory<br/>[GoodsScreen.tsx]"]
  node_history["Report history<br/>[HistoryScreen.tsx]"]
  node_edit["Edit report"]
  node_salary["Payroll<br/>[SalaryScreen.tsx]"]
  node_settings["App settings<br/>[SettingsScreen.tsx]"]
  node_worker_settings["Worker pay settings"]
  node_picker["Search picker<br/>[PickerModal.tsx]"]
end

subgraph group_integrations["External integrations"]
  node_shell_client["SmartShell client<br/>[smartshell.ts]"]
  node_smartshell{{"SmartShell"}}
  node_supabase{{"Supabase REST"}}
end

subgraph group_data["Persistence and exports"]
  node_calculations["Shift calculations<br/>[calculations.ts]"]
  node_storage["Reports and records<br/>[storage.ts]"]
  node_supabase_client["Supabase adapter<br/>[supabase.ts]"]
  node_local_storage[("Device storage")]
  node_exports["Report exports<br/>[export.ts]"]
end

node_staff(("Staff user"))

node_staff -->|"opens"| node_app
node_app -->|"wraps access"| node_auth
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_shift
node_app -->|"routes to"| node_goods
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_edit
node_app -->|"routes to"| node_salary
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_worker_settings
node_auth -->|"authenticates with"| node_shell_client
node_auth -->|"loads credentials"| node_storage
node_auth -->|"syncs workers"| node_storage
node_dashboard -->|"loads summaries"| node_storage
node_shift -->|"saves drafts"| node_storage
node_shift -->|"records fines"| node_storage
node_shift -->|"loads shift data"| node_shell_client
node_shift -->|"calculates totals"| node_calculations
node_shift -->|"renders selectors"| node_picker
node_goods -->|"loads and saves"| node_storage
node_goods -->|"loads catalog"| node_shell_client
node_history -->|"loads reports"| node_storage
node_history -->|"exports history"| node_exports
node_edit -->|"updates report"| node_storage
node_edit -->|"recalculates totals"| node_calculations
node_edit -->|"renders selectors"| node_picker
node_salary -->|"loads and marks paid"| node_storage
node_salary -->|"checks roles"| node_shell_client
node_salary -->|"exports payroll"| node_exports
node_worker_settings -->|"reads and saves settings"| node_storage
node_settings -->|"uses configuration"| node_supabase_client
node_storage -->|"reads and writes"| node_supabase_client
node_storage -->|"caches and drafts"| node_local_storage
node_supabase_client -->|"calls REST API"| node_supabase
node_shell_client -->|"queries SDK service"| node_smartshell

click node_app "https://github.com/danrasett/shiftreport/blob/master/App.tsx"
click node_auth "https://github.com/danrasett/shiftreport/blob/master/src/utils/AuthContext.tsx"
click node_dashboard "https://github.com/danrasett/shiftreport/blob/master/src/screens/DashboardScreen.tsx"
click node_shift "https://github.com/danrasett/shiftreport/blob/master/src/screens/ShiftScreen.tsx"
click node_goods "https://github.com/danrasett/shiftreport/blob/master/src/screens/GoodsScreen.tsx"
click node_history "https://github.com/danrasett/shiftreport/blob/master/src/screens/HistoryScreen.tsx"
click node_edit "https://github.com/danrasett/shiftreport/blob/master/src/screens/EditReportScreen.tsx"
click node_salary "https://github.com/danrasett/shiftreport/blob/master/src/screens/SalaryScreen.tsx"
click node_settings "https://github.com/danrasett/shiftreport/blob/master/src/screens/SettingsScreen.tsx"
click node_worker_settings "https://github.com/danrasett/shiftreport/blob/master/src/screens/WorkersSettingsScreen.tsx"
click node_calculations "https://github.com/danrasett/shiftreport/blob/master/src/utils/calculations.ts"
click node_picker "https://github.com/danrasett/shiftreport/blob/master/src/components/PickerModal.tsx"
click node_storage "https://github.com/danrasett/shiftreport/blob/master/src/utils/storage.ts"
click node_supabase_client "https://github.com/danrasett/shiftreport/blob/master/src/utils/supabase.ts"
click node_exports "https://github.com/danrasett/shiftreport/blob/master/src/utils/export.ts"
click node_shell_client "https://github.com/danrasett/shiftreport/blob/master/src/utils/smartshell.ts"

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_auth,node_dashboard,node_shift,node_goods,node_history,node_edit,node_salary,node_settings,node_worker_settings,node_picker,node_staff toneBlue
class node_shell_client,node_smartshell,node_supabase toneAmber
class node_calculations,node_storage,node_supabase_client,node_local_storage,node_exports toneMint
```

## Components

### App workflow

- [Navigation and access](https://github.com/danrasett/shiftreport/blob/master/App.tsx): `App.tsx`
- [Sign-in and roles](https://github.com/danrasett/shiftreport/blob/master/src/utils/AuthContext.tsx): `src/utils/AuthContext.tsx`
- [Dashboard](https://github.com/danrasett/shiftreport/blob/master/src/screens/DashboardScreen.tsx): `src/screens/DashboardScreen.tsx`
- [Shift handover](https://github.com/danrasett/shiftreport/blob/master/src/screens/ShiftScreen.tsx): `src/screens/ShiftScreen.tsx`
- [Inventory](https://github.com/danrasett/shiftreport/blob/master/src/screens/GoodsScreen.tsx): `src/screens/GoodsScreen.tsx`
- [Report history](https://github.com/danrasett/shiftreport/blob/master/src/screens/HistoryScreen.tsx): `src/screens/HistoryScreen.tsx`
- [Edit report](https://github.com/danrasett/shiftreport/blob/master/src/screens/EditReportScreen.tsx): `src/screens/EditReportScreen.tsx`
- [Payroll](https://github.com/danrasett/shiftreport/blob/master/src/screens/SalaryScreen.tsx): `src/screens/SalaryScreen.tsx`
- [App settings](https://github.com/danrasett/shiftreport/blob/master/src/screens/SettingsScreen.tsx): `src/screens/SettingsScreen.tsx`
- [Worker pay settings](https://github.com/danrasett/shiftreport/blob/master/src/screens/WorkersSettingsScreen.tsx): `src/screens/WorkersSettingsScreen.tsx`
- [Search picker](https://github.com/danrasett/shiftreport/blob/master/src/components/PickerModal.tsx): `src/components/PickerModal.tsx`

### External integrations

- [SmartShell client](https://github.com/danrasett/shiftreport/blob/master/src/utils/smartshell.ts): `src/utils/smartshell.ts`
- **SmartShell**
- **Supabase REST**

### Persistence and exports

- [Shift calculations](https://github.com/danrasett/shiftreport/blob/master/src/utils/calculations.ts): `src/utils/calculations.ts`
- [Reports and records](https://github.com/danrasett/shiftreport/blob/master/src/utils/storage.ts): `src/utils/storage.ts`
- [Supabase adapter](https://github.com/danrasett/shiftreport/blob/master/src/utils/supabase.ts): `src/utils/supabase.ts`
- **Device storage**
- [Report exports](https://github.com/danrasett/shiftreport/blob/master/src/utils/export.ts): `src/utils/export.ts`

### Other components

- **Staff user**

## Connections

- Staff user → Navigation and access: opens (evidence: `README.md`)
- Navigation and access → Sign-in and roles: wraps access (evidence: `App.tsx`)
- Navigation and access → Dashboard: routes to (evidence: `App.tsx`)
- Navigation and access → Shift handover: routes to (evidence: `App.tsx`)
- Navigation and access → Inventory: routes to (evidence: `App.tsx`)
- Navigation and access → Report history: routes to (evidence: `App.tsx`)
- Navigation and access → Edit report: routes to (evidence: `App.tsx`)
- Navigation and access → Payroll: routes to (evidence: `App.tsx`)
- Navigation and access → App settings: routes to (evidence: `App.tsx`)
- Navigation and access → Worker pay settings: routes to (evidence: `App.tsx`)
- Sign-in and roles → SmartShell client: authenticates with (evidence: `src/utils/AuthContext.tsx`)
- Sign-in and roles → Reports and records: loads credentials (evidence: `src/utils/AuthContext.tsx`)
- Sign-in and roles → Reports and records: syncs workers (evidence: `src/utils/AuthContext.tsx`)
- Dashboard → Reports and records: loads summaries (evidence: `src/screens/DashboardScreen.tsx`)
- Shift handover → Reports and records: saves drafts (evidence: `src/screens/ShiftScreen.tsx`)
- Shift handover → Reports and records: records fines (evidence: `src/screens/ShiftScreen.tsx`)
- Shift handover → SmartShell client: loads shift data (evidence: `src/screens/ShiftScreen.tsx`)
- Shift handover → Shift calculations: calculates totals (evidence: `src/screens/ShiftScreen.tsx`)
- Shift handover → Search picker: renders selectors (evidence: `src/screens/ShiftScreen.tsx`)
- Inventory → Reports and records: loads and saves (evidence: `src/screens/GoodsScreen.tsx`)
- Inventory → SmartShell client: loads catalog (evidence: `src/screens/GoodsScreen.tsx`)
- Report history → Reports and records: loads reports (evidence: `src/screens/HistoryScreen.tsx`)
- Report history → Report exports: exports history (evidence: `src/screens/HistoryScreen.tsx`)
- Edit report → Reports and records: updates report (evidence: `src/screens/EditReportScreen.tsx`)
- Edit report → Shift calculations: recalculates totals (evidence: `src/screens/EditReportScreen.tsx`)
- Edit report → Search picker: renders selectors (evidence: `src/screens/EditReportScreen.tsx`)
- Payroll → Reports and records: loads and marks paid (evidence: `src/screens/SalaryScreen.tsx`)
- Payroll → SmartShell client: checks roles (evidence: `src/screens/SalaryScreen.tsx`)
- Payroll → Report exports: exports payroll (evidence: `src/screens/SalaryScreen.tsx`)
- Worker pay settings → Reports and records: reads and saves settings (evidence: `src/screens/WorkersSettingsScreen.tsx`)
- App settings → Supabase adapter: uses configuration (evidence: `src/screens/SettingsScreen.tsx`)
- Reports and records → Supabase adapter: reads and writes (evidence: `src/utils/storage.ts`)
- Reports and records → Device storage: caches and drafts (evidence: `src/utils/storage.ts`)
- Supabase adapter → Supabase REST: calls REST API (evidence: `src/utils/supabase.ts`)
- SmartShell client → SmartShell: queries SDK service (evidence: `src/utils/smartshell.ts`)
