Files
supabase/apps/studio/routes/project/$ref/settings/general.tsx
Alaister YoungandAlaister Young 00bd19f06c [FE-3106] (part 10) – refactor(studio): move settings, advisors and issues pages (#53219)
Moves the `/settings/*`, `/advisors/*` and `/issues/*` page bodies into
their route files and deletes the pages (FE-3106). Part 10 of the stack.

**Depends on:** #53218

**Changed:**
- `routes/project/$ref/settings/**` – 16 page bodies inlined.
`settings/api` redirects with `<Navigate>`; billing usage, dashboard and
replica pages use typed `navigate`/`Link`
- `routes/project/$ref/{advisors,issues}/**` – 7 page bodies inlined
- Settings tests moved from `tests/pages/**` to `tests/routes/**` and
rendered with `renderRoute`

-
`routes/project/$ref/advisors{.tsx,/rules.tsx,/security.tsx,/performance.tsx,/health.tsx}`
– carry master's #52993 (Advisors → Issues behind `issuesInbox`:
`IssuesCategoryRedirect`, `LegacyAdvisorsLayout`, `parseLinterLevel`,
named `LinterFilters`/`LintPageTabs`), ported from the deleted pages and
checked against master's pages + route adapters;
`LegacyAdvisorsPages.platform.test.tsx` now renders the routes
(`tests/routes/project/$ref/advisors/legacy-advisors.platform.test.tsx`)

**Removed:**
- 23 page files, and `AdvisorRulesLayout` (only the deleted rules pages
used it; `routes/project/$ref/advisors/rules.tsx` already inlines it)

Addresses
[FE-3106](https://linear.app/supabase/issue/FE-3106/move-page-bodies-into-route-files-and-delete-pages).

## To test

- Project Settings (General, Compute, Infrastructure, Add-ons, API keys,
JWT, Log drains, Webhooks, Integrations) – same layout and sidebar
- `/project/<ref>/settings/api` – redirects as before
- Advisors (Security, Performance, Rules) and Issues – same layout

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-17 16:43:20 +09:00

74 lines
3.2 KiB
TypeScript

import { createFileRoute } from '@tanstack/react-router'
import { IS_PLATFORM } from 'common'
import { PageContainer } from 'ui-patterns/PageContainer'
import {
PageHeader,
PageHeaderDescription,
PageHeaderMeta,
PageHeaderSummary,
PageHeaderTitle,
} from 'ui-patterns/PageHeader'
import { subscriptionHasHipaaAddon } from '@/components/interfaces/Billing/Subscription/Subscription.utils'
import { ComplianceConfig } from '@/components/interfaces/Settings/General/ComplianceConfig/ProjectComplianceMode'
import { CustomDomainConfig } from '@/components/interfaces/Settings/General/CustomDomainConfig/CustomDomainConfig'
import { DeleteBranchPanel } from '@/components/interfaces/Settings/General/DeleteBranchPanel'
import { DeleteProjectPanel } from '@/components/interfaces/Settings/General/DeleteProjectPanel/DeleteProjectPanel'
import { General } from '@/components/interfaces/Settings/General/General'
import { Project } from '@/components/interfaces/Settings/General/Project'
import { ServiceVersionsSection } from '@/components/interfaces/Settings/General/ServiceVersions/ServiceVersionsSection'
import { TransferProjectPanel } from '@/components/interfaces/Settings/General/TransferProjectPanel/TransferProjectPanel'
import { useOrgSubscriptionQuery } from '@/data/subscriptions/org-subscription-query'
import { useIsFeatureEnabled } from '@/hooks/misc/useIsFeatureEnabled'
import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganization'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
export const Route = createFileRoute('/project/$ref/settings/general')({
component: ProjectSettings,
staticData: { settingsLayoutTitle: 'General' },
})
function ProjectSettings() {
const { data: project } = useSelectedProjectQuery()
const { data: selectedOrganization } = useSelectedOrganizationQuery()
const isBranch = !!project?.parent_project_ref
const { projectsTransfer: projectTransferEnabled, projectSettingsCustomDomains } =
useIsFeatureEnabled(['projects:transfer', 'project_settings:custom_domains'])
const { data: subscription } = useOrgSubscriptionQuery(
{ orgSlug: selectedOrganization?.slug },
{ enabled: IS_PLATFORM }
)
const hasHipaaAddon = subscriptionHasHipaaAddon(subscription)
return (
<>
<PageHeader size="small">
<PageHeaderMeta>
<PageHeaderSummary>
<PageHeaderTitle>Project Settings</PageHeaderTitle>
<PageHeaderDescription>
General configuration, domains, ownership, and lifecycle
</PageHeaderDescription>
</PageHeaderSummary>
</PageHeaderMeta>
</PageHeader>
<PageContainer size="small">
<General />
{IS_PLATFORM && (
<>
<Project />
<ServiceVersionsSection />
{/* this is only settable on compliance orgs, currently that means HIPAA orgs */}
{!isBranch && hasHipaaAddon && <ComplianceConfig />}
{projectSettingsCustomDomains && <CustomDomainConfig />}
{!isBranch && projectTransferEnabled && <TransferProjectPanel />}
{isBranch ? <DeleteBranchPanel /> : <DeleteProjectPanel />}
</>
)}
</PageContainer>
</>
)
}