fix: promote vehicle display utils to core with null safety (refs #165)
Create shared getVehicleLabel/getVehicleSubtitle in core/utils with VehicleLike interface. Replace all direct year/make/model concatenation across 17 consumer files to prevent null values in vehicle names. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import { useAdminAccess } from '../core/auth/useAdminAccess';
|
||||
import { useProfile, useUpdateProfile } from '../features/settings/hooks/useProfile';
|
||||
import { useExportUserData } from '../features/settings/hooks/useExportUserData';
|
||||
import { useVehicles } from '../features/vehicles/hooks/useVehicles';
|
||||
import { getVehicleSubtitle } from '@/core/utils/vehicleDisplay';
|
||||
import { useSubscription } from '../features/subscription/hooks/useSubscription';
|
||||
import { useTheme } from '../shared-minimal/theme/ThemeContext';
|
||||
import { DeleteAccountDialog } from '../features/settings/components/DeleteAccountDialog';
|
||||
@@ -375,7 +376,7 @@ export const SettingsPage: React.FC = () => {
|
||||
{index > 0 && <Divider />}
|
||||
<ListItem sx={{ py: 1.5 }}>
|
||||
<ListItemText
|
||||
primary={`${vehicle.year} ${vehicle.make} ${vehicle.model}`}
|
||||
primary={getVehicleSubtitle(vehicle) || 'Unknown Vehicle'}
|
||||
secondary={vehicle.nickname || undefined}
|
||||
primaryTypographyProps={{ fontWeight: 500 }}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user