+ {ifElse(
+ derive(viewMode, (v: string) => v === "list"),
+ // LIST VIEW
+ <>
+
+
+
Contacts
+
+
+
+
+ {"\uD83D\uDD0D"}
+
+
+
+
+
+
+ {contacts.map((contact, index) => (
+
c.id),
+ })}
+ >
+
+ getAvatarColor(getFullName(c.firstName, c.lastName)),
+ ),
+ color: "white",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ fontWeight: "600",
+ fontSize: "14px",
+ flexShrink: 0,
+ }}
+ >
+ {derive(contact, (c: Contact) =>
+ getInitials(c.firstName, c.lastName),
+ )}
+
+
+
+ {derive(contact, (c: Contact) =>
+ getFullName(c.firstName, c.lastName),
+ )}
+
+ {ifElse(
+ derive(
+ contact,
+ (c: Contact) => c.company || c.phone || c.email,
+ ),
+
+ {derive(
+ contact,
+ (c: Contact) => c.company || c.phone || c.email || "",
+ )}
+
,
+ null,
+ )}
+
+
{">"}
+
+ ))}
+
+ {ifElse(
+ derive(contactCount, (n: number) => n === 0),
+
+
+ {"\uD83D\uDCCB"}
+
+
+ No Contacts
+
+
+ Tap + to add a contact
+
+
,
+ null,
+ )}
+
+
+
+ {contactCount}{" "}
+ {derive(contactCount, (n: number) =>
+ n === 1 ? "Contact" : "Contacts",
+ )}
+
+ >,
+
+ // DETAIL OR ADD VIEW
+ ifElse(
+ derive(viewMode, (v: string) => v === "detail"),
+ // DETAIL VIEW
+ <>
+
+
+
Contact
+
+
+
+
+ {ifElse(
+ selectedContact,
+ <>
+
+ {detailInitials}
+
+
+ {detailDisplayName}
+
+
+ {detailCompany}
+
+
+ {/* Phone */}
+ {ifElse(
+ hasPhone,
+
+
+ phone
+
+ {detailPhone}
+
+
+
,
+ null,
+ )}
+
+ {/* Email */}
+ {ifElse(
+ hasEmail,
+
+
+ email
+
+ {detailEmail}
+
+
+
,
+ null,
+ )}
+
+ {/* Notes */}
+ {ifElse(
+ hasNotes,
+
+
+
+ notes
+
+
+ {detailNotes}
+
+
+
,
+ null,
+ )}
+
+
+ >,
+
+ Contact not found
+
,
+ )}
+
+ >,
+
+ // ADD VIEW
+ <>
+
+
+ New Contact
+
+
+
+
+ {/* Avatar preview */}
+
+ {derive(
+ { newFirstName, newLastName },
+ ({
+ newFirstName: f,
+ newLastName: l,
+ }: {
+ newFirstName: string;
+ newLastName: string;
+ }) => (f || l ? getInitials(f, l) : "\uD83D\uDC64"),
+ )}
+
+
+ {/* Form fields */}
+
+
+
+
+
+
+
+
+ >,
+ ),
+ )}
+
+ ),
+ contacts,
+ };
+});