How shivanshu11092003/salarybox works
SalaryBox is an offline attendance demo for staff and administrators. The primary workflow is staff sign-in, selfie capture, simulated verification and location, then a locally saved attendance record shown in confirmation and history; administrators add staff and enrol faces. The README describes a shared context, local DemoApi and MMKV persistence, while sampled code confirms capture orchestration and persistence boundaries. Several screen and service implementations were not excerpted, so their internal calls are omitted where the index does not establish them.
Main entry points: RootNavigator.tsx Role-based navigator · api.ts Demo API · useApp.tsx Shared app context · AttendanceCameraScreen.tsx Capture flow
Components 30
App navigation
- Role-based navigator
src/navigation/RootNavigator.tsx - Sign in
src/screens/LoginScreen.tsx - Shared app context
src/hooks/useApp.tsx - Shared UI components
src/components/ui.tsx - Date and time formatting
src/utils/format.ts - Visual theme
src/utils/theme.ts
Staff attendance
- Staff home
src/screens/StaffHomeScreen.tsx - Capture flow
src/screens/AttendanceCameraScreen.tsx - Selfie camera
src/components/VisionSelfieCamera.tsx - Camera adapter
src/components/SelfieCamera.tsx - Success receipt
src/screens/AttendanceSuccessScreen.tsx - Failure guidance
src/screens/AttendanceFailureScreen.tsx - Attendance history
src/screens/AttendanceHistoryScreen.tsx - Attendance detail
src/screens/AttendanceDetailScreen.tsx - Attendance row
src/components/AttendanceRow.tsx - Selfie display
src/components/SelfieImage.tsx
Admin management
- Admin dashboard
src/screens/AdminDashboardScreen.tsx - Add staff
src/screens/AddStaffScreen.tsx - Staff profile
src/screens/StaffProfileScreen.tsx - Settings and reset
src/screens/SettingsScreen.tsx
Demo domain services
- Demo API
src/services/api.ts - Attendance rules
src/services/attendance.ts - Capture simulation
src/services/camera.ts - Location simulation
src/services/location.ts - Demo verification adapter
src/services/aws.ts - Seed data
src/services/seed.ts
Local data and media
- MMKV persistence
src/services/storage.ts - Private photo storage
src/services/photos.ts
Other components
- Staff user
- Admin user
Connections 36
- Staff user → Sign in: signs in
README.md - Admin user → Sign in: signs in
README.md - Sign in → Shared app context: uses session
src/screens/LoginScreen.tsx - Role-based navigator → Sign in: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Staff home: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Admin dashboard: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Capture flow: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Success receipt: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Failure guidance: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Attendance history: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Attendance detail: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Settings and reset: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Add staff: routes to
src/navigation/RootNavigator.tsx - Role-based navigator → Staff profile: routes to
src/navigation/RootNavigator.tsx - Shared app context → Demo API: creates and observes
src/hooks/useApp.tsx - Shared app context → MMKV persistence: passes persistence
src/hooks/useApp.tsx - Staff home → Shared app context: reads app state
src/screens/StaffHomeScreen.tsx - Admin dashboard → Shared app context: reads app state
src/screens/AdminDashboardScreen.tsx - Add staff → Shared app context: reads app state
src/screens/AddStaffScreen.tsx - Capture flow → Shared app context: calls capture
src/screens/AttendanceCameraScreen.tsx - Capture flow → Camera adapter: renders
src/screens/AttendanceCameraScreen.tsx - Camera adapter → Selfie camera: delegates to
src/components/SelfieCamera.tsx - Capture flow → Private photo storage: saves and discards
src/screens/AttendanceCameraScreen.tsx - Capture flow → Demo API: submits capture
src/screens/AttendanceCameraScreen.tsx - Demo API → Attendance rules: checks rules
src/services/api.ts - Demo API → Capture simulation: captures selfie
src/services/api.ts - Demo API → Location simulation: gets location
src/services/api.ts - Demo API → Demo verification adapter: simulates verification
src/services/api.ts - Demo API → Seed data: loads defaults
src/services/api.ts - Staff home → Attendance history: opens attendance
- Attendance history → Attendance row: renders rows
src/screens/AttendanceHistoryScreen.tsx - Attendance detail → Selfie display: shows photo
src/screens/AttendanceDetailScreen.tsx - Success receipt → Selfie display: shows photo
src/screens/AttendanceSuccessScreen.tsx - Settings and reset → Demo API: resets demo
- Staff home → Attendance row: renders rows
src/screens/StaffHomeScreen.tsx - Shared UI components → Date and time formatting: formats initials
src/components/ui.tsx