Files
Joshen Lim ad37074869 Clean up JWT keys page (#51745)
## 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"
/>
2026-10-15 10:44:50 +08:00

64 lines
2.2 KiB
TypeScript

import { ExternalLinkIcon, HelpCircleIcon } from 'lucide-react'
import { HoverCard, HoverCardContent, HoverCardTrigger } from 'ui'
import { AlgorithmDetail, algorithmDetails } from './algorithm-details'
interface AlgorithmHoverCardProps {
algorithm: keyof typeof algorithmDetails
}
export const AlgorithmHoverCard = ({ algorithm }: AlgorithmHoverCardProps) => {
const details: AlgorithmDetail = algorithmDetails[algorithm]
return (
<div className="flex items-center gap-x-2 whitespace-nowrap">
<p>{details.label}</p>
<HoverCard closeDelay={50} openDelay={300}>
<HoverCardTrigger className="min-w-0">
<HelpCircleIcon size={14} className="text-foreground-lighter" />
</HoverCardTrigger>
<HoverCardContent className="w-88 flex items-start gap-3" side="right" align="center">
<div className="flex-1">
<h4 className="font-semibold truncate">{details.name}</h4>
<div className="flex flex-col gap-2 text-sm text-foreground-light">
<p>{details.description}</p>
<p>
Pros:
<ul className="list-disc pl-6">
{details.pros.map((pro, i) => (
<li key={i}>{pro}</li>
))}
</ul>
</p>
<p>
Cons:{' '}
<ul className="list-disc pl-6">
{details.cons.map((con, i) => (
<li key={i}>{con}</li>
))}
</ul>
<br />
</p>
</div>
<div className="space-y-1 mt-2">
{details.links.map((link, index) => (
<a
key={index}
href={link.url}
target="_blank"
rel="noopener noreferrer"
className="text-xs text-primary hover:text-primary-hover flex items-center"
>
<ExternalLinkIcon className="w-3 h-3 mr-1 shrink-0" />
<span className="truncate">{link.label}</span>
</a>
))}
</div>
</div>
</HoverCardContent>
</HoverCard>
</div>
)
}