Files
supabase/apps/studio/routes/project/$ref/auth/third-party.tsx
Alaister YoungandAlaister Young 5f282681ef [FE-3106] (part 7) – refactor(studio): move project auth page bodies into routes (#53216)
Moves all `/project/$ref/auth/*` page bodies into their route files and
deletes `pages/project/[ref]/auth/**` (FE-3106). Part 7 of the stack.

**Depends on:** #53215

**Changed:**
- `routes/project/$ref/auth/**` – 18 page bodies inlined. `overview`
redirects with a typed `navigate` when the flag is off and now also
re-runs once flags finish loading (before, a late flag load could skip
the redirect); `templates/$templateId` reads params from
`Route.useParams()` and uses `Link`. `authLayoutTitle` and the
`skipAuthLayout` leaves match the old `getLayout`s

**Removed:**
- 18 page files

Addresses
[FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages).

## To test

- Click through Authentication (Users, Providers, Sessions, Rate Limits,
Emails, SMTP, URL Configuration, Hooks, MFA, Attack Protection,
Third-party, OAuth) – same layout and titles
- Open an email template and use "Back" – returns to the templates list

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-17 16:00:07 +09:00

62 lines
2.2 KiB
TypeScript

import { createFileRoute } from '@tanstack/react-router'
import { useParams } from 'common'
import { PageContainer } from 'ui-patterns/PageContainer'
import { ThirdPartyAuthForm } from '@/components/interfaces/Auth/ThirdPartyAuthForm'
import AuthLayout from '@/components/layouts/AuthLayout/AuthLayout'
import { AuthProvidersLayout } from '@/components/layouts/AuthLayout/AuthProvidersLayout'
import { AlertError } from '@/components/ui/AlertError'
import { NoPermission } from '@/components/ui/NoPermission'
import { UnknownInterface } from '@/components/ui/UnknownInterface'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
import { useGrant } from '@/lib/grants'
export const Route = createFileRoute('/project/$ref/auth/third-party')({
component: ThirdPartyPage,
// The page body wraps itself in <AuthProvidersLayout>, which already
// includes <AuthLayout>. Tell the auth.tsx shell to skip its own
// AuthLayout wrap so we don't double-wrap (and double withAuth +
// ProjectLayout).
staticData: {
skipAuthLayout: true,
},
})
function ThirdPartyPage() {
const { ref } = useParams()
const integrationsGrant = useGrant('GET /v1/projects/{ref}/config/auth/third-party-auth', {
projectRef: ref,
})
const showThirdPartyAuth = useIsFeatureEnabled('authentication:third_party_auth')
if (!showThirdPartyAuth) {
return (
<AuthLayout title="Sign In / Providers">
<UnknownInterface urlBack={`/project/${ref}/auth/providers`} />
</AuthLayout>
)
}
return (
<AuthProvidersLayout>
{integrationsGrant.status === 'denied' && (
<NoPermission isFullPage resourceText="access your project's auth provider settings" />
)}
{integrationsGrant.status === 'error' && (
<PageContainer size="default" className="pb-16">
<AlertError
error={integrationsGrant.error}
subject="Failed to check auth provider settings permissions"
/>
</PageContainer>
)}
{(integrationsGrant.status === 'loading' || integrationsGrant.status === 'granted') && (
<PageContainer size="default" className="pb-16">
<ThirdPartyAuthForm />
</PageContainer>
)}
</AuthProvidersLayout>
)
}