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:
@@ -23,6 +23,7 @@ import CheckCircleRoundedIcon from '@mui/icons-material/CheckCircleRounded';
|
||||
import { useVehicles } from '../../vehicles/hooks/useVehicles';
|
||||
import { useResolveAssociation } from '../hooks/usePendingAssociations';
|
||||
import type { PendingVehicleAssociation } from '../types/email-ingestion.types';
|
||||
import { getVehicleLabel } from '@/core/utils/vehicleDisplay';
|
||||
|
||||
interface ResolveAssociationDialogProps {
|
||||
open: boolean;
|
||||
@@ -166,9 +167,7 @@ export const ResolveAssociationDialog: React.FC<ResolveAssociationDialogProps> =
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
|
||||
{vehicles.map((vehicle) => {
|
||||
const isSelected = selectedVehicleId === vehicle.id;
|
||||
const vehicleName = vehicle.nickname
|
||||
|| [vehicle.year, vehicle.make, vehicle.model].filter(Boolean).join(' ')
|
||||
|| 'Unnamed Vehicle';
|
||||
const vehicleName = getVehicleLabel(vehicle);
|
||||
|
||||
return (
|
||||
<Box
|
||||
|
||||
Reference in New Issue
Block a user