mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
Stacked PR 4/5 for page title improvements. Includes account and organization-level title updates plus organization list/selector page titles. _Base: [dnywh/feat/page-titles](https://github.com/supabase/supabase/pull/43538)_ --- ## What kind of change does this PR introduce? - Resolves FE-1960 - Resolves FE-1983 - Resolves DEPR-207 ## What is the current behavior? Page titles between surfaces are inconsistent and vague. Sometimes they say the product name: ``` My Project | My Org | Supabase ``` ...even when on a specific surface like Database > Tables. Other times they show the entity name but skip over the project or org name : ``` Edge Functions | Supabase ``` ## What is the new behavior? Account and organization-level title updates plus organization list/selector page titles, adopting the layout title format introduced in https://github.com/supabase/supabase/pull/43538: ``` users | Table Editor | My Project | My Org | Supabase hello-world | Logs | Edge Functions | My Project | My Org | Supabase Backups | Database | My Project | My Org | Supabase Authentication | My Project | My Org | Supabase ``` That format is: entity, section, surface, project, org, brand ## Additional context Related stacked PRs also based on the the original [dnywh/feat/page-titles](https://github.com/supabase/supabase/pull/43538) branch: - https://github.com/supabase/supabase/pull/43534 - https://github.com/supabase/supabase/pull/43535 - https://github.com/supabase/supabase/pull/43537 --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
97 lines
3.1 KiB
TypeScript
97 lines
3.1 KiB
TypeScript
import { TOTPFactors } from 'components/interfaces/Account/TOTPFactors'
|
|
import AccountLayout from 'components/layouts/AccountLayout/AccountLayout'
|
|
import { AppLayout } from 'components/layouts/AppLayout/AppLayout'
|
|
import { DefaultLayout } from 'components/layouts/DefaultLayout'
|
|
import { UnknownInterface } from 'components/ui/UnknownInterface'
|
|
import { useMfaListFactorsQuery } from 'data/profile/mfa-list-factors-query'
|
|
import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled'
|
|
import { Smartphone } from 'lucide-react'
|
|
import type { NextPageWithLayout } from 'types'
|
|
import {
|
|
Badge,
|
|
cn,
|
|
Collapsible_Shadcn_,
|
|
CollapsibleContent_Shadcn_,
|
|
CollapsibleTrigger_Shadcn_,
|
|
} from 'ui'
|
|
import { PageContainer } from 'ui-patterns/PageContainer'
|
|
import {
|
|
PageHeader,
|
|
PageHeaderDescription,
|
|
PageHeaderMeta,
|
|
PageHeaderSummary,
|
|
PageHeaderTitle,
|
|
} from 'ui-patterns/PageHeader'
|
|
|
|
const collapsibleClasses = [
|
|
'bg-surface-100',
|
|
'hover:bg-surface-200',
|
|
'data-open:bg-surface-200',
|
|
'border-default',
|
|
'hover:border-strong data-open:border-strong',
|
|
'data-open:pb-px col-span-12 rounded',
|
|
'-space-y-px overflow-hidden',
|
|
'border shadow',
|
|
'transition',
|
|
'hover:z-50',
|
|
]
|
|
|
|
const Security: NextPageWithLayout = () => {
|
|
const showSecuritySettings = useIsFeatureEnabled('account:show_security_settings')
|
|
|
|
const { data } = useMfaListFactorsQuery({ enabled: showSecuritySettings })
|
|
|
|
if (!showSecuritySettings) {
|
|
return <UnknownInterface urlBack={`/account/me`} />
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<PageHeader size="small">
|
|
<PageHeaderMeta>
|
|
<PageHeaderSummary>
|
|
<PageHeaderTitle>Security</PageHeaderTitle>
|
|
<PageHeaderDescription>
|
|
Manage your account security settings and authentication methods.
|
|
</PageHeaderDescription>
|
|
</PageHeaderSummary>
|
|
</PageHeaderMeta>
|
|
</PageHeader>
|
|
<PageContainer size="small">
|
|
<Collapsible_Shadcn_ className={cn('mt-8', collapsibleClasses)}>
|
|
<CollapsibleTrigger_Shadcn_ asChild>
|
|
<button
|
|
type="button"
|
|
className="group flex w-full items-center justify-between rounded py-3 px-4 md:px-6 text-foreground"
|
|
>
|
|
<div className="flex flex-row gap-4 items-center py-1">
|
|
<Smartphone strokeWidth={1.5} />
|
|
<span className="text-sm">Authenticator app</span>
|
|
</div>
|
|
|
|
{data ? (
|
|
<Badge variant={data.totp.length === 0 ? 'default' : 'success'}>
|
|
{data.totp.length} app{data.totp.length === 1 ? '' : 's'} configured
|
|
</Badge>
|
|
) : null}
|
|
</button>
|
|
</CollapsibleTrigger_Shadcn_>
|
|
<CollapsibleContent_Shadcn_ className="group border-t border-default bg-surface-100 py-6 px-4 md:px-6 text-foreground">
|
|
<TOTPFactors />
|
|
</CollapsibleContent_Shadcn_>
|
|
</Collapsible_Shadcn_>
|
|
</PageContainer>
|
|
</>
|
|
)
|
|
}
|
|
|
|
Security.getLayout = (page) => (
|
|
<AppLayout>
|
|
<DefaultLayout headerTitle="Account">
|
|
<AccountLayout title="Security">{page}</AccountLayout>
|
|
</DefaultLayout>
|
|
</AppLayout>
|
|
)
|
|
|
|
export default Security
|