Some checks are pending
E2E / Playwright e2e (push) Waiting to run
- Introduced new ContactAvatar and ContactAvatarPicker components for enhanced avatar management in contact views. - Updated ContactDetailView and ContactFormView to utilize the new avatar components, improving user experience when adding or editing contacts. - Enhanced ContactHoverCard and ContactRow components to display avatars, providing a more visually appealing interface. - Added loading and error states in ContactsListView for better user feedback during data fetching. - Implemented a new ContactsLoadState component to handle loading and error scenarios in the contacts list. - Updated package.json to include @formkit/auto-animate for improved UI animations.
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import type { Contact } from "@/lib/compose-context"
|
|
|
|
export interface ContactAddress {
|
|
street?: string
|
|
city?: string
|
|
region?: string
|
|
postalCode?: string
|
|
country?: string
|
|
label: string
|
|
}
|
|
|
|
export interface FullContact {
|
|
id: string
|
|
/** Chemin CardDAV (PUT/DELETE). Préférer à id pour les appels API. */
|
|
path?: string
|
|
etag?: string
|
|
namePrefix?: string
|
|
firstName: string
|
|
middleName?: string
|
|
lastName: string
|
|
nameSuffix?: string
|
|
phoneticFirstName?: string
|
|
phoneticLastName?: string
|
|
nicknames?: string[]
|
|
company?: string
|
|
department?: string
|
|
jobTitle?: string
|
|
website?: string
|
|
socialProfiles?: { value: string; label: string }[]
|
|
emails: { value: string; label: string }[]
|
|
phones: { value: string; label: string }[]
|
|
addresses?: ContactAddress[]
|
|
birthday?: { day?: number; month?: number; year?: number }
|
|
notes?: string
|
|
labels?: string[]
|
|
avatarUrl?: string
|
|
interactionCount?: number
|
|
isOtherContact?: boolean
|
|
createdAt: number
|
|
updatedAt: number
|
|
}
|
|
|
|
export interface MergeSuggestion {
|
|
contactA: FullContact
|
|
contactB: FullContact
|
|
reason: import("./duplicate-detection").DuplicateMatchReason
|
|
}
|
|
|
|
export interface CoordinateSuggestion {
|
|
contact: FullContact
|
|
suggestedField: string
|
|
suggestedValue: string
|
|
}
|
|
|
|
export function fullContactDisplayName(c: FullContact): string {
|
|
return `${c.firstName} ${c.lastName}`.trim()
|
|
}
|
|
|
|
export function toComposeContact(c: FullContact): Contact {
|
|
const name = fullContactDisplayName(c)
|
|
const email = c.emails[0]?.value ?? ""
|
|
return { name, email }
|
|
}
|