mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Context Initial feedback was mainly that the "Previously used keys" table was scrollable while the top table wasn't which was a bit inconsistent UX, so this PR addresses that but also makes a couple of UI adjustments to the JWT keys page to tidy things up ### Before <img width="1142" height="912" alt="image" src="https://github.com/user-attachments/assets/ca5f8bc6-8b73-4d96-9055-24a39544fc06" /> ### After - Removed color indicators + badges on the key's status and ID - reckon these are unnecessary signals and plain texts work fine. Opted for `text-foreground-lighter` for keys which status isn't `in_use`, mainly to highlight the current key which is the most important imo - Removed icons for status and type, also reckon unnecessary as they don't really communicate the context much quicker than their texts - Removed "Legacy" prefix on the type column (e.g for HS256) - reckon unnecessary, we don't label this as legacy either in the create standby key dialog, doesn't really communicate any implications - Standardized widths of status, key id, type, and last used columns - these values are fixed and won't deviate, so fixing the widths will allow a more uniform layout across the 3 tables - Prioritise order of "current" key above "standby" key - Use ButtonTooltip + default variant for the "More actions" CTA, also removed the "Actions" header text - "Last rotated at" column only shows up on `xl` viewport breakpoint rather than `lg` - Remove a number of unnecessary class names that were applied on the `Table` components <img width="1145" height="909" alt="image" src="https://github.com/user-attachments/assets/af596931-a126-4883-999b-829a9c9359fc" />
60 lines
1.9 KiB
TypeScript
60 lines
1.9 KiB
TypeScript
import { ComponentProps, forwardRef } from 'react'
|
|
import { Button, Card, CardDescription, CardHeader, CardTitle } from 'ui'
|
|
|
|
import { Shortcut } from '@/components/ui/Shortcut'
|
|
import type { ShortcutId } from '@/state/shortcuts/registry'
|
|
|
|
interface ActionPanelProps extends Omit<React.ComponentProps<typeof Card>, 'onClick' | 'type'> {
|
|
title: string
|
|
description: string
|
|
buttonLabel: ComponentProps<typeof Button>['children']
|
|
onClick: () => void
|
|
loading: ComponentProps<typeof Button>['loading']
|
|
icon?: ComponentProps<typeof Button>['icon']
|
|
variant?: ComponentProps<typeof Button>['variant']
|
|
shortcutId?: ShortcutId
|
|
}
|
|
|
|
export const ActionPanel = forwardRef<HTMLDivElement, ActionPanelProps>(
|
|
(
|
|
{ title, description, buttonLabel, onClick, loading, icon, variant, shortcutId, ...props },
|
|
ref
|
|
) => {
|
|
const button = (
|
|
<Button onClick={onClick} loading={loading} icon={icon} variant={variant}>
|
|
{buttonLabel}
|
|
</Button>
|
|
)
|
|
|
|
return (
|
|
<Card
|
|
className="first:rounded-b-none last:rounded-t-none shadow-none only:rounded-lg"
|
|
ref={ref}
|
|
{...props}
|
|
>
|
|
<CardHeader className="lg:flex-row lg:items-center gap-3 lg:gap-10 py-4 border-0">
|
|
<div className="flex flex-col gap-2 flex-1 grow">
|
|
<CardTitle className="text-sm">{title}</CardTitle>
|
|
<CardDescription className="max-w-xl">{description}</CardDescription>
|
|
</div>
|
|
<div className="flex lg:justify-end ">
|
|
{shortcutId ? (
|
|
<Shortcut
|
|
id={shortcutId}
|
|
onTrigger={onClick}
|
|
side="bottom"
|
|
options={{ enabled: !loading }}
|
|
>
|
|
{button}
|
|
</Shortcut>
|
|
) : (
|
|
button
|
|
)}
|
|
</div>
|
|
</CardHeader>
|
|
</Card>
|
|
)
|
|
}
|
|
)
|
|
ActionPanel.displayName = 'ActionPanel'
|