mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
## Problem Studio relies on repeated classes to style inline code. Bare `<code>` elements can miss those styles. ## Solution Import the shared styles from #51980 and remove the repeated classes. Keep Markdown renderer behaviour and existing size overrides. Use `data-code-style="plain"` for webhook headers, CLI and upgrade commands, configuration comparisons and connected-resource labels that have their own layout. ## Review instructions Dashboard review: this PR changes Studio only. 1. Open [Database > Extensions](https://studio-staging-git-dnywh-depr-707-code-studio-supabase.vercel.app/dashboard/project/_/database/extensions). Search for `pg_trgm` or another disabled extension and turn on its toggle to open the Enable dialog. Check the Extension and Schema values and the help text under “Install in a different schema”. The SQL block should keep its highlighting and copy control. Close without installing. 2. Open [Edge Functions > Secrets](https://studio-staging-git-dnywh-depr-707-code-studio-supabase.vercel.app/dashboard/project/_/functions/secrets). Scroll to “Default secrets” and check `SUPABASE_URL` and `SUPABASE_DB_URL`: both should use the bordered inline-code style. Hover a name to see “Click to copy”, then click it and confirm the name is copied. No custom secret or deployed function is needed. 3. Compare light and dark themes at narrow and desktop widths. | Before | After | | --- | --- | | <img width="812" height="1066" alt="CleanShot 2026-10-19 at 15 35 10@2x" src="https://github.com/user-attachments/assets/e4a21310-1fac-4143-9ee6-d2452ab4f314" /> | <img width="812" height="1068" alt="CleanShot 2026-10-20 at 15 39 20@2x" src="https://github.com/user-attachments/assets/d2c91ef6-7836-4c71-8f15-d0c0df8e969d" /> |
125 lines
4.0 KiB
TypeScript
125 lines
4.0 KiB
TypeScript
import { Edit2Icon, MoreVerticalIcon, TrashIcon } from 'lucide-react'
|
|
import { toast } from 'sonner'
|
|
import {
|
|
Button,
|
|
copyToClipboard,
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuSeparator,
|
|
DropdownMenuTrigger,
|
|
TableCell,
|
|
TableRow,
|
|
Tooltip,
|
|
TooltipContent,
|
|
TooltipTrigger,
|
|
} from 'ui'
|
|
import { TimestampInfo } from 'ui-patterns/TimestampInfo'
|
|
|
|
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
|
|
import type { ProjectSecret } from '@/data/secrets/secrets-query'
|
|
import { FGA_PERMISSIONS, useAsyncCheckPermissionsV2 } from '@/hooks/misc/useCheckPermissionsV2'
|
|
|
|
interface EdgeFunctionSecretProps {
|
|
secret: ProjectSecret
|
|
onSelectDelete: () => void
|
|
onSelectEdit: () => void
|
|
}
|
|
|
|
const EdgeFunctionSecret = ({ secret, onSelectEdit, onSelectDelete }: EdgeFunctionSecretProps) => {
|
|
const { can: canUpdateSecrets } = useAsyncCheckPermissionsV2(
|
|
FGA_PERMISSIONS.PROJECT.EDGE_FUNCTIONS_SECRETS_WRITE
|
|
)
|
|
|
|
return (
|
|
<TableRow>
|
|
<TableCell>
|
|
<Tooltip>
|
|
<TooltipTrigger
|
|
onClick={() => {
|
|
copyToClipboard(secret.name)
|
|
toast.success(`Copied ${secret.name}`)
|
|
}}
|
|
>
|
|
<p className="truncate py-1">
|
|
<code>{secret.name}</code>
|
|
</p>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="bottom">Click to copy</TooltipContent>
|
|
</Tooltip>
|
|
</TableCell>
|
|
<TableCell>
|
|
<p className="max-w-96 truncate" title={secret.value}>
|
|
<code className="text-foreground-light!">{secret.value}</code>
|
|
</p>
|
|
</TableCell>
|
|
<TableCell>
|
|
{!!secret.updated_at ? (
|
|
<TimestampInfo
|
|
displayAs="utc"
|
|
utcTimestamp={secret.updated_at}
|
|
labelFormat="DD MMM YYYY HH:mm:ss (ZZ)"
|
|
className="text-sm! text-foreground-light whitespace-nowrap"
|
|
/>
|
|
) : (
|
|
'-'
|
|
)}
|
|
</TableCell>
|
|
<TableCell>
|
|
<div className="flex items-center justify-end">
|
|
<DropdownMenu>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button aria-label="More options" className="px-1" icon={<MoreVerticalIcon />} />
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent side="bottom" align="end" className="w-52">
|
|
<DropdownMenuItem asChild>
|
|
<ButtonTooltip
|
|
variant="text"
|
|
icon={<Edit2Icon size={14} />}
|
|
className="w-full justify-start group text-inherit"
|
|
disabled={!canUpdateSecrets}
|
|
onClick={() => onSelectEdit()}
|
|
tooltip={{
|
|
content: {
|
|
side: 'bottom',
|
|
text: !canUpdateSecrets
|
|
? 'You need additional permissions to edit edge function secrets'
|
|
: undefined,
|
|
},
|
|
}}
|
|
>
|
|
Edit secret
|
|
</ButtonTooltip>
|
|
</DropdownMenuItem>
|
|
|
|
<DropdownMenuSeparator />
|
|
|
|
<DropdownMenuItem asChild>
|
|
<ButtonTooltip
|
|
variant="text"
|
|
icon={<TrashIcon size={14} className="group-not-disabled:text-destructive" />}
|
|
className="w-full justify-start group text-inherit"
|
|
disabled={!canUpdateSecrets}
|
|
onClick={() => onSelectDelete()}
|
|
tooltip={{
|
|
content: {
|
|
side: 'bottom',
|
|
text: !canUpdateSecrets
|
|
? 'You need additional permissions to delete edge function secrets'
|
|
: undefined,
|
|
},
|
|
}}
|
|
>
|
|
Delete secret
|
|
</ButtonTooltip>
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
</div>
|
|
</TableCell>
|
|
</TableRow>
|
|
)
|
|
}
|
|
|
|
export default EdgeFunctionSecret
|