mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 22:59:11 +03:00
Refactor authorize page to move Next.js dependencies into the page shell and have Next.js-agnostic code for the core logic. Add unit tests for authorize screen. ## Summary by CodeRabbit * **New Features** * New end-to-end API authorization UI: loading, error, invalid, approved, and main approval screens. * Organization selector with preselection, create-organization link, MCP warning, expiration handling, and approve/decline actions. * Improved page title handling via layout/head provider. * **Tests** * Added comprehensive component tests covering loading, error, approval flows, organization states, validation, and side effects.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import type { ReactNode } from 'react'
|
|
import {
|
|
Alert_Shadcn_,
|
|
AlertDescription_Shadcn_,
|
|
AlertTitle_Shadcn_,
|
|
Card,
|
|
CardContent,
|
|
CardHeader,
|
|
WarningIcon,
|
|
} from 'ui'
|
|
|
|
import type { ResourceError } from '@/data/api-authorization/api-authorization-query'
|
|
|
|
export interface ApiAuthorizationErrorScreenProps {
|
|
error: ResourceError | undefined
|
|
}
|
|
|
|
export function ApiAuthorizationErrorScreen({
|
|
error,
|
|
}: ApiAuthorizationErrorScreenProps): ReactNode {
|
|
return (
|
|
<Card>
|
|
<CardHeader>Authorize API access</CardHeader>
|
|
<CardContent className="p-0">
|
|
<Alert_Shadcn_ variant="warning" className="border-0 rounded-t-none">
|
|
<WarningIcon />
|
|
<AlertTitle_Shadcn_>
|
|
Failed to fetch details for API authorization request
|
|
</AlertTitle_Shadcn_>
|
|
<AlertDescription_Shadcn_>
|
|
<p>Please retry your authorization request from the requesting app</p>
|
|
{error && <p className="mt-2">Error: {error?.message}</p>}
|
|
</AlertDescription_Shadcn_>
|
|
</Alert_Shadcn_>
|
|
</CardContent>
|
|
</Card>
|
|
)
|
|
}
|