import type { User } from '../context/AuthContext' /** Best display string for autofill: "First Last", else email local part before @. */ export function defaultDisplayNameFromUser(user: User | null): string { if (!user) return '' const full = [user.firstName, user.lastName] .map((s) => (typeof s === 'string' ? s.trim() : '')) .filter(Boolean) .join(' ') .trim() if (full) return full const email = user.email?.trim() ?? '' const at = email.indexOf('@') if (at > 0) return email.slice(0, at) return email }