# 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

{t('dashboard.title')}

// Change language changeLocale('fr') ``` Supported languages: English, Spanish, French See [TRANSLATIONS.md](./TRANSLATIONS.md) for details. ## πŸ” Security & Permissions - **Role-Based Access Control** - Fine-grained permissions - **Session Management** - Automatic timeout and expiry - **Audit Trails** - Complete action history - **Permission Gates** - Component-level access control See [PERMISSIONS.md](./PERMISSIONS.md) and [SECURITY.md](./SECURITY.md). ## β™Ώ Accessibility Full WCAG 2.1 AA compliance: - Keyboard navigation - Screen reader support - Focus management - ARIA labels and live regions - Reduced motion support See [ACCESSIBILITY_AUDIT.md](./ACCESSIBILITY_AUDIT.md) for details. ## πŸ“Š State Management Redux Toolkit for global state: ```typescript import { useAppSelector, useAppDispatch } from '@/store/hooks' import { setCurrentView } from '@/store/slices/uiSlice' const dispatch = useAppDispatch() const currentView = useAppSelector(state => state.ui.currentView) dispatch(setCurrentView('timesheets')) ``` See [REDUX_GUIDE.md](./REDUX_GUIDE.md) for complete guide. ## πŸ—ΊοΈ Roadmap See [ROADMAP.md](./ROADMAP.md) for planned features and development timeline. ## πŸ“š Additional Documentation - [PRD.md](./PRD.md) - Product Requirements - [BEST_PRACTICES.md](./BEST_PRACTICES.md) - Coding standards - [IMPLEMENTATION_SUMMARY.md](./IMPLEMENTATION_SUMMARY.md) - Technical details - [MIGRATION_INDEXEDDB.md](./MIGRATION_INDEXEDDB.md) - Data persistence guide - [LAZY_LOADING.md](./LAZY_LOADING.md) - Performance optimization ## 🀝 Contributing This is a demonstration application showcasing modern React patterns and IndexedDB integration. Feel free to use it as a reference or starting point for your own projects. ## πŸ“„ License The Spark Template files and resources from GitHub are licensed under the terms of the MIT license, Copyright GitHub, Inc.