mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
Part 5 of a 6-PR stack migrating all `next/link` imports in `apps/studio` onto TanStack Router's `Link` (or plain `<a>` for known external URLs) and removing `compat/next/link.tsx`. | Part | PR | Scope | | --- | --- | --- | | 1 | #54304 | `data/prefetchers/PrefetchableLink.tsx` and `components/ui/**` | | 2 | #54305 | `components/layouts/**` and top-level shell components | | 3 | #54306 | Database, TableGridEditor, Storage, SQLEditor, BranchManagement, Branching, Functions, Realtime | | 4 | #54307 | Integrations, Settings, Observability, LogDrains, Issues, Linter, Reports, QueryPerformance, QuerySources, ConfigDrift, DiskManagement, Compute | | **5** | **#54308 ← this PR** | **Remaining `components/interfaces/**` (Org, Billing, Auth, Support, Home, SignIn, ConnectSheet, etc.)** | | 6 | #54309 | Remove `compat/next/link.tsx` shim, Vite alias, and update basePath tests/docs | Migrates the remaining `components/interfaces/**` directories off `next/link`, leaving zero `next/link` component imports in `apps/studio`. **Changed:** - Replaced `next/link` across all 73 remaining interface files (`Organization`, `OrganizationInvite`, `Billing`, `Auth`, `Support`, `ProjectHome`, `Home`, `Project`, `ProjectCreation`, `ProjectAPIDocs`, `ApiAuthorization`, `App`, `ConnectSheet`, `SignIn`, `APIKeys`, `Account`, `CliLogin`, `Docs`, `JwtSecrets`, `Platform`) - Converted the sole remaining `UrlObject` link (`<Link href={{ pathname: '/sign-in-sso', query }}>`) in `SignInSSOForm.tsx` to `<Link to="/sign-in-sso" search={query}>` - Migrated `SupportLink.tsx` onto `DynamicLink` (`createSupportFormUrl(...)`) - Standardized external `target="_blank"` anchors with `rel="noreferrer noopener"`, switched `OverviewMetrics.tsx` observability link to typed `<Link to="/project/$ref/observability/auth">`, and adopted `InlineLink` / `InlineLinkClassName` on inline paragraph links per review feedback Addresses [FE-5108](https://linear.app/supabase/issue/FE-5108/replace-the-nextlink-shim-with-tanstack-link) ## To test - [ ] Check Organization (billing, usage, team, documents, AWS Marketplace), Auth (providers, templates, rate limits, users, OAuth apps), Support form/links, Project Home, Connect sheet, and Sign-In/SSO links - [ ] Verify `SignInWithSSOButton` preserves query params when navigating to `/sign-in-sso` - [ ] Verify `SupportLink` pre-populates support form query parameters cleanly --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
128 lines
5.2 KiB
TypeScript
128 lines
5.2 KiB
TypeScript
import { useParams } from 'common'
|
|
import { ExternalLinkIcon } from 'lucide-react'
|
|
import { Alert, AlertDescription, AlertTitle, Button, WarningIcon } from 'ui'
|
|
import {
|
|
PageSection,
|
|
PageSectionContent,
|
|
PageSectionDescription,
|
|
PageSectionMeta,
|
|
PageSectionSummary,
|
|
PageSectionTitle,
|
|
} from 'ui-patterns/PageSection'
|
|
|
|
import { getPhoneProviderValidationSchema, PROVIDERS_SCHEMAS } from '../AuthProvidersFormValidation'
|
|
import type { Provider } from './AuthProvidersForm.types'
|
|
import { ProviderForm } from './ProviderForm'
|
|
import { AlertError } from '@/components/ui/AlertError'
|
|
import { ResourceList } from '@/components/ui/Resource/ResourceList'
|
|
import { HorizontalShimmerWithIcon } from '@/components/ui/Shimmers'
|
|
import { useAuthConfigQuery } from '@/data/auth/auth-config-query'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
export const AuthProvidersForm = () => {
|
|
const { ref: projectRef } = useParams()
|
|
const {
|
|
data: authConfig,
|
|
error: authConfigError,
|
|
isPending: isLoading,
|
|
isError,
|
|
isSuccess,
|
|
} = useAuthConfigQuery({ projectRef })
|
|
|
|
return (
|
|
<PageSection>
|
|
<PageSectionMeta>
|
|
<PageSectionSummary>
|
|
<PageSectionTitle>Auth Providers</PageSectionTitle>
|
|
<PageSectionDescription>
|
|
Authenticate your users through a suite of providers and login methods
|
|
</PageSectionDescription>
|
|
</PageSectionSummary>
|
|
</PageSectionMeta>
|
|
<PageSectionContent>
|
|
{isError ? (
|
|
<AlertError
|
|
error={authConfigError}
|
|
subject="Failed to retrieve auth configuration for hooks"
|
|
/>
|
|
) : (
|
|
<div className="-space-y-px">
|
|
{authConfig?.EXTERNAL_EMAIL_ENABLED && authConfig?.MAILER_OTP_EXP > 3600 && (
|
|
<Alert className="flex w-full items-center justify-between my-3" variant="warning">
|
|
<WarningIcon />
|
|
<div>
|
|
<AlertTitle>OTP expiry exceeds recommended threshold</AlertTitle>
|
|
<AlertDescription className="flex flex-col gap-y-3">
|
|
<p>
|
|
We have detected that you have enabled the email provider with the OTP expiry
|
|
set to more than an hour. It is recommended to set this value to less than an
|
|
hour.
|
|
</p>
|
|
<Button asChild className="w-min" icon={<ExternalLinkIcon />}>
|
|
<a
|
|
href={`${DOCS_URL}/guides/security/production-checklist#auth`}
|
|
target="_blank"
|
|
rel="noreferrer noopener"
|
|
>
|
|
View security recommendations
|
|
</a>
|
|
</Button>
|
|
</AlertDescription>
|
|
</div>
|
|
</Alert>
|
|
)}
|
|
|
|
<ResourceList>
|
|
{isLoading &&
|
|
PROVIDERS_SCHEMAS.map((provider) => (
|
|
<div
|
|
key={`provider_${provider.title}`}
|
|
className="py-4 px-6 border-b last:border-b-none"
|
|
>
|
|
<HorizontalShimmerWithIcon />
|
|
</div>
|
|
))}
|
|
{isSuccess &&
|
|
PROVIDERS_SCHEMAS.map((provider) => {
|
|
const providerSchema =
|
|
provider.title === 'Phone'
|
|
? {
|
|
...provider,
|
|
validationSchema: getPhoneProviderValidationSchema(authConfig),
|
|
}
|
|
: provider
|
|
let isActive = false
|
|
if (providerSchema.title === 'SAML 2.0') {
|
|
isActive = authConfig && authConfig['SAML_ENABLED']
|
|
} else if (providerSchema.title === 'LinkedIn (OIDC)') {
|
|
isActive = authConfig && authConfig['EXTERNAL_LINKEDIN_OIDC_ENABLED']
|
|
} else if (providerSchema.title === 'Slack (OIDC)') {
|
|
isActive = authConfig && authConfig['EXTERNAL_SLACK_OIDC_ENABLED']
|
|
} else if (providerSchema.title.includes('Web3')) {
|
|
isActive = authConfig && authConfig['EXTERNAL_WEB3_SOLANA_ENABLED']
|
|
} else if (providerSchema.title.includes('X / Twitter (OAuth 2.0)')) {
|
|
isActive = authConfig && (authConfig as any)['EXTERNAL_X_ENABLED']
|
|
} else if (providerSchema.title === 'Twitter (Deprecated)') {
|
|
isActive = authConfig && authConfig['EXTERNAL_TWITTER_ENABLED']
|
|
} else {
|
|
isActive =
|
|
authConfig &&
|
|
(authConfig as any)[`EXTERNAL_${providerSchema.title.toUpperCase()}_ENABLED`]
|
|
}
|
|
return (
|
|
<ProviderForm
|
|
key={`provider_${providerSchema.title}`}
|
|
config={authConfig!}
|
|
provider={providerSchema as unknown as Provider}
|
|
isActive={isActive}
|
|
/>
|
|
)
|
|
})}
|
|
</ResourceList>
|
|
</div>
|
|
)}
|
|
</PageSectionContent>
|
|
</PageSection>
|
|
)
|
|
}
|