mirror of
https://github.com/supabase/supabase.git
synced 2026-12-05 07:59:03 +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" /> |
123 lines
3.4 KiB
TypeScript
123 lines
3.4 KiB
TypeScript
import { zodResolver } from '@hookform/resolvers/zod'
|
|
import { useParams } from 'common'
|
|
import { SubmitHandler, useForm } from 'react-hook-form'
|
|
import { toast } from 'sonner'
|
|
import {
|
|
Button,
|
|
Dialog,
|
|
DialogContent,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogSection,
|
|
DialogTitle,
|
|
Form,
|
|
FormControl,
|
|
FormField,
|
|
Input,
|
|
Separator,
|
|
} from 'ui'
|
|
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
|
|
import * as z from 'zod'
|
|
|
|
import { isValidOidcIssuerUrl } from './ThirdPartyAuthForm.utils'
|
|
import { useCreateThirdPartyAuthIntegrationMutation } from '@/data/third-party-auth/integration-create-mutation'
|
|
|
|
interface CreateCustomOidcIntegrationDialogProps {
|
|
visible: boolean
|
|
onClose: () => void
|
|
}
|
|
|
|
const FORM_ID = 'create-custom-oidc-integration-form'
|
|
|
|
const FormSchema = z.object({
|
|
issuerUrl: z
|
|
.string()
|
|
.trim()
|
|
.min(1, 'Issuer URL is required')
|
|
.refine(isValidOidcIssuerUrl, 'Enter an HTTPS URL without a query string or fragment'),
|
|
})
|
|
type FormValues = z.infer<typeof FormSchema>
|
|
|
|
const defaultValues: FormValues = { issuerUrl: '' }
|
|
|
|
export const CreateCustomOidcIntegrationDialog = ({
|
|
visible,
|
|
onClose,
|
|
}: CreateCustomOidcIntegrationDialogProps) => {
|
|
const { ref: projectRef } = useParams()
|
|
|
|
const form = useForm<FormValues>({
|
|
resolver: zodResolver(FormSchema),
|
|
defaultValues,
|
|
})
|
|
|
|
const handleClose = () => {
|
|
form.reset(defaultValues)
|
|
onClose()
|
|
}
|
|
|
|
const { mutate: createAuthIntegration, isPending } = useCreateThirdPartyAuthIntegrationMutation({
|
|
onSuccess: () => {
|
|
toast.success('Custom OIDC provider added')
|
|
handleClose()
|
|
},
|
|
})
|
|
|
|
const onSubmit: SubmitHandler<FormValues> = (values) => {
|
|
createAuthIntegration({ projectRef: projectRef!, oidcIssuerUrl: values.issuerUrl })
|
|
}
|
|
|
|
return (
|
|
<Dialog open={visible} onOpenChange={(open) => !open && handleClose()}>
|
|
<DialogContent>
|
|
<DialogHeader>
|
|
<DialogTitle className="truncate">Add custom OIDC provider</DialogTitle>
|
|
</DialogHeader>
|
|
<Separator />
|
|
<DialogSection>
|
|
<Form {...form}>
|
|
<form id={FORM_ID} onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
|
<p className="text-sm text-foreground-light">
|
|
Accept JWTs from any OpenID Connect (OIDC) provider.
|
|
</p>
|
|
<FormField
|
|
control={form.control}
|
|
name="issuerUrl"
|
|
render={({ field }) => (
|
|
<FormItemLayout
|
|
label="Issuer URL"
|
|
description={
|
|
<>
|
|
Signing keys are found at the issuer's{' '}
|
|
<code>/.well-known/openid-configuration</code>
|
|
</>
|
|
}
|
|
>
|
|
<FormControl>
|
|
<Input {...field} placeholder="https://login.example.com" />
|
|
</FormControl>
|
|
</FormItemLayout>
|
|
)}
|
|
/>
|
|
</form>
|
|
</Form>
|
|
</DialogSection>
|
|
<DialogFooter>
|
|
<Button disabled={isPending} onClick={handleClose}>
|
|
Cancel
|
|
</Button>
|
|
<Button
|
|
variant="primary"
|
|
form={FORM_ID}
|
|
type="submit"
|
|
disabled={isPending}
|
|
loading={isPending}
|
|
>
|
|
Add provider
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
)
|
|
}
|