build fix

This commit is contained in:
alma 2025-05-05 17:52:19 +02:00
parent 8f2621f384
commit 41185d8586

View File

@ -14,6 +14,8 @@ interface Contact {
group?: string;
}
type ContactField = 'email' | 'phone' | 'organization' | 'address';
interface ContactDetailsProps {
contact: Contact | null;
onSave?: (contact: Contact) => void;
@ -51,7 +53,7 @@ export const ContactDetails: React.FC<ContactDetailsProps> = ({ contact, onSave,
setIsEditing(false);
};
const renderField = (label: string, value: string | undefined, field: keyof Contact, icon: React.ReactNode) => {
const renderField = (label: string, value: string | undefined, field: ContactField, icon: React.ReactNode) => {
const bgColor = {
email: 'bg-blue-50',
phone: 'bg-green-50',
@ -106,7 +108,7 @@ export const ContactDetails: React.FC<ContactDetailsProps> = ({ contact, onSave,
/>
) : (
<h2 className="text-xl font-semibold text-carnet-text-primary">
{contact.fullName || contact.email || 'Sans nom'}
{contact?.fullName || contact?.email || 'Sans nom'}
</h2>
)}
</div>
@ -153,10 +155,10 @@ export const ContactDetails: React.FC<ContactDetailsProps> = ({ contact, onSave,
</div>
<div className="space-y-4">
{renderField('Email', contact.email, 'email', <Mail className="h-4 w-4" />)}
{renderField('Téléphone', contact.phone, 'phone', <Phone className="h-4 w-4" />)}
{renderField('Organisation', contact.organization, 'organization', <Building className="h-4 w-4" />)}
{renderField('Adresse', contact.address, 'address', <MapPin className="h-4 w-4" />)}
{renderField('Email', contact?.email, 'email', <Mail className="h-4 w-4" />)}
{renderField('Téléphone', contact?.phone, 'phone', <Phone className="h-4 w-4" />)}
{renderField('Organisation', contact?.organization, 'organization', <Building className="h-4 w-4" />)}
{renderField('Adresse', contact?.address, 'address', <MapPin className="h-4 w-4" />)}
</div>
<div className="mt-6">
@ -169,7 +171,7 @@ export const ContactDetails: React.FC<ContactDetailsProps> = ({ contact, onSave,
placeholder="Ajouter des notes..."
/>
) : (
<p className="text-sm text-carnet-text-muted whitespace-pre-wrap">{contact.notes}</p>
<p className="text-sm text-carnet-text-muted whitespace-pre-wrap">{contact?.notes}</p>
)}
</div>
</div>