mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
Moves the account and top-level app page bodies (`/account/*`, `/organizations`, `/new`, `/new/$slug`, `/join`, `/claim-project`, `/aws-marketplace-onboarding`, `/stripe-atlas-application`, `/support/new`, `/support/link`, `/integrations/github|vercel/*`) from `pages/**` into their TanStack route files and deletes the pages. Part of the final pass of the TanStack migration (FE-3106). Part 3 of the stack, and the first page-move PR. **Depends on:** #53202 **Changed:** - `routes/_app/account/**`, `routes/_app/{organizations,new/index,support/*}.tsx`, `routes/{new/$slug,join,claim-project,aws-marketplace-onboarding,stripe-atlas-application}.tsx`, `routes/integrations/**` – page bodies inlined. `next/router`/`next/link`/`next/head` → `useNavigate`, `Link`, `<Navigate>` and inline `<title>`. `getLayout` dropped; every old `getLayout` was checked against the route tree and matches - `routes/aws-marketplace-onboarding.tsx` – reads `buyer_id` through `validateSearch` + `Route.useSearch()` - `tests/lib/route-render.tsx` – new `renderRoute(Route, { routeId, url })` helper that mounts a file route in a memory router (with the app's search serializers) so route components can be tested; used by the moved tests - `tests/lib/route-mock.ts` – the `next/router` mock now derives its dynamic-route patterns from `routes/**` instead of globbing `pages/**`, so tests keep parsing params as pages disappear - `tests/routes/**` – page tests moved from `tests/pages/**` and rendered through the route - `.github/CODEOWNERS` – `pages/new/index.tsx` owner moved to `routes/_app/new/index.tsx` **Removed:** - 19 files under `pages/account/**`, `pages/new/**`, `pages/support/{new,link}.tsx`, `pages/integrations/**` and the top-level pages listed above Addresses [FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages). ## To test - Open `/account/me`, `/account/security`, `/account/tokens`, `/account/audit` – same Account layout, header title and sidebar as before - Open an old email-change link (`/account/me#message=...`) – lands on `/account/security` with the hash - `/account/tokens/scoped` – redirects to `/account/tokens` - `/organizations` and `/new/<org>` – render with the same layout; "New organization" links work - Vercel install/marketplace flows – navigation keeps `?…` params --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { createFileRoute } from '@tanstack/react-router'
|
|
import { PageContainer } from 'ui-patterns/PageContainer'
|
|
import {
|
|
PageHeader,
|
|
PageHeaderDescription,
|
|
PageHeaderMeta,
|
|
PageHeaderSummary,
|
|
PageHeaderTitle,
|
|
} from 'ui-patterns/PageHeader'
|
|
|
|
import { SignInMethods } from '@/components/interfaces/Account/Preferences/SignInMethods'
|
|
import { getPrimarySecurityAction } from '@/components/interfaces/Account/Security/Security.utils'
|
|
import { TOTPFactors } from '@/components/interfaces/Account/TOTPFactors'
|
|
import { useAccountRecovery } from '@/hooks/misc/useAccountRecovery'
|
|
|
|
export const Route = createFileRoute('/_app/account/security')({
|
|
component: AccountSecurityPage,
|
|
staticData: {
|
|
defaultLayoutHeaderTitle: 'Account',
|
|
accountLayoutTitle: 'Security',
|
|
},
|
|
})
|
|
|
|
function AccountSecurityPage() {
|
|
const recovery = useAccountRecovery()
|
|
const primaryAction = getPrimarySecurityAction({
|
|
findings: recovery.findings,
|
|
isPending: recovery.isPending,
|
|
isError: recovery.isError,
|
|
canEnableMfa: recovery.isFactorsSuccess && recovery.verifiedFactorCount === 0,
|
|
})
|
|
|
|
return (
|
|
<>
|
|
<PageHeader size="small">
|
|
<PageHeaderMeta>
|
|
<PageHeaderSummary>
|
|
<PageHeaderTitle>Security</PageHeaderTitle>
|
|
<PageHeaderDescription>
|
|
Manage how you sign in, protect your account, and recover access.
|
|
</PageHeaderDescription>
|
|
</PageHeaderSummary>
|
|
</PageHeaderMeta>
|
|
</PageHeader>
|
|
<PageContainer size="small">
|
|
<SignInMethods primaryAction={primaryAction} />
|
|
<TOTPFactors findings={recovery.findings} primaryAction={primaryAction} />
|
|
</PageContainer>
|
|
</>
|
|
)
|
|
}
|