:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(web-analytics): move precompute badge to bottom-right on metric cards (#62444)
Lucas Ricoy5d633e41accd
diff --git a/frontend/src/lib/components/PreAggregatedBadge/PreAggregatedBadge.tsx b/frontend/src/lib/components/PreAggregatedBadge/PreAggregatedBadge.tsxindex 0e428269a176..d2b0311b31cf 100644--- a/frontend/src/lib/components/PreAggregatedBadge/PreAggregatedBadge.tsx+++ b/frontend/src/lib/components/PreAggregatedBadge/PreAggregatedBadge.tsx@@ -1,11 +1,20 @@+import clsx from 'clsx'+import { IconBolt, IconDatabaseBolt } from '@posthog/icons'import { Tooltip } from 'lib/lemon-ui/Tooltip'export type PreAggregatedBadgeVariant = 'preagg' | 'precomputed'+export type PreAggregatedBadgePosition = 'top-right' | 'bottom-right'interface PreAggregatedBadgeProps {variant?: PreAggregatedBadgeVariant+ position?: PreAggregatedBadgePosition+}++const POSITION_CLASS: Record<PreAggregatedBadgePosition, string> = {+ 'top-right': 'top-2 right-2',+ 'bottom-right': 'bottom-2 right-2',}const VARIANT_CONFIG: Record<@@ -24,11 +33,14 @@ const VARIANT_CONFIG: Record<},}-export function PreAggregatedBadge({ variant = 'preagg' }: PreAggregatedBadgeProps = {}): JSX.Element {+export function PreAggregatedBadge({+ variant = 'preagg',+ position = 'top-right',+}: PreAggregatedBadgeProps = {}): JSX.Element {const { tooltip, iconClassName, Icon } = VARIANT_CONFIG[variant]return (<Tooltip title={tooltip}>- <div className="absolute top-2 right-2 z-10">+ <div className={clsx('absolute z-10', POSITION_CLASS[position])}><Icon className={iconClassName} /></div></Tooltip>diff --git a/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx b/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsxindex ce40364af8fc..c1bc959c3fcc 100644--- a/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx+++ b/frontend/src/queries/nodes/OverviewGrid/OverviewMetricCardGrid.tsx@@ -103,9 +103,9 @@ function MetricCardCell({aria-pressed={clickable ? !!item.selected : undefined}>{usedLazyPrecompute ? (- <PreAggregatedBadge variant="precomputed" />+ <PreAggregatedBadge variant="precomputed" position="bottom-right" />) : usedPreAggregatedTables ? (- <PreAggregatedBadge variant="preagg" />+ <PreAggregatedBadge variant="preagg" position="bottom-right" />) : null}<MetricCardtitle={<MetricCardTitle label={labelFromKey(item.key)} item={item} />}