Files
supabase/apps/studio/components/interfaces/APIKeys/LegacyAPIKeysRetirementNotice.tsx
T
Drew McLellan f8cd1ee63e feat(studio): track docs button clicks (#54119)
## 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.
2026-11-26 16:28:37 +00:00

39 lines
1.2 KiB
TypeScript

import { useParams } from 'common'
import Link from 'next/link'
import { Button } from 'ui'
import { Admonition } from 'ui-patterns/Admonition'
import { DocsButton } from '@/components/ui/DocsButton'
import { useHighAvailability } from '@/hooks/misc/useHighAvailability'
import { DOCS_URL } from '@/lib/constants'
export const LegacyAPIKeysRetirementNotice = () => {
const { ref: projectRef } = useParams()
const { isHighAvailability } = useHighAvailability()
if (isHighAvailability) return null
return (
<Admonition
type="default"
layout="responsive"
title="Legacy API keys will be retired in early 2027"
description="Migrate to publishable and secret API keys to avoid disruption."
actions={
<>
<Button asChild variant="default">
<Link href={`/project/${projectRef}/settings/api-keys/legacy`}>
View legacy API keys
</Link>
</Button>
<DocsButton
href={`${DOCS_URL}/guides/getting-started/migrating-to-new-api-keys`}
label="Migration guide"
topic="Migrating to new API keys"
/>
</>
}
/>
)
}