Skip to content

Commit 2db48f4

Browse files
committed
refactor: update UserAvatar component to use 'label' prop instead of 'email'
- Changed the UserAvatar component to accept a 'label' prop for displaying user information, enhancing clarity in the codebase. - Updated instances of UserAvatar across member and API keys table rows to reflect this change, ensuring consistency in the usage of the component. - Removed the TeamAvatar component in favor of UserAvatar for better uniformity in the dashboard's UI. These changes aim to improve the maintainability and readability of the code related to user avatars.
1 parent 30a5425 commit 2db48f4

4 files changed

Lines changed: 7 additions & 13 deletions

File tree

src/features/dashboard/members/member-table-row.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const AddedCell = ({
257257
) : (
258258
<UserAvatar
259259
url={addedByMember?.info.avatar_url}
260-
email={addedByMember?.info.email}
260+
label={addedByMember?.info.email}
261261
/>
262262
)}
263263
{showRemove ? (

src/features/dashboard/settings/keys/api-keys-table-row.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export const ApiKeysTableRow = ({ apiKey, onDelete }: ApiKeysTableRowProps) => {
123123
<Tooltip>
124124
<TooltipTrigger asChild>
125125
<span className="cursor-default shrink-0">
126-
<UserAvatar email={createdByEmail} />
126+
<UserAvatar label={createdByEmail} />
127127
</span>
128128
</TooltipTrigger>
129129
<TooltipContent side="top">{createdByEmail}</TooltipContent>

src/features/dashboard/settings/webhooks/table-row.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from '@/ui/primitives/icons'
2121
import { TableCell, TableRow } from '@/ui/primitives/table'
2222
import { useDashboard } from '../../context'
23-
import { TeamAvatar } from '../../sidebar/team-avatar'
23+
import { UserAvatar } from '../../shared'
2424
import { WEBHOOK_EVENT_LABELS, WEBHOOK_EVENTS } from './constants'
2525
import WebhookDeleteDialog from './delete-dialog'
2626
import WebhookEditSecretDialog from './edit-secret-dialog'
@@ -135,13 +135,7 @@ export const WebhookTableRow = ({ webhook, className }: WebhookRowProps) => {
135135
<p className="w-[92px] text-left text-fg-tertiary prose-body">
136136
{createdAt}
137137
</p>
138-
<TeamAvatar
139-
team={team}
140-
classNames={{
141-
root: 'size-5 shrink-0 border border-white/10',
142-
image: 'size-full',
143-
}}
144-
/>
138+
<UserAvatar label={team.name} />
145139
</div>
146140
</TableCell>
147141

src/features/dashboard/shared/user-avatar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import { cn } from '@/lib/utils'
44
import { Avatar, AvatarFallback, AvatarImage } from '@/ui/primitives/avatar'
55

66
interface UserAvatarProps {
7-
email?: string | null
7+
label?: string | null
88
url?: string | null
99
className?: string
1010
}
1111

12-
export const UserAvatar = ({ email, url, className }: UserAvatarProps) => (
12+
export const UserAvatar = ({ label, url, className }: UserAvatarProps) => (
1313
<Avatar className={cn('border-stroke size-5 shrink-0 border', className)}>
1414
<AvatarImage referrerPolicy="no-referrer" src={url ?? undefined} />
1515
<AvatarFallback className="bg-bg text-[10px] font-bold uppercase">
16-
{email?.charAt(0).toUpperCase() ?? '?'}
16+
{label?.charAt(0).toUpperCase() ?? '?'}
1717
</AvatarFallback>
1818
</Avatar>
1919
)

0 commit comments

Comments
 (0)