Files
supabase/apps/studio/components/interfaces/APIKeys/APIKeyRow.tsx
Jonathan Summers-Muir 9318404e61 Feat/api keys rollout prep (#35559)
* first pass

* init

* updated types

* fix up key reveal

* Update QuickKeyCopy.tsx

* remove quick key copy

* api key pill now only allows reveal and copy if you have perm

* Update LegacyAPIKeys.tsx

* fix up layouts

* fix copy

* Fix action menu dropdown position, few small nudges

* Remove unused files.

* Remove the hardcoded and rename the feature flag for basic API keys.

* add support for name and description, some smaller improvements

* Fix the trims for the description.

---------

Co-authored-by: Terry Sutton <saltcod@gmail.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
Co-authored-by: Stojan Dimitrovski <sdimitrovski@gmail.com>
2025-05-27 15:50:42 +02:00

62 lines
1.7 KiB
TypeScript

import { MoreVertical } from 'lucide-react'
import { motion } from 'framer-motion'
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuTrigger,
TableCell,
TableRow,
} from 'ui'
import { APIKeyDeleteDialog } from './APIKeyDeleteDialog'
import { ApiKeyPill } from './ApiKeyPill'
import { APIKeysData } from 'data/api-keys/api-keys-query'
export const APIKeyRow = ({
apiKey,
}: {
apiKey: Extract<APIKeysData[number], { type: 'secret' | 'publishable' }>
}) => {
const MotionTableRow = motion(TableRow)
return (
<MotionTableRow
layout
initial={{ opacity: 0, height: 0 }}
animate={{ opacity: 1, height: 'auto' }}
exit={{ opacity: 0, height: 0 }}
transition={{
type: 'spring',
stiffness: 500,
damping: 50,
mass: 1,
}}
>
<TableCell className="py-2">{apiKey.name}</TableCell>
<TableCell className="py-2">
<div className="flex flex-row gap-2">
<ApiKeyPill apiKey={apiKey} />
</div>
</TableCell>
<TableCell className="py-2">{apiKey.description || '/'}</TableCell>
<TableCell className="flex justify-end">
<DropdownMenu>
<DropdownMenuTrigger className="px-1 focus-visible:outline-none" asChild>
<Button
type="text"
size="tiny"
icon={
<MoreVertical size="14" className="text-foreground-light hover:text-foreground" />
}
/>
</DropdownMenuTrigger>
<DropdownMenuContent className="max-w-40" align="end">
<APIKeyDeleteDialog apiKey={apiKey} />
</DropdownMenuContent>
</DropdownMenu>
</TableCell>
</MotionTableRow>
)
}