Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: visual tweaks and telemetry added to projectConfigVariables (#47532)

Jeremias Menichellif5c0074a476d
diff --git a/apps/docs/components/ProjectConfigVariables/ProjectConfigVariables.tsx b/apps/docs/components/ProjectConfigVariables/ProjectConfigVariables.tsx
index 5d1b080bde7..82f81048105 100644
--- a/apps/docs/components/ProjectConfigVariables/ProjectConfigVariables.tsx
+++ b/apps/docs/components/ProjectConfigVariables/ProjectConfigVariables.tsx
@@ -29,6 +29,7 @@ import {
useProjectsInfiniteQuery,
} from '~/lib/fetch/projects-infinite'
import { retrieve, storeOrRemoveNull } from '~/lib/storage'
+import { useSendTelemetryEvent } from '~/lib/telemetry'
import { useOnLogout } from '~/lib/userAuth'
import { LOCAL_STORAGE_KEYS, useIsLoggedIn, useIsUserLoading } from 'common'
import { Check, Copy } from 'lucide-react'
@@ -389,12 +390,13 @@ function VariableView({ variable, className }: { variable: Variable; className?:
}
const { copied, handleCopy } = useCopy()
+ const sendTelemetryEvent = useSendTelemetryEvent()
return (
<>
<div className={cn('flex items-center gap-2', className)}>
<Input
- disabled
+ readOnly
type="text"
className="font-mono"
value={
@@ -413,10 +415,16 @@ function VariableView({ variable, className }: { variable: Variable; className?:
disabled={!variableValue}
variant="ghost"
className="px-0"
- onClick={handleCopy}
+ onClick={() => {
+ handleCopy()
+ sendTelemetryEvent({
+ action: 'docs_project_config_variables_copy_button_clicked',
+ properties: { variable },
+ })
+ }}
aria-label="Copy"
>
- {copied ? <Check /> : <Copy />}
+ {copied ? <Check size="18" /> : <Copy size="18" />}
</Button>
</CopyToClipboard>
</div>
@@ -445,7 +453,7 @@ function LoginHint({ variable }: { variable: Variable }) {
if (isUserLoading || isLoggedIn) return null
return (
- <p className="text-foreground-muted text-sm mt-2 mb-0 ml-1">
+ <p className="not-prose text-foreground-muted text-sm mt-2 mb-0 ml-1">
To get your {prettyFormatVariable[variable]},{' '}
<Link
className="text-foreground-muted"
diff --git a/packages/common/telemetry-constants.ts b/packages/common/telemetry-constants.ts
index c6a49a379b5..5ecb01633e3 100644
--- a/packages/common/telemetry-constants.ts
+++ b/packages/common/telemetry-constants.ts
@@ -934,6 +934,19 @@ export interface Docs404RecommendationClickedEvent {
}
}
+/**
+ * User clicked the copy button on a project config variable in the docs.
+ *
+ * @group Events
+ * @source docs
+ */
+export interface DocsProjectConfigVariablesCopyButtonClickedEvent {
+ action: 'docs_project_config_variables_copy_button_clicked'
+ properties: {
+ variable: 'url' | 'publishable' | 'anon' | 'sessionPooler'
+ }
+}
+
/**
* User clicked the framework quickstart card on the homepage, leading to the specific framework documentation.
*
@@ -3585,6 +3598,7 @@ export type TelemetryEvent =
| AskAiClickedEvent
| DocsContentListingClickedEvent
| Docs404RecommendationClickedEvent
+ | DocsProjectConfigVariablesCopyButtonClickedEvent
| HomepageFrameworkQuickstartClickedEvent
| HomepageProductCardClickedEvent
| WwwPricingPlanCtaClickedEvent