Last Updated: April 2026 Purpose: Tracking of technical debt, architectural improvements, and domain-specific roadmap items.
Goal: Decouple data fetching from View components.
- Problem:
App.tsxandRouteEditor.tsxare monolithic (God Objects).App.tsxmanages all global listeners (>1000 lines). - Action Plan:
- Service Extraction: Move
useEffectlisteners for Users, Customers, and Routes into dedicated hooks. - Data Context: Expand
DataContextto cover all global data (Auth context done; Data context partially done). - Refactor RouteEditor: Extract logic into
useRouteEditorhook. View should only handle rendering. - Refactor Settings: Split
SystemSettings.tsxinto sub-components (DeliverySettings,RouteCounters,Maintenance).
- Service Extraction: Move
Goal: Reduce initial load time.
- Lazy Loading: Implement
React.lazy()for heavy tabs (WarehouseView,Reporting,SystemSettings,RouteEditor). - Suspense UI: Add branded loading skeletons while fetching code chunks.
- Standardized PDF/Print Components:
DownloadButton.tsxunified acrossReporting.tsxandWarehouseView.tsx. - High-Fidelity PDF: Replaced native browser print with
html2canvas+jsPDF.
Goal: Consistent "Premium White/Clean" aesthetic across all modules.
- Standards:
rounded-2xl,border-gray-100, soft shadows, uppercase tracking-wide headers, ringed avatars. - Status:
- Fleet Management — fully updated (desktop table + mobile cards)
- Warehouse View — Picking Manifest, Loading Plan, Inventory Status
- Reporting — all sub-reports modernized
-
CustomerManagement.tsxandUserManagement.tsx— in progress - Logistics Dashboard (Command Center) — cards and map UI
- Menu renamed: "Manage Team" → "Team Management", "Manage Delivery" → "Route Management", "Manage Products" → "Product Management"
- Sidebar reordered for operational flow (Route Management prioritized)
Issue: batchUpdateInventory uses sequential updateDoc calls. Network failure leads to partial updates.
Fix: Rewrite to use Firestore Write Batch or Transactions for atomic operations.
Issue: Coordinates rely on regex parsing of pasted Google Maps URLs — brittle. Fix: Integrate a Geocoding API (Google Places, Mapbox, or Nominatim) to validate and standardise coordinate input.
Issue: Current optimisation is a local 2-Opt heuristic (geometric, not drive-time aware).
- Short Term: Label clearly as "Geometric Sort" in UI.
- Long Term: Integrate Distance Matrix API (OSRM or GraphHopper) for real drive-time optimisation.
Current: Prefix search via searchKey field (case-insensitive range query).
Improvement options:
searchKeywordsarray (lowercase name + phone tokens) for substring matching- Client-side Fuse.js for fuzzy search on datasets under 10k items
- Completed:
ProductService,CustomerService,UserService— cursor-based pagination. - Risk:
App.tsxglobal listeners fetch all users and active routes. Will degrade beyond ~500 concurrent users. - Fix: Convert global listeners to on-demand keyed subscriptions; paginate dashboard feeds.
-
useCameraManager: queue photo uploads in IndexedDB when offline; flush on reconnect. - Verify Service Worker caching for static assets (fonts, map tiles).
- Storage: Photos accumulate indefinitely.
autoCleanupDayssetting exists in System Settings but relies on client-side admin action — move to a scheduled Cloud Function. - Reads: Reduce global
onSnapshotlisteners to minimise Firestore read billing at scale.
- Validation: Add Firestore schema validation rules for
products(enforceprice > 0,quantity >= 0). — [ ] pending - Naming: Enforce
PascalCasefor components,camelCasefor hooks and services (mostly done). - Role usage: Strict
Roleenum usage throughout — no magic strings.