mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Problem We don't track clicks on the shared `DocsButton`, so we can't tell which pages send people to the docs most or where the UI needs more explanation. Closes FE-5020. ## Solution Add a `docs_button_clicked` event, fired once per click from the click handler in the shared `DocsButton`. One call covers every page that renders it. - Properties: optional `topic` (a fixed label passed by the caller, omitted when unset). `pathname` is already attached to every event by `useTrack`. - Groups are `Partial<TelemetryGroups>` because the button renders on project, organization, and account pages. - Click still stops propagation, as before. ## Review instructions 1. Run `pnpm dev:studio` and open a page with a docs button (e.g. a project's Auth or Database page). 2. Click it and check the `docs_button_clicked` event is sent once, with `topic` when the button has one. 3. Run `pnpm --filter studio exec vitest run components/ui/DocsButton.test.tsx`. Still to do after merge: verify the event in PostHog on staging.
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { PropsWithChildren } from 'react'
|
|
import { PageContainer } from 'ui-patterns/PageContainer'
|
|
import {
|
|
PageHeader,
|
|
PageHeaderAside,
|
|
PageHeaderDescription,
|
|
PageHeaderMeta,
|
|
PageHeaderSummary,
|
|
PageHeaderTitle,
|
|
} from 'ui-patterns/PageHeader'
|
|
|
|
import { DocsButton } from '@/components/ui/DocsButton'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
const ApiKeysLayout = ({ children }: PropsWithChildren) => {
|
|
return (
|
|
<>
|
|
<PageHeader>
|
|
<PageHeaderMeta>
|
|
<PageHeaderSummary>
|
|
<PageHeaderTitle>API Keys</PageHeaderTitle>
|
|
<PageHeaderDescription>
|
|
Configure API keys to securely control access to your project
|
|
</PageHeaderDescription>
|
|
</PageHeaderSummary>
|
|
<PageHeaderAside>
|
|
<DocsButton href={`${DOCS_URL}/guides/api/api-keys`} />
|
|
</PageHeaderAside>
|
|
</PageHeaderMeta>
|
|
</PageHeader>
|
|
<PageContainer className="flex flex-col py-8 pb-16 gap-8">{children}</PageContainer>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default ApiKeysLayout
|