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>
77 lines
2.5 KiB
TypeScript
77 lines
2.5 KiB
TypeScript
import { createFileRoute } from '@tanstack/react-router'
|
|
import { useParams } from 'common'
|
|
import { PageContainer } from 'ui-patterns/PageContainer'
|
|
import {
|
|
PageHeader,
|
|
PageHeaderAside,
|
|
PageHeaderDescription,
|
|
PageHeaderMeta,
|
|
PageHeaderSummary,
|
|
PageHeaderTitle,
|
|
} from 'ui-patterns/PageHeader'
|
|
import { PageSection, PageSectionContent } from 'ui-patterns/PageSection'
|
|
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
|
|
|
|
import { RateLimits } from '@/components/interfaces/Auth/RateLimits/RateLimits'
|
|
import { DocsButton } from '@/components/ui/DocsButton'
|
|
import { NoPermission } from '@/components/ui/NoPermission'
|
|
import { UnknownInterface } from '@/components/ui/UnknownInterface'
|
|
import { FGA_PERMISSIONS, useAsyncCheckPermissionsV2 } from '@/hooks/misc/useCheckPermissionsV2'
|
|
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
export const Route = createFileRoute('/project/$ref/auth/rate-limits')({
|
|
component: RateLimitsPage,
|
|
staticData: {
|
|
authLayoutTitle: 'Rate Limits',
|
|
},
|
|
})
|
|
|
|
function RateLimitsPage() {
|
|
const { ref } = useParams()
|
|
const showRateLimits = useIsFeatureEnabled('authentication:rate_limits')
|
|
|
|
const { can: canReadAuthSettings, isSuccess: isPermissionsLoaded } = useAsyncCheckPermissionsV2(
|
|
FGA_PERMISSIONS.PROJECT.AUTH_CONFIG_READ
|
|
)
|
|
|
|
if (!showRateLimits) {
|
|
return <UnknownInterface urlBack={`/project/${ref}/auth/users`} />
|
|
}
|
|
|
|
if (isPermissionsLoaded && !canReadAuthSettings) {
|
|
return <NoPermission isFullPage resourceText="access your project's auth rate limit settings" />
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<PageHeader size="default">
|
|
<PageHeaderMeta>
|
|
<PageHeaderSummary>
|
|
<PageHeaderTitle>Rate Limits</PageHeaderTitle>
|
|
<PageHeaderDescription>
|
|
Safeguard against bursts of incoming traffic to prevent abuse and maximize stability
|
|
</PageHeaderDescription>
|
|
</PageHeaderSummary>
|
|
<PageHeaderAside>
|
|
<DocsButton
|
|
href={`${DOCS_URL}/guides/platform/going-into-prod#rate-limiting-resource-allocation--abuse-prevention`}
|
|
/>
|
|
</PageHeaderAside>
|
|
</PageHeaderMeta>
|
|
</PageHeader>
|
|
<PageContainer size="default">
|
|
{!isPermissionsLoaded ? (
|
|
<PageSection>
|
|
<PageSectionContent>
|
|
<GenericSkeletonLoader />
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
) : (
|
|
<RateLimits />
|
|
)}
|
|
</PageContainer>
|
|
</>
|
|
)
|
|
}
|