mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
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>
72 lines
2.2 KiB
TypeScript
72 lines
2.2 KiB
TypeScript
import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
|
import { FeatureFlagContext, useFlag } from 'common'
|
|
import { useContext, useEffect } from 'react'
|
|
import { PageContainer } from 'ui-patterns/PageContainer'
|
|
import {
|
|
PageHeader,
|
|
PageHeaderAside,
|
|
PageHeaderMeta,
|
|
PageHeaderSummary,
|
|
PageHeaderTitle,
|
|
} from 'ui-patterns/PageHeader'
|
|
|
|
import { OverviewLearnMore } from '@/components/interfaces/Auth/Overview/OverviewLearnMore'
|
|
import { OverviewMetrics } from '@/components/interfaces/Auth/Overview/OverviewMetrics'
|
|
import { DocsButton } from '@/components/ui/DocsButton'
|
|
import { useAuthOverviewQuery } from '@/data/auth/auth-overview-query'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
export const Route = createFileRoute('/project/$ref/auth/overview')({
|
|
component: AuthOverviewPage,
|
|
staticData: {
|
|
authLayoutTitle: 'Overview',
|
|
},
|
|
})
|
|
|
|
function AuthOverviewPage() {
|
|
const navigate = useNavigate()
|
|
const { ref } = Route.useParams()
|
|
const { hasLoaded } = useContext(FeatureFlagContext)
|
|
const authOverviewPageEnabled = useFlag('authOverviewPage')
|
|
|
|
const {
|
|
data: metrics,
|
|
isPending: isLoading,
|
|
error,
|
|
} = useAuthOverviewQuery({ projectRef: ref }, { enabled: !!ref })
|
|
|
|
useEffect(() => {
|
|
if (hasLoaded && !authOverviewPageEnabled) {
|
|
void navigate({ to: '/project/$ref/auth/users', params: { ref }, replace: true })
|
|
}
|
|
}, [hasLoaded, authOverviewPageEnabled, navigate, ref])
|
|
|
|
if (!authOverviewPageEnabled) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<PageHeader size="large">
|
|
<PageHeaderMeta>
|
|
<PageHeaderSummary>
|
|
<PageHeaderTitle>Overview</PageHeaderTitle>
|
|
</PageHeaderSummary>
|
|
<PageHeaderAside>
|
|
<div className="flex items-center gap-2">
|
|
<span className="text-sm text-foreground-light">
|
|
<span className="text-foreground">Last 24 hours</span>
|
|
</span>
|
|
<DocsButton href={`${DOCS_URL}/guides/auth`} />
|
|
</div>
|
|
</PageHeaderAside>
|
|
</PageHeaderMeta>
|
|
</PageHeader>
|
|
<PageContainer size="large">
|
|
<OverviewMetrics metrics={metrics} isLoading={isLoading} error={error} />
|
|
<OverviewLearnMore />
|
|
</PageContainer>
|
|
</>
|
|
)
|
|
}
|