mirror of
https://github.com/supabase/supabase.git
synced 2026-06-17 05:08:49 +08: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>
70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
import { useFlag } from 'common'
|
|
import Link from 'next/link'
|
|
import { useRouter } from 'next/router'
|
|
import { PropsWithChildren } from 'react'
|
|
import { NavMenu, NavMenuItem } from 'ui'
|
|
import { PageContainer } from 'ui-patterns/PageContainer'
|
|
import {
|
|
PageHeader,
|
|
PageHeaderDescription,
|
|
PageHeaderMeta,
|
|
PageHeaderNavigationTabs,
|
|
PageHeaderSummary,
|
|
PageHeaderTitle,
|
|
} from 'ui-patterns/PageHeader'
|
|
|
|
export const AccessTokensLayout = ({ children }: PropsWithChildren) => {
|
|
const router = useRouter()
|
|
const scopedTokensEnabled = useFlag('scopedPAT')
|
|
|
|
const navigationItems = [
|
|
{
|
|
label: 'Classic Tokens',
|
|
href: `/account/tokens`,
|
|
id: 'classic-tokens',
|
|
},
|
|
...(scopedTokensEnabled
|
|
? [
|
|
{
|
|
label: 'Scoped Tokens',
|
|
href: `/account/tokens/scoped`,
|
|
id: 'scoped-tokens',
|
|
},
|
|
]
|
|
: []),
|
|
]
|
|
|
|
const title = 'Access Tokens'
|
|
const description = 'Create and manage access tokens for API authentication.'
|
|
|
|
return (
|
|
<>
|
|
<PageHeader size="small">
|
|
<PageHeaderMeta>
|
|
<PageHeaderSummary>
|
|
<PageHeaderTitle>{title}</PageHeaderTitle>
|
|
<PageHeaderDescription>{description}</PageHeaderDescription>
|
|
</PageHeaderSummary>
|
|
</PageHeaderMeta>
|
|
{navigationItems.length > 0 && (
|
|
<PageHeaderNavigationTabs>
|
|
<NavMenu>
|
|
{navigationItems.map((item) => {
|
|
const isActive = router.asPath.split('?')[0] === item.href
|
|
return (
|
|
<NavMenuItem key={item.label} active={isActive}>
|
|
<Link href={item.href}>{item.label}</Link>
|
|
</NavMenuItem>
|
|
)
|
|
})}
|
|
</NavMenu>
|
|
</PageHeaderNavigationTabs>
|
|
)}
|
|
</PageHeader>
|
|
<PageContainer size="small" className="pt-8 pb-16">
|
|
{children}
|
|
</PageContainer>
|
|
</>
|
|
)
|
|
}
|