mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
Stacked PR 2/5 for page title improvements. Includes Auth, Database, editors, and Edge Functions layout title adoption. _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? Auth, Database, editors, and Edge Functions adopt 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/43535 - https://github.com/supabase/supabase/pull/43536 - https://github.com/supabase/supabase/pull/43537 --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import { useParams } from 'common'
|
|
import { ProductMenu } from 'components/ui/ProductMenu'
|
|
import { withAuth } from 'hooks/misc/withAuth'
|
|
import { useRouter } from 'next/router'
|
|
import { ComponentProps, PropsWithChildren } from 'react'
|
|
|
|
import { ProjectLayout } from '../ProjectLayout'
|
|
|
|
const EdgeFunctionsProductMenu = () => {
|
|
const { ref: projectRef = 'default' } = useParams()
|
|
const router = useRouter()
|
|
const page = router.pathname.split('/')[4]
|
|
|
|
const menuItems = [
|
|
{
|
|
title: 'Manage',
|
|
items: [
|
|
{
|
|
name: 'Functions',
|
|
key: 'main',
|
|
pages: ['', '[functionSlug]', 'new'],
|
|
url: `/project/${projectRef}/functions`,
|
|
items: [],
|
|
},
|
|
{
|
|
name: 'Secrets',
|
|
key: 'secrets',
|
|
url: `/project/${projectRef}/functions/secrets`,
|
|
items: [],
|
|
},
|
|
],
|
|
},
|
|
]
|
|
|
|
return <ProductMenu page={page} menu={menuItems} />
|
|
}
|
|
|
|
interface EdgeFunctionsLayoutProps {
|
|
title: string
|
|
browserTitle?: ComponentProps<typeof ProjectLayout>['browserTitle']
|
|
}
|
|
|
|
const EdgeFunctionsLayout = ({
|
|
children,
|
|
title,
|
|
browserTitle,
|
|
}: PropsWithChildren<EdgeFunctionsLayoutProps>) => {
|
|
return (
|
|
<ProjectLayout
|
|
title={title}
|
|
product="Edge Functions"
|
|
browserTitle={browserTitle}
|
|
productMenu={<EdgeFunctionsProductMenu />}
|
|
isBlocking={false}
|
|
>
|
|
{children}
|
|
</ProjectLayout>
|
|
)
|
|
}
|
|
|
|
export default withAuth(EdgeFunctionsLayout)
|