build fix
This commit is contained in:
parent
8f2621f384
commit
41185d8586
@ -14,6 +14,8 @@ interface Contact {
|
|||||||
group?: string;
|
group?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ContactField = 'email' | 'phone' | 'organization' | 'address';
|
||||||
|
|
||||||
interface ContactDetailsProps {
|
interface ContactDetailsProps {
|
||||||
contact: Contact | null;
|
contact: Contact | null;
|
||||||
onSave?: (contact: Contact) => void;
|
onSave?: (contact: Contact) => void;
|
||||||
@ -51,7 +53,7 @@ export const ContactDetails: React.FC<ContactDetailsProps> = ({ contact, onSave,
|
|||||||
setIsEditing(false);
|
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 = {
|
const bgColor = {
|
||||||
email: 'bg-blue-50',
|
email: 'bg-blue-50',
|
||||||
phone: 'bg-green-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">
|
<h2 className="text-xl font-semibold text-carnet-text-primary">
|
||||||
{contact.fullName || contact.email || 'Sans nom'}
|
{contact?.fullName || contact?.email || 'Sans nom'}
|
||||||
</h2>
|
</h2>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -153,10 +155,10 @@ export const ContactDetails: React.FC<ContactDetailsProps> = ({ contact, onSave,
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
{renderField('Email', contact.email, 'email', <Mail 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('Téléphone', contact?.phone, 'phone', <Phone className="h-4 w-4" />)}
|
||||||
{renderField('Organisation', contact.organization, 'organization', <Building 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('Adresse', contact?.address, 'address', <MapPin className="h-4 w-4" />)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
@ -169,7 +171,7 @@ export const ContactDetails: React.FC<ContactDetailsProps> = ({ contact, onSave,
|
|||||||
placeholder="Ajouter des notes..."
|
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>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user