Files
motovaultpro/docs/redesign/PHASE-10-FRONTEND-UPDATES.md
Eric Gullickson 046c66fc7d Redesign
2025-11-01 21:27:42 -05:00

2.5 KiB

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

cd frontend/src
grep -r "tenant" .
# Review results to identify tenant-related code

Step 2: Remove Tenant UI Components (if they exist)

# 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:

// 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

# If exists:
rm src/core/api/tenantManagementClient.ts

Step 5: Update App.tsx

// Remove tenant provider if exists:
// DELETE:
// <TenantProvider>
//   <App />
// </TenantProvider>

Step 6: Verify API Clients

Check that API clients don't send tenant headers:

// Ensure API client doesn't include:
// headers: { 'X-Tenant-Id': tenantId }

Step 7: Build Frontend

cd frontend
npm run build
# Expected: No errors

Step 8: Test in Browser

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:

npm run build
# Expected: Build successful

grep -r "tenant" frontend/src/ | wc -l
# Expected: 0 or minimal (only in comments)

Update EXECUTION-STATE.json

{
  "phases": {"10": {"status": "completed", "validation_passed": true}}
}