graph TD
%% Global styling
classDef auth fill:#fff2e6,stroke:#ff944d,stroke-width:2px;
classDef main fill:#f2f8ff,stroke:#4d94ff,stroke-width:2px;
classDef admin fill:#e6ffed,stroke:#2eb85c,stroke-width:2px;
classDef field fill:#fff0f0,stroke:#e55353,stroke-width:2px;
subgraph Auth_Flow [Authentication & Entry]
Start([Start App]) --> Splash[Splash Screen]
Splash --> AuthGate{Auth State?}
AuthGate -- No --> Login[Login Screen]
AuthGate -- Not Verified --> Verify[Verify Email]
Login --> Verify
Verify -- Success --> Home[Home Screen / Dashboard]
end
subgraph User_Context [Standard User Actions]
Home --> Profile[Profile & Identity]
Home --> History[Trade History]
Home --> Calendar[My Calendar]
Home --> Trade[Create/Edit Trade Request]
Trade --> Discovery[Trade Discovery Engine]
end
subgraph Field_Context [Field Activity & PKI]
Home --> Hub[Activity Hub]
Hub --> Prep[Prep field cache]
Hub --> SessionControl[Start/End Session]
Hub --> ScanMode[Scan camera or BLE]
Hub --> Station[Broadcast station QR]
Hub --> Roster[Roster departed map monitor]
ScanMode --> LocalCheck[Optimistic roster update]
Station --> SelfScan[Others scan on own phones]
SelfScan --> LocalCheck
LocalCheck --> Sync[Pending sync on reconnect]
Hub --> LiveMap[Live Map]
end
subgraph Admin_Context [Organization Management]
Profile --> MyQR[My Identity QR share]
Profile --> AdminPanel[Admin Panel]
AdminPanel --> GroupMgmt[Group Management]
AdminPanel --> RoleMgmt[Role & Permission Mgmt]
AdminPanel --> LocMgmt[Location & Geo-Fence Mgmt]
AdminPanel --> ShiftMgmt[Bulk Shift Assignment]
AdminPanel --> Reports[Time Clock & Analytics]
end
%% Role-specific connections
PKI_Verify -- Handshake Required --> Confirm[Session Confirmation Listener]
Confirm --> Sign[Device Key Signing]
Sign --> Sync
%% Class assignments
class Start,Splash,AuthGate,Login,Verify auth;
class Home,Profile,History,Calendar,Trade,Discovery main;
class AdminPanel,GroupMgmt,RoleMgmt,LocMgmt,ShiftMgmt,Reports admin;
class Scan,PKI_Verify,LocalCheck,Sync,FieldDash,SessionControl,LiveMap,Attendance,Confirm,Sign field;
Application Page Flow
This diagram illustrates the primary navigation paths a user can take through the SwapSanity application, from initial login to accessing user-level and admin-level features.