Files
supabase/apps/studio/components/interfaces/JwtSecrets/algorithm-hover-card.tsx
T
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context

This is largely just a mechanical change here:
Opting to use lucide icons with the `Icon` suffix across all icon
imports within `studio`
- so that it’s clearer which components are icons + reduces the
possibility of name collision with our own components
- e.g <User /> vs <UserIcon />

Also added a eslint rule for this:
<img width="1069" height="167" alt="image"
src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc"
/>

And updated `AGENTS.md` as such:
```
Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced).
```
2026-10-14 12:56:55 +02:00

74 lines
2.5 KiB
TypeScript

import {
ExternalLinkIcon,
HelpCircleIcon,
LockKeyholeOpenIcon,
RectangleEllipsisIcon,
} from 'lucide-react'
import { HoverCard, HoverCardContent, HoverCardTrigger } from 'ui'
import { AlgorithmDetail, algorithmDetails } from './algorithm-details'
interface AlgorithmHoverCardProps {
algorithm: keyof typeof algorithmDetails
legacy?: boolean
}
export const AlgorithmHoverCard = ({ algorithm, legacy }: AlgorithmHoverCardProps) => {
const details: AlgorithmDetail = algorithmDetails[algorithm]
return (
<div className="flex items-center gap-x-2">
{algorithm === 'HS256' ? (
<RectangleEllipsisIcon className="shrink-0" size={14} />
) : (
<LockKeyholeOpenIcon className="shrink-0" size={14} />
)}
<p>{legacy ? `Legacy ${details.label}` : 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>
)
}