@@ -18,7 +18,7 @@ import {
1818 TooltipContent ,
1919 TooltipTrigger ,
2020} from '@/ui/primitives/tooltip'
21- import { getLastUsedLabel } from './api-keys-utils'
21+ import { getApiKeyIdBadgeLabel , getLastUsedLabel } from './api-keys-utils'
2222import { DeleteApiKeyDialog } from './delete-api-key-dialog'
2323
2424interface ApiKeysTableRowProps {
@@ -63,11 +63,6 @@ const ApiKeyNameCell = ({ name }: ApiKeyNameCellProps) => (
6363 </ TableCell >
6464)
6565
66- const getApiKeyIdBadgeLabel = ( id : string ) => {
67- if ( id . length <= 10 ) return id
68- return `${ id . slice ( 0 , 6 ) } ...${ id . slice ( - 4 ) } `
69- }
70-
7166const ApiKeyIdBadge = ( { id } : ApiKeyIdBadgeProps ) => {
7267 const posthog = usePostHog ( )
7368 const { toast } = useToast ( )
@@ -115,7 +110,7 @@ const ApiKeyLastUsedCell = ({
115110 { lastUsedAt ? (
116111 < Tooltip >
117112 < TooltipTrigger asChild >
118- < span className = "cursor-default border-b border-dotted border-fg-tertiary/40 " >
113+ < span className = "cursor-default" >
119114 { lastUsedLabel }
120115 </ span >
121116 </ TooltipTrigger >
@@ -135,48 +130,52 @@ const ApiKeyAddedCell = ({
135130 isCliKey,
136131 keyName,
137132 onDelete,
138- } : ApiKeyAddedCellProps ) => (
139- < TableCell className = "pl-3 pr-0 py-2 text-left text-sm text-fg-tertiary" >
140- < div className = "flex items-center gap-6 justify-between" >
141- < span className = "block w-[92px] shrink-0 whitespace-nowrap" >
142- { addedDate }
143- </ span >
144- < div className = "flex items-center gap-6" >
145- { isCliKey ? (
146- < Tooltip >
147- < TooltipTrigger asChild >
148- < span className = "text-fg-tertiary flex size-5 shrink-0 items-center justify-center" >
149- < E2BLogo className = "size-5" />
150- </ span >
151- </ TooltipTrigger >
152- < TooltipContent side = "top" > Added through E2B CLI</ TooltipContent >
153- </ Tooltip >
154- ) : createdBy ? (
155- < Tooltip >
156- < TooltipTrigger asChild >
157- < span className = "shrink-0" >
158- < UserAvatar email = { createdBy . email } />
159- </ span >
160- </ TooltipTrigger >
161- < TooltipContent side = "top" > { createdBy . email } </ TooltipContent >
162- </ Tooltip >
163- ) : (
164- < span className = "size-5 shrink-0" aria-hidden />
165- ) }
166- < Button
167- type = "button"
168- variant = "ghost"
169- size = "slate"
170- className = "text-fg-tertiary hover:text-fg shrink-0 active:translate-y-0"
171- aria-label = { `Delete ${ keyName ?? 'API key' } ` }
172- onClick = { onDelete }
173- >
174- < TrashIcon className = "size-4" />
175- </ Button >
133+ } : ApiKeyAddedCellProps ) => {
134+ const createdByEmail = createdBy ?. email ?. trim ( ) || 'Unknown user'
135+
136+ return (
137+ < TableCell className = "pl-3 pr-0 py-2 text-left text-sm text-fg-tertiary" >
138+ < div className = "flex items-center gap-6 justify-between" >
139+ < span className = "block w-[92px] shrink-0 whitespace-nowrap" >
140+ { addedDate }
141+ </ span >
142+ < div className = "flex items-center gap-6" >
143+ { isCliKey ? (
144+ < Tooltip >
145+ < TooltipTrigger asChild >
146+ < span className = "text-fg-tertiary flex size-5 shrink-0 items-center justify-center" >
147+ < E2BLogo className = "size-5" />
148+ </ span >
149+ </ TooltipTrigger >
150+ < TooltipContent side = "top" > Added through E2B CLI</ TooltipContent >
151+ </ Tooltip >
152+ ) : createdBy ? (
153+ < Tooltip >
154+ < TooltipTrigger asChild >
155+ < span className = "cursor-default shrink-0" >
156+ < UserAvatar email = { createdByEmail } />
157+ </ span >
158+ </ TooltipTrigger >
159+ < TooltipContent side = "top" > { createdByEmail } </ TooltipContent >
160+ </ Tooltip >
161+ ) : (
162+ < span className = "size-5 shrink-0" aria-hidden />
163+ ) }
164+ < Button
165+ type = "button"
166+ variant = "ghost"
167+ size = "slate"
168+ className = "text-fg-tertiary hover:text-fg shrink-0 active:translate-y-0"
169+ aria-label = { `Delete ${ keyName ?? 'API key' } ` }
170+ onClick = { onDelete }
171+ >
172+ < TrashIcon className = "size-4" />
173+ </ Button >
174+ </ div >
176175 </ div >
177- </ div >
178- </ TableCell >
179- )
176+ </ TableCell >
177+ )
178+ }
180179
181180export const ApiKeysTableRow = ( { apiKey, teamSlug } : ApiKeysTableRowProps ) => {
182181 const [ deleteOpen , setDeleteOpen ] = useState ( false )
0 commit comments