mirror of
https://github.com/lingble/twenty.git
synced 2025-11-01 05:07:56 +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 (
|
return (
|
||||||
<MultiItemFieldInput
|
<MultiItemFieldInput
|
||||||
items={emails}
|
items={emails}
|
||||||
@@ -46,7 +48,7 @@ export const EmailsFieldInput = ({ onCancel }: EmailsFieldInputProps) => {
|
|||||||
<EmailsFieldMenuItem
|
<EmailsFieldMenuItem
|
||||||
key={index}
|
key={index}
|
||||||
dropdownId={`${hotkeyScope}-emails-${index}`}
|
dropdownId={`${hotkeyScope}-emails-${index}`}
|
||||||
isPrimary={index === 0}
|
isPrimary={isPrimaryEmail(index)}
|
||||||
email={email}
|
email={email}
|
||||||
onEdit={handleEdit}
|
onEdit={handleEdit}
|
||||||
onSetAsPrimary={handleSetPrimary}
|
onSetAsPrimary={handleSetPrimary}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ export const LinksFieldInput = ({ onCancel }: LinksFieldInputProps) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isPrimaryLink = (index: number) => index === 0 && links?.length > 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiItemFieldInput
|
<MultiItemFieldInput
|
||||||
items={links}
|
items={links}
|
||||||
@@ -61,7 +63,7 @@ export const LinksFieldInput = ({ onCancel }: LinksFieldInputProps) => {
|
|||||||
<LinksFieldMenuItem
|
<LinksFieldMenuItem
|
||||||
key={index}
|
key={index}
|
||||||
dropdownId={`${hotkeyScope}-links-${index}`}
|
dropdownId={`${hotkeyScope}-links-${index}`}
|
||||||
isPrimary={index === 0}
|
isPrimary={isPrimaryLink(index)}
|
||||||
label={link.label}
|
label={link.label}
|
||||||
onEdit={handleEdit}
|
onEdit={handleEdit}
|
||||||
onSetAsPrimary={handleSetPrimary}
|
onSetAsPrimary={handleSetPrimary}
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ export const PhonesFieldInput = ({ onCancel }: PhonesFieldInputProps) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isPrimaryPhone = (index: number) => index === 0 && phones?.length > 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MultiItemFieldInput
|
<MultiItemFieldInput
|
||||||
items={phones}
|
items={phones}
|
||||||
@@ -108,7 +110,7 @@ export const PhonesFieldInput = ({ onCancel }: PhonesFieldInputProps) => {
|
|||||||
<PhonesFieldMenuItem
|
<PhonesFieldMenuItem
|
||||||
key={index}
|
key={index}
|
||||||
dropdownId={`${hotkeyScope}-phones-${index}`}
|
dropdownId={`${hotkeyScope}-phones-${index}`}
|
||||||
isPrimary={index === 0}
|
isPrimary={isPrimaryPhone(index)}
|
||||||
phone={phone}
|
phone={phone}
|
||||||
onEdit={handleEdit}
|
onEdit={handleEdit}
|
||||||
onSetAsPrimary={handleSetPrimary}
|
onSetAsPrimary={handleSetPrimary}
|
||||||
|
|||||||
Reference in New Issue
Block a user