mirror of
https://github.com/lingble/twenty.git
synced 2025-10-29 11:52:28 +00:00
## Changes - Added a check to make sure that we only indicate an entry is primary if there is more than one value. - The banner icon now only displays when there are either **2 or more emails, phone numbers, or domains.** ## Emails   ## Phones   ## Domains   ## Notes This is my first time contributing so I am open to any feedback. Co-authored-by: Keerat Kohli <kkeerat012@gmail.com>
This commit is contained in:
@@ -29,6 +29,8 @@ export const EmailsFieldInput = ({ onCancel }: EmailsFieldInputProps) => {
|
||||
});
|
||||
};
|
||||
|
||||
const isPrimaryEmail = (index: number) => index === 0 && emails?.length > 1;
|
||||
|
||||
return (
|
||||
<MultiItemFieldInput
|
||||
items={emails}
|
||||
@@ -46,7 +48,7 @@ export const EmailsFieldInput = ({ onCancel }: EmailsFieldInputProps) => {
|
||||
<EmailsFieldMenuItem
|
||||
key={index}
|
||||
dropdownId={`${hotkeyScope}-emails-${index}`}
|
||||
isPrimary={index === 0}
|
||||
isPrimary={isPrimaryEmail(index)}
|
||||
email={email}
|
||||
onEdit={handleEdit}
|
||||
onSetAsPrimary={handleSetPrimary}
|
||||
|
||||
@@ -42,6 +42,8 @@ export const LinksFieldInput = ({ onCancel }: LinksFieldInputProps) => {
|
||||
});
|
||||
};
|
||||
|
||||
const isPrimaryLink = (index: number) => index === 0 && links?.length > 1;
|
||||
|
||||
return (
|
||||
<MultiItemFieldInput
|
||||
items={links}
|
||||
@@ -61,7 +63,7 @@ export const LinksFieldInput = ({ onCancel }: LinksFieldInputProps) => {
|
||||
<LinksFieldMenuItem
|
||||
key={index}
|
||||
dropdownId={`${hotkeyScope}-links-${index}`}
|
||||
isPrimary={index === 0}
|
||||
isPrimary={isPrimaryLink(index)}
|
||||
label={link.label}
|
||||
onEdit={handleEdit}
|
||||
onSetAsPrimary={handleSetPrimary}
|
||||
|
||||
@@ -78,6 +78,8 @@ export const PhonesFieldInput = ({ onCancel }: PhonesFieldInputProps) => {
|
||||
});
|
||||
};
|
||||
|
||||
const isPrimaryPhone = (index: number) => index === 0 && phones?.length > 1;
|
||||
|
||||
return (
|
||||
<MultiItemFieldInput
|
||||
items={phones}
|
||||
@@ -108,7 +110,7 @@ export const PhonesFieldInput = ({ onCancel }: PhonesFieldInputProps) => {
|
||||
<PhonesFieldMenuItem
|
||||
key={index}
|
||||
dropdownId={`${hotkeyScope}-phones-${index}`}
|
||||
isPrimary={index === 0}
|
||||
isPrimary={isPrimaryPhone(index)}
|
||||
phone={phone}
|
||||
onEdit={handleEdit}
|
||||
onSetAsPrimary={handleSetPrimary}
|
||||
|
||||
Reference in New Issue
Block a user