Skip to content

Commit a013fbf

Browse files
committed
refactor: rename email prop to identifier in UserIdentifier component
1 parent 34d4a63 commit a013fbf

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/Shared/Components/UserIdentifier/UserIdentifier.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const UserIdentifierTooltip = ({
1616
)
1717

1818
export const UserIdentifier = ({
19-
email,
19+
identifier,
2020
children,
2121
rootClassName,
2222
tooltipContent,
@@ -25,13 +25,13 @@ export const UserIdentifier = ({
2525
// HOOKS
2626
const { email: currentUserEmail } = useUserEmail()
2727

28-
if (!email) {
28+
if (!identifier) {
2929
return null
3030
}
3131

3232
// CONSTANTS
33-
const isCurrentUser = email === currentUserEmail
34-
const isApiToken = email.startsWith(API_TOKEN_PREFIX)
33+
const isCurrentUser = identifier === currentUserEmail
34+
const isApiToken = identifier.startsWith(API_TOKEN_PREFIX)
3535

3636
const renderIcon = () => {
3737
if (isApiToken) {
@@ -41,7 +41,7 @@ export const UserIdentifier = ({
4141
return isUserGroup ? (
4242
<Icon name="ic-users" color="N700" size={20} />
4343
) : (
44-
getAlphabetIcon(email, 'dc__no-shrink m-0-imp')
44+
getAlphabetIcon(identifier, 'dc__no-shrink m-0-imp')
4545
)
4646
}
4747

@@ -51,10 +51,10 @@ export const UserIdentifier = ({
5151
}
5252

5353
if (isApiToken) {
54-
return email.split(':')?.[1] || '-'
54+
return identifier.split(':')?.[1] || '-'
5555
}
5656

57-
return email
57+
return identifier
5858
}
5959

6060
return (
@@ -63,7 +63,9 @@ export const UserIdentifier = ({
6363
{renderIcon()}
6464
<div className="flexbox dc__gap-2">
6565
<Tooltip
66-
{...(tooltipContent ? { content: email, alwaysShowTippyOnHover: false } : { content: email })}
66+
{...(tooltipContent
67+
? { content: identifier, alwaysShowTippyOnHover: false }
68+
: { content: identifier })}
6769
>
6870
<span className="cn-9 fs-13 fw-4 lh-20 dc__truncate">{renderText()}</span>
6971
</Tooltip>

src/Shared/Components/UserIdentifier/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ReactNode } from 'react'
22

33
export interface UserIdentifierProps {
4-
email: string
4+
identifier: string
55
children?: ReactNode
66
isUserGroup?: boolean
77
rootClassName?: string

0 commit comments

Comments
 (0)