Improve ride model card to show unknown for missing category or type

Update RideModelCardProps to accept null or undefined for category and type, returning 'Unknown' if they are not provided.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 567218be-0199-4aaa-af7e-8307f67d4453
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
This commit is contained in:
pac7
2025-10-08 18:32:24 +00:00
parent 57082de69a
commit 21bd962767

View File

@@ -13,13 +13,15 @@ interface RideModelCardProps {
export function RideModelCard({ model, manufacturerSlug }: RideModelCardProps) {
const navigate = useNavigate();
const formatCategory = (category: string) => {
const formatCategory = (category: string | null | undefined) => {
if (!category) return 'Unknown';
return category.split('_').map(word =>
word.charAt(0).toUpperCase() + word.slice(1)
).join(' ');
};
const formatRideType = (type: string) => {
const formatRideType = (type: string | null | undefined) => {
if (!type) return 'Unknown';
return type.split('_').map(word =>
word.charAt(0).toUpperCase() + word.slice(1)
).join(' ');