# WorkForce Pro - Back Office Platform A comprehensive cloud-based pay, bill, and workforce back-office platform for recruitment, contracting, and staffing organizations. ## π Features - **Timesheet Management** - Multi-channel capture and approval workflows - **Billing & Invoicing** - Automated invoice generation and compliance - **Payroll Processing** - One-click payroll with multiple payment models - **Compliance Tracking** - Document management and expiry monitoring - **Expense Management** - Capture and control of billable expenses - **Advanced Reporting** - Real-time dashboards and custom reports - **Multi-Currency Support** - Global billing and payroll capabilities - **Self-Service Portals** - Branded portals for workers, clients, and agencies ## ποΈ Architecture ### Tech Stack - **Framework**: React 19 with TypeScript - **State Management**: Redux Toolkit - **Styling**: Tailwind CSS v4 - **UI Components**: shadcn/ui (v4) - **Icons**: Phosphor Icons - **Data Persistence**: IndexedDB - **Build Tool**: Vite 7 ### Data Persistence **All data is stored locally using IndexedDB** - a powerful browser database that provides: - Large storage capacity (50% of available disk space) - Fast indexed queries - Full ACID compliance - Offline capability See [MIGRATION_INDEXEDDB.md](./MIGRATION_INDEXEDDB.md) for complete documentation on the data persistence layer. ### Key Libraries - `framer-motion` - Animations - `recharts` - Data visualization - `date-fns` - Date handling - `react-hook-form` + `zod` - Form validation - `sonner` - Toast notifications ## π Project Structure ``` src/ βββ components/ # React components β βββ ui/ # shadcn components (40+ pre-installed) β βββ nav/ # Navigation components β βββ timesheets/ # Timesheet-specific components β βββ reports/ # Reporting components β βββ views/ # View components βββ hooks/ # Custom React hooks (100+ hooks) βββ lib/ # Utilities and core logic β βββ indexed-db.ts # IndexedDB manager β βββ utils.ts # Helper functions β βββ types.ts # TypeScript types βββ store/ # Redux store and slices βββ data/ # JSON data files β βββ app-data.json # Sample business data β βββ logins.json # User credentials β βββ translations/ # i18n files βββ styles/ # CSS files ``` ## π― Getting Started ### Prerequisites - Node.js 18+ - npm 9+ ### Installation ```bash # Install dependencies npm install # Start development server npm run dev ``` The application will be available at `http://localhost:5173` ### Default Login Development mode includes an "Express Admin Login" button. Or use: - **Email**: Any email from `logins.json` - **Password**: Not required (demo mode) ## ποΈ Data Management ### Using IndexedDB State ```typescript import { useIndexedDBState } from '@/hooks/use-indexed-db-state' import { STORES } from '@/lib/indexed-db' // For app state (preferences, settings) const [locale, setLocale] = useIndexedDBState('app-locale', 'en') // For entity data (business objects) const [timesheets, setTimesheets] = useIndexedDBState(STORES.TIMESHEETS, []) // Always use functional updates setTimesheets(current => [...current, newTimesheet]) ``` ### Direct IndexedDB Access ```typescript import { indexedDB, STORES } from '@/lib/indexed-db' // Create await indexedDB.create(STORES.TIMESHEETS, timesheet) // Read const timesheet = await indexedDB.read(STORES.TIMESHEETS, id) const allTimesheets = await indexedDB.readAll(STORES.TIMESHEETS) // Update await indexedDB.update(STORES.TIMESHEETS, updatedTimesheet) // Delete await indexedDB.delete(STORES.TIMESHEETS, id) // Query with indexes const pending = await indexedDB.readByIndex(STORES.TIMESHEETS, 'status', 'pending') ``` ## π¨ UI Components The application uses a comprehensive component library built on shadcn/ui v4: - **40+ Pre-installed Components** - All shadcn components available - **Custom Components** - Extended with business-specific components - **Design System** - Consistent styling with Tailwind CSS - **Accessibility** - WCAG 2.1 AA compliant - **Responsive** - Mobile-first design See [COMPONENT_LIBRARY.md](./COMPONENT_LIBRARY.md) for details. ## π Custom Hooks 100+ custom hooks organized by category: - **State Management** - Advanced state patterns - **Data Operations** - CRUD, filtering, sorting - **Business Logic** - Invoicing, payroll calculations, time tracking - **Accessibility** - Screen reader support, keyboard navigation - **UI Utilities** - Modals, toasts, clipboard See [HOOK_AND_COMPONENT_SUMMARY.md](./HOOK_AND_COMPONENT_SUMMARY.md) for complete reference. ## π Internationalization Multi-language support with JSON-based translations: ```typescript import { useTranslation } from '@/hooks/use-translation' const { t, locale, changeLocale } = useTranslation() // Use translations