# Phase 10: Frontend Updates ## Agent Assignment **Primary Agent:** frontend-agent **Duration:** 25-35 minutes ## Prerequisites - Phase 6 (Backend Updates) must be complete ## Objectives 1. Remove tenant selection UI (if exists) 2. Update Auth0 integration (no tenant claims) 3. Remove tenant management API client 4. Verify all API calls work with simplified backend ## Step-by-Step Instructions ### Step 1: Search for Tenant References ```bash cd frontend/src grep -r "tenant" . # Review results to identify tenant-related code ``` ### Step 2: Remove Tenant UI Components (if they exist) ```bash # Common locations: rm -f src/components/TenantSelector.tsx rm -f src/components/TenantContext.tsx rm -f src/contexts/TenantContext.tsx ``` ### Step 3: Update Auth0 Integration Modify auth configuration to not extract tenant_id: ```typescript // In auth setup file: // REMOVE: // const tenantId = user?.['https://motovaultpro.com/tenant_id']; // KEEP only: const userId = user?.sub; const roles = user?.['https://motovaultpro.com/roles'] || []; ``` ### Step 4: Remove Tenant Management API Client ```bash # If exists: rm src/core/api/tenantManagementClient.ts ``` ### Step 5: Update App.tsx ```typescript // Remove tenant provider if exists: // DELETE: // // // ``` ### Step 6: Verify API Clients Check that API clients don't send tenant headers: ```typescript // Ensure API client doesn't include: // headers: { 'X-Tenant-Id': tenantId } ``` ### Step 7: Build Frontend ```bash cd frontend npm run build # Expected: No errors ``` ### Step 8: Test in Browser ```bash docker compose restart mvp-frontend # Open browser open https://admin.motovaultpro.com # Test: - Login via Auth0 - Create vehicle - Upload document - Create fuel log # All should work without tenant context ``` ### Step 9: Check Console for Errors ``` # In browser console: # Expected: No tenant-related errors # Expected: No API call failures ``` ## Validation Criteria - [ ] No tenant UI components - [ ] Auth0 doesn't extract tenant_id - [ ] No tenant management API client - [ ] Frontend builds successfully - [ ] Application loads without errors - [ ] All features work - [ ] No console errors **Validation Commands:** ```bash npm run build # Expected: Build successful grep -r "tenant" frontend/src/ | wc -l # Expected: 0 or minimal (only in comments) ``` ## Update EXECUTION-STATE.json ```json { "phases": {"10": {"status": "completed", "validation_passed": true}} } ```