6.7 KiB
Frontend Garage View Audit Report
Date: 2026-03-30
Auditor: QA Lead & Frontend Architect
Scope: Garage overview page (VehicleShowcase, VehicleCard, FleetTable components)
Executive Summary
The Garage view exhibits several critical issues including hardcoded values, mock data dependencies, and broken API connections. While the dual-UI architecture (B2C Cards vs B2B Table) is conceptually sound, implementation gaps prevent proper integration with backend services.
1. Hardcoded Values & Mock Data
VehicleShowcase.vue
- Line 159-163: Stats cards use hardcoded labels and icon mappings
{ label: 'Total Vehicles', value: stats.totalVehicles, icon: 'check', color: 'blue' }, { label: 'Monthly Cost', value: formatCurrency(stats.totalMonthlyExpense), icon: 'currency', color: 'green' }, { label: 'Need Service', value: stats.vehiclesNeedingService, icon: 'warning', color: 'orange' } - Line 94-113: Header titles and descriptions contain hardcoded Hungarian/English strings
- Line 119: Gradient colors (
from-blue-50 to-indigo-50) are hardcoded
VehicleCard.vue
- Lines 14-23: Status color mappings are hardcoded with English status strings
- Lines 25-51:
brandLogoUrlandgetCountryFlagfunctions contain:- Hardcoded CDN URLs (
https://cdn.simpleicons.org/,https://flagcdn.com/) - Hardcoded brand-to-country mappings (German brands, US brands, etc.)
- No fallback for missing brands
- Hardcoded CDN URLs (
- Line 89: Currency symbol hardcoded as
€(Euro-centric) - Line 57: Default vehicle image uses
vehicle.imageUrlwhich may not exist
FleetTable.vue
- Lines 13-22: Status color mappings duplicated from VehicleCard
- Lines 41-60: Duplicated
getCountryFlagfunction with same hardcoded mappings - Line 66: Header gradient colors hardcoded (
from-slate-900/90 to-slate-800/90) - Line 70: Descriptive text "Enterprise-grade vehicle oversight with real-time analytics" is hardcoded
2. Broken Logic & API Connections
Data Flow Issues
-
Vehicle Data Structure Mismatch:
- Components expect
vehicle.imageUrl,vehicle.monthlyExpense,vehicle.data_status - Backend likely returns different field names (e.g.,
thumbnail_url,monthly_cost,status)
- Components expect
-
Stats Computation:
garageStore.totalVehicles,totalMonthlyExpense,vehiclesNeedingServiceappear to be computed from mock data- No evidence of real API integration for these aggregate statistics
-
Organization Context:
fetchOrganizations()function (Line 47-75) attempts API call but has fallback to "Corporate Fleet" string- Active organization detection relies on
authStore.activeOrgIdwhich may not be synchronized
-
Empty State Handling:
- Empty state redirects to
/vehicles/add(Line 231) but route may not exist - No loading states for initial vehicle fetch beyond basic
garageStore.loading
- Empty state redirects to
API Integration Gaps
- Vehicle images: No fallback when
vehicle.imageUrlis null/undefined - Brand logos: CDN may fail (404) for uncommon brands
- Country flags: Logic based on brand name substring matching is fragile
- Currency formatting: Always uses EUR, no localization based on user/organization
3. Cleanup Strategy
Phase 1: Data Layer Unification
-
Create Vehicle Data Adapter:
// In a new file: adapters/vehicleAdapter.js export function adaptBackendVehicle(apiVehicle) { return { id: apiVehicle.id, make: apiVehicle.brand || apiVehicle.make, model: apiVehicle.model, year: apiVehicle.year || apiVehicle.manufacture_year, // ... other mappings } } -
Enhance Garage Store:
- Replace mock computations with real API calls to
/vehicles/statsendpoint - Add proper error handling and loading states
- Implement vehicle data transformation in the store
- Replace mock computations with real API calls to
Phase 2: Configuration Externalization
-
Create Configuration Files:
config/statusColors.js- Status-to-color mappingsconfig/brandCountries.js- Brand-to-country mappings (with fallbacks)config/uiStrings.js- Localizable UI strings
-
Environment-based URLs:
- Move CDN URLs to environment variables
- Add fallback image URLs for missing vehicle images
Phase 3: API Integration
-
Real Endpoints:
GET /vehicles- Replace mock vehicle dataGET /vehicles/stats- For dashboard statisticsGET /organizations/my- Already implemented, needs error handling
-
Enhanced Error States:
- Network failure UI
- Empty states with actionable CTAs
- Loading skeletons for better UX
Phase 4: Internationalization
-
Currency Localization:
- Detect user/organization currency from backend
- Use
Intl.NumberFormatwith dynamic currency code
-
Multi-language Support:
- Extract all hardcoded strings to locale files
- Implement i18n for Hungarian/English toggle
4. Critical Issues Requiring Immediate Attention
Blockers
- Vehicle Image Handling: Current implementation will break with null
imageUrl - Currency Assumption: Euro symbol hardcoded, not dynamic
- Status Mapping: Backend status values may not match frontend color mappings
High Priority
- Brand Logo CDN Failures: Need fallback to local SVG or text display
- Organization Context: Fleet mode may show incorrect organization name
- Empty State Routing:
/vehicles/addroute needs verification
5. Recommendations
Short-term (Sprint 1)
- Add prop validation with default values in VehicleCard
- Implement image fallback using
onerrorhandler - Create centralized status color configuration
- Fix the
/vehicles/addroute or update empty state CTA
Medium-term (Sprint 2)
- Implement vehicle data adapter pattern
- Add proper loading states and error boundaries
- Externalize hardcoded strings to configuration
- Enhance garage store with real API integration
Long-term (Sprint 3+)
- Full i18n implementation
- Dynamic currency/unit localization
- Advanced error recovery and retry logic
- Performance optimizations (lazy loading, image optimization)
6. Verification Checklist
- All hardcoded strings moved to configuration
- Vehicle data adapter implemented and tested
- Garage store uses real API endpoints
- Error states and loading indicators present
- Currency formatting respects user/organization settings
- Image fallbacks work for missing vehicle images
- Brand logos have appropriate fallbacks
- Organization context displays correctly in fleet mode
- Empty state CTAs navigate to valid routes
Next Steps: Begin with Phase 1 (Data Layer Unification) to establish a clean separation between API data and UI presentation, then systematically address configuration externalization.