Files
supabase/apps/studio/routes/project/$ref/auth/passkeys.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

91 lines
2.4 KiB
TypeScript

import { createFileRoute } from '@tanstack/react-router'
import { IS_PLATFORM, useFeatureFlags, useFlag } from 'common'
import { PageContainer } from 'ui-patterns/PageContainer'
import {
PageHeader,
PageHeaderDescription,
PageHeaderMeta,
PageHeaderSummary,
PageHeaderTitle,
} from 'ui-patterns/PageHeader'
import { PageSection, PageSectionContent } from 'ui-patterns/PageSection'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
import { PasskeysSettingsForm } from '@/components/interfaces/Auth/Passkeys/PasskeysSettingsForm'
export const Route = createFileRoute('/project/$ref/auth/passkeys')({
component: PasskeysPage,
staticData: {
authLayoutTitle: 'Passkeys',
},
})
function PasskeysPage() {
const { hasLoaded: flagsLoaded } = useFeatureFlags()
const isPasskeyAuthEnabled = useFlag('enablePasskeyAuth')
const isResolvingPasskeyFlag = IS_PLATFORM && !flagsLoaded
if (isResolvingPasskeyFlag) {
return (
<>
<PageHeader size="default">
<PageHeaderMeta>
<HeaderSummary />
</PageHeaderMeta>
</PageHeader>
<PageContainer size="default">
<PageSection>
<PageSectionContent>
<GenericSkeletonLoader />
</PageSectionContent>
</PageSection>
</PageContainer>
</>
)
}
if (!isPasskeyAuthEnabled) {
return (
<PageContainer size="default">
<PageSection>
<PageSectionContent>
<p className="text-sm text-foreground-light">
Passkey authentication is not available for this project.
</p>
</PageSectionContent>
</PageSection>
</PageContainer>
)
}
return (
<>
<PageHeader size="default">
<PageHeaderMeta>
<HeaderSummary />
</PageHeaderMeta>
</PageHeader>
<PageContainer size="default">
<PageSection>
<PageSectionContent>
<PasskeysSettingsForm />
</PageSectionContent>
</PageSection>
</PageContainer>
</>
)
}
const HeaderSummary = () => {
return (
<PageHeaderSummary>
<PageHeaderTitle>Passkeys</PageHeaderTitle>
<PageHeaderDescription>
Configure WebAuthn passkeys so users can sign in with biometrics, security keys, or platform
authenticators
</PageHeaderDescription>
</PageHeaderSummary>
)
}