mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +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" /> |
86 lines
2.9 KiB
TypeScript
86 lines
2.9 KiB
TypeScript
import { parseAsString, useQueryState } from 'nuqs'
|
|
import { useEffect } from 'react'
|
|
import { toast } from 'sonner'
|
|
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
} from 'ui'
|
|
|
|
import { useVaultSecretDeleteMutation } from '@/data/vault/vault-secret-delete-mutation'
|
|
import { useVaultSecretsQuery } from '@/data/vault/vault-secrets-query'
|
|
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
|
|
|
|
export const DeleteSecretModal = () => {
|
|
const { data: project } = useSelectedProjectQuery()
|
|
|
|
const { data: secrets = [], isSuccess } = useVaultSecretsQuery({
|
|
projectRef: project?.ref,
|
|
connectionString: project?.connectionString,
|
|
})
|
|
|
|
const [secretIdToDelete, setSelectedSecretToDelete] = useQueryState('delete', parseAsString)
|
|
const selectedSecret = secrets.find((secret) => secret.id === secretIdToDelete)
|
|
|
|
const { mutateAsync: deleteSecret, isSuccess: isSuccessDelete } = useVaultSecretDeleteMutation({
|
|
onSuccess: () => {
|
|
toast.success(`Successfully deleted secret ${selectedSecret?.name}`)
|
|
setSelectedSecretToDelete(null)
|
|
},
|
|
onError: (error) => {
|
|
toast.error(`Failed to delete secret: ${error.message}`)
|
|
},
|
|
})
|
|
|
|
const onConfirmDeleteSecret = async () => {
|
|
if (!project) return console.error('Project is required')
|
|
if (!selectedSecret) return
|
|
|
|
deleteSecret({
|
|
projectRef: project.ref,
|
|
connectionString: project?.connectionString,
|
|
id: selectedSecret.id,
|
|
})
|
|
}
|
|
|
|
useEffect(() => {
|
|
if (isSuccess && !!secretIdToDelete && !selectedSecret && !isSuccessDelete) {
|
|
toast('Secret not found')
|
|
setSelectedSecretToDelete(null)
|
|
}
|
|
}, [isSuccess, isSuccessDelete, secretIdToDelete, selectedSecret, setSelectedSecretToDelete])
|
|
|
|
return (
|
|
<AlertDialog open={!!selectedSecret} onOpenChange={() => setSelectedSecretToDelete(null)}>
|
|
<AlertDialogContent size="small">
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>Confirm to delete secret</AlertDialogTitle>
|
|
<AlertDialogDescription className="space-y-4">
|
|
<p className="text-sm">
|
|
The following secret will be permanently removed and cannot be recovered. Are you
|
|
sure?
|
|
</p>
|
|
<div className="space-y-1">
|
|
<p className="text-sm">{selectedSecret?.description}</p>
|
|
<p className="text-sm text-foreground-light">
|
|
ID: <code>{selectedSecret?.id}</code>
|
|
</p>
|
|
</div>
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
<AlertDialogAction variant="danger" onClick={onConfirmDeleteSecret}>
|
|
Confirm
|
|
</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
)
|
|
}
|