'use client'; import Image from 'next/image'; import type { DriverDTO } from '@gridpilot/racing/application/dto/DriverDTO'; import Button from '../ui/Button'; import { getImageService } from '@/lib/di-container'; import DriverRatingPill from '@/components/profile/DriverRatingPill'; interface ProfileHeaderProps { driver: DriverDTO; rating?: number | null; rank?: number | null; isOwnProfile?: boolean; onEditClick?: () => void; teamName?: string | null; teamTag?: string | null; } export default function ProfileHeader({ driver, rating, rank, isOwnProfile = false, onEditClick, teamName, teamTag, }: ProfileHeaderProps) { return (
{driver.name}

{driver.name}

{getCountryFlag(driver.country)} {teamTag && ( {teamTag} )}
iRacing ID: {driver.iracingId} {teamName && ( <> {teamTag ? `[${teamTag}] ${teamName}` : teamName} )}
{(typeof rating === 'number' || typeof rank === 'number') && (
)}
{isOwnProfile && ( )}
); } function getCountryFlag(countryCode: string): string { const code = countryCode.toUpperCase(); if (code.length === 2) { const codePoints = [...code].map(char => 127397 + char.charCodeAt(0) ); return String.fromCodePoint(...codePoints); } return '🏁'; }