: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(quill): add interactive features to MetricCard component (#72667)
Daniel Marchukc73c944269ca
diff --git a/packages/quill/packages/components/AGENTS.md b/packages/quill/packages/components/AGENTS.mdindex 02283b379707..f809b36baa83 100644--- a/packages/quill/packages/components/AGENTS.md+++ b/packages/quill/packages/components/AGENTS.md@@ -137,6 +137,9 @@ Rules:- The root owns the data/hover behavior and feeds the parts via context — a part used outside `<Metric>` throws. Pass `value` for a number-only tile; pass `data`+`labels`+`theme` for a sparkline.- `MetricDelta` renders a `Badge`; `goodDirection` (default `up`) decides success vs destructive. It carries its own `TooltipProvider`, so `changeTooltip` needs no app-root setup. resize via `className` (the metric insight passes its own larger-pill classes and puts it inline next to the headline via `MetricHeader`; there is no `changeInline` or size prop, compose and style at the call site).- Reproduces `MetricCard`'s behavior (`restingSubtitle`, `hoverChangeFromPreviousPoint`, `changeTooltip`, `positiveColor`/`negativeColor` for user-configured pill colors); omit the color props to keep the semantic `Badge` variants.+- `series` draws a multi-series sparkline (one line per series, the charts' `Series[]` shape) instead of the single `data` line. It's purely visual — the headline, hover and change pill still read `data`, so pass the numbers the tile should read (e.g. the per-index totals) as `data` alongside it; the types reject `series` without `data`. The single-line conveniences (`color`, `sparklineDashedFromIndex`) don't apply — set them per series.+- `sparklineTooltip` is a render prop passed straight to the sparkline (off by default, since hover already scrubs the headline) — supply `(ctx) => <DefaultTooltip {...ctx} />` to also show a hover tooltip, e.g. the per-series breakdown behind a multi-series total.+- Things `Metric` deliberately doesn't have props for — compose them yourself around it: a clickable tile (put the handler on the wrapping `Card`), a footer (a sibling node after `MetricSparkline`), an info icon next to the title (a `Tooltip` inside `MetricTitle`), and a loading state (render `Skeleton`s instead of the `Metric`).## Maintenancediff --git a/packages/quill/packages/components/src/metric.stories.tsx b/packages/quill/packages/components/src/metric.stories.tsxindex 97db082fad19..98babc420c88 100644--- a/packages/quill/packages/components/src/metric.stories.tsx+++ b/packages/quill/packages/components/src/metric.stories.tsx@@ -1,7 +1,7 @@import type { Meta, StoryObj } from '@storybook/react'import * as React from 'react'-import { useChartTheme } from '@posthog/quill-charts'+import { DefaultTooltip, useChartTheme } from '@posthog/quill-charts'import { Card, TooltipProvider } from '@posthog/quill-primitives'import { Metric, MetricDelta, MetricHeader, MetricSparkline, MetricSubtitle, MetricTitle, MetricValue } from './metric'@@ -223,6 +223,41 @@ export const HoverChangeFromPrevious: Story = {},}+// `series` draws one line per channel while the headline, hover and pill keep reading `data` — here+// the per-index totals — so the tile still reads as one number. `sparklineTooltip` surfaces the+// breakdown behind that total.+export const MultiSeries: Story = {+ render: () => {+ const theme = useChartTheme()+ const series = [+ { key: 'email', label: 'Email', data: [420, 510, 470, 540, 600, 580, 640, 690, 720, 770, 810, 880] },+ { key: 'push', label: 'Push', data: [180, 210, 240, 230, 260, 300, 320, 360, 400, 420, 460, 510] },+ ]+ const totals = series[0].data.map((v, i) => v + series[1].data[i])+ return (+ <Card flush className="h-[320px] w-[360px]">+ <Metric+ data={totals}+ series={series}+ labels={MONTHS}+ theme={theme}+ sparklineFill+ sparklineTooltip={(ctx) => <DefaultTooltip {...ctx} showTotal sortedByValue />}+ formatValue={(v) => Math.round(v).toLocaleString()}+ >+ <MetricHeader>+ <MetricTitle>Messages sent</MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ <MetricSubtitle className="mt-1" />+ <MetricSparkline />+ </Metric>+ </Card>+ )+ },+}+// A dashboard stat grid — each tile a `<Card flush>` wrapping a `Metric` with its own bottom-anchored// sparkline. The pill falls back to each series' own trend; `goodDirection="down"` flips churn's color.export const Grid: Story = {diff --git a/packages/quill/packages/components/src/metric.tsx b/packages/quill/packages/components/src/metric.tsxindex 369cb1a7e38e..ae41c3d13949 100644--- a/packages/quill/packages/components/src/metric.tsx+++ b/packages/quill/packages/components/src/metric.tsx@@ -9,7 +9,9 @@ import {percentage,type ResolvedDelta,resolveDelta,+ type Series,Sparkline,+ type TooltipContext,useAnimatedNumber,useHoverIntent,} from '@posthog/quill-charts'@@ -36,7 +38,9 @@ interface MetricContextValue {} | null/** Sparkline wiring, or null when no series was supplied. */sparkline: {+ /** The `data` prop — what hovering scrubs through. The chart draws `series` instead when set. */data: number[]+ series?: Series[]labels?: string[]theme: ChartThemecolor?: string@@ -45,6 +49,7 @@ interface MetricContextValue {fillOpacity: numberdashedFromIndex?: numbersetHoverIndex: (index: number) => void+ tooltip?: (ctx: TooltipContext) => React.ReactNode} | null}@@ -65,12 +70,10 @@ const DEFAULT_FORMAT_CHANGE = (p: number): string => {return p > 0 ? `+${formatted}` : formatted}-export interface MetricProps {+interface MetricBaseProps {/** Resting headline number. Defaults to `data[data.length - 1]` when `data` is present;* required when `data` is empty or omitted. */value?: number- /** Series values. When present, a `MetricSparkline` renders and hovering a point swaps the headline. */- data?: number[]/** Labels paired with `data`. Used for the default subtitle on hover. */labels?: string[]/** Required when `data` is present. */@@ -83,6 +86,8 @@ export interface MetricProps {sparklineFillOpacity?: number/** Dash the sparkline from this index onward (e.g. an in-progress trailing period). */sparklineDashedFromIndex?: number+ /** Tooltip renderer for the sparkline. Off by default — hovering already scrubs the headline. */+ sparklineTooltip?: (ctx: TooltipContext) => React.ReactNodeformatValue?: (value: number) => stringformatChange?: (percent: number) => stringshowChange?: boolean@@ -112,6 +117,25 @@ export interface MetricProps {children: React.ReactNode}+export type MetricProps = MetricBaseProps &+ (+ | {+ /** The metric's values. When present, a `MetricSparkline` renders and hovering a point+ * swaps the headline. The change pill's fallback also runs on it. */+ data?: number[]+ series?: undefined+ }+ | {+ /** The metric's values — headline hover, change-pill fallback, and hover indexes. */+ data: number[]+ /** Visual breakdown drawn as one sparkline line per series instead of the single `data`+ * line. Purely presentational: the headline and pill still read `data`, so give each+ * series the same point count as `data` to keep hover indexes aligned. The single-line+ * conveniences (`color`, `sparklineDashedFromIndex`) don't apply — set them per series. */+ series?: Series[]+ }+ )+/*** Composable metric tile — a headline number, a `Badge` change pill, and an optional `Sparkline`.* `Metric` is content, not a surface: wrap it in `<Card flush>` for the border. The root owns the data@@ -144,6 +168,7 @@ export function Metric(props: MetricProps): React.ReactElement | null {function MetricInner({value,data,+ series,labels,theme,color,@@ -151,6 +176,7 @@ function MetricInner({sparklineFill = false,sparklineFillOpacity = 0.35,sparklineDashedFromIndex,+ sparklineTooltip,formatValue = DEFAULT_FORMAT_VALUE,formatChange = DEFAULT_FORMAT_CHANGE,showChange = true,@@ -167,7 +193,7 @@ function MetricInner({className,dataAttr,children,-}: Omit<MetricProps, 'onError'>): React.ReactElement | null {+}: Omit<MetricBaseProps, 'onError'> & { data?: number[]; series?: Series[] }): React.ReactElement | null {const sparklineData = data != null && data.length > 0 && theme != null ? data : nullconst lastIndex = sparklineData ? sparklineData.length - 1 : -1@@ -228,6 +254,7 @@ function MetricInner({sparkline: sparklineData? {data: sparklineData,+ series,labels,theme: theme!,color,@@ -236,6 +263,7 @@ function MetricInner({fillOpacity: sparklineFillOpacity,dashedFromIndex: sparklineDashedFromIndex,setHoverIndex,+ tooltip: sparklineTooltip,}: null,}@@ -260,10 +288,12 @@ function MetricInner({labels,theme,color,+ series,sparklineHeight,sparklineFill,sparklineFillOpacity,sparklineDashedFromIndex,+ sparklineTooltip,])if (ctx == null) {@@ -376,7 +406,8 @@ export function MetricSparkline({const pinBottom = sparkline.fill ? '' : 'mt-auto'return (<Sparkline- data={sparkline.data}+ data={sparkline.series != null ? undefined : sparkline.data}+ series={sparkline.series}labels={sparkline.labels}theme={sparkline.theme}color={sparkline.color}@@ -385,6 +416,7 @@ export function MetricSparkline({fillOpacity={sparkline.fillOpacity}dashedFromIndex={sparkline.dashedFromIndex}onHoverIndexChange={sparkline.setHoverIndex}+ tooltip={sparkline.tooltip}className={cn('relative top-[6px]', pinBottom, className)}dataAttr="metric-sparkline"/>diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 085209561ebd..95cd2af9953d 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -4397,6 +4397,15 @@ importers:'@posthog/icons':specifier: 'catalog:'+ '@posthog/quill-charts':+ specifier: workspace:*+ version: link:../../packages/quill/packages/charts+ '@posthog/quill-components':+ specifier: workspace:*+ version: link:../../packages/quill/packages/components+ '@posthog/quill-primitives':+ specifier: workspace:*+ version: link:../../packages/quill/packages/primitives'@types/react':specifier: 18.3.27version: 18.3.27diff --git a/products/workflows/frontend/Workflows/EmailMetricsSummary.tsx b/products/workflows/frontend/Workflows/EmailMetricsSummary.tsxindex 12ffff3d2497..a8a9ed3ea6a5 100644--- a/products/workflows/frontend/Workflows/EmailMetricsSummary.tsx+++ b/products/workflows/frontend/Workflows/EmailMetricsSummary.tsx@@ -4,8 +4,8 @@ import { useMemo } from 'react'import { getColorVar } from 'lib/colors'import { appMetricsLogic } from 'lib/components/AppMetrics/appMetricsLogic'import { AppMetricsTrends } from 'lib/components/AppMetrics/AppMetricsTrends'-import { AppMetricSummary } from 'lib/components/AppMetrics/AppMetricSummary'+import { WorkflowMetricCard } from './WorkflowMetricCard'import {EMAIL_METRIC_INVOCATION_FILTERS,EmailMetric,@@ -49,7 +49,7 @@ export function EmailMetricsSummary({const metric = WORKFLOW_EMAIL_METRICS[key]const canDrillDown = !!onMetricClick && !!EMAIL_METRIC_INVOCATION_FILTERS[key]return (- <AppMetricSummary+ <WorkflowMetricCardkey={key}name={metric.name}description={metric.description}diff --git a/products/workflows/frontend/Workflows/PushMetricsSummary.tsx b/products/workflows/frontend/Workflows/PushMetricsSummary.tsxindex 8dbf5714e94b..ae39e7c15575 100644--- a/products/workflows/frontend/Workflows/PushMetricsSummary.tsx+++ b/products/workflows/frontend/Workflows/PushMetricsSummary.tsx@@ -4,8 +4,8 @@ import { useMemo } from 'react'import { getColorVar } from 'lib/colors'import { appMetricsLogic } from 'lib/components/AppMetrics/appMetricsLogic'import { AppMetricsTrends } from 'lib/components/AppMetrics/AppMetricsTrends'-import { AppMetricSummary } from 'lib/components/AppMetrics/AppMetricSummary'+import { WorkflowMetricCard } from './WorkflowMetricCard'import { METRIC_COLORS, WORKFLOW_PUSH_METRICS } from './workflowMetricsSummaryLogic'const PUSH_METRIC_KEYS = Object.keys(WORKFLOW_PUSH_METRICS) as (keyof typeof WORKFLOW_PUSH_METRICS)[]@@ -37,7 +37,7 @@ export function PushMetricsSummary({ logicKey }: { logicKey: string }): JSX.Elem{PUSH_METRIC_KEYS.map((key) => {const metric = WORKFLOW_PUSH_METRICS[key]return (- <AppMetricSummary+ <WorkflowMetricCardkey={key}name={metric.name}description={metric.description}diff --git a/products/workflows/frontend/Workflows/WorkflowMetricCard.tsx b/products/workflows/frontend/Workflows/WorkflowMetricCard.tsxnew file mode 100644index 000000000000..6cc8444f8341--- /dev/null+++ b/products/workflows/frontend/Workflows/WorkflowMetricCard.tsx@@ -0,0 +1,239 @@+import posthog from 'posthog-js'+import { type ErrorInfo, type ReactNode, useCallback, useMemo } from 'react'++import { IconArrowRight, IconInfo } from '@posthog/icons'+import {+ DefaultTooltip,+ useChartTheme,+ type ChangeColor,+ type MetricChange,+ type Series,+ type TooltipContext,+} from '@posthog/quill-charts'+import {+ Metric,+ MetricDelta,+ MetricHeader,+ MetricSparkline,+ MetricTitle,+ MetricValue,+} from '@posthog/quill-components/metric'+import { cn, Skeleton, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@posthog/quill-primitives'++import { getColorVar } from 'lib/colors'+import { AppMetricsTimeSeriesResponse } from 'lib/components/AppMetrics/appMetricsLogic'+import { dayjs } from 'lib/dayjs'+import { formatPercentageDiff, humanFriendlyNumber } from 'lib/utils/numbers'++const SPARKLINE_HEIGHT = 160++// `Metric` is content, not a surface, so the tile keeps the surrounding scene's chrome rather than+// quill's Card — the step tables and trends chart below it are still Lemon surfaces.+const CARD_CHROME = 'flex min-w-[16rem] flex-1 flex-col rounded border bg-surface-primary py-3'++// The period-over-period pill stays neutral (grey), matching how these tiles reported change before —+// several workflow metrics (Failed, Bounced, Rate Limited) are "bad when rising", so green/red good/bad+// coloring would mislead. The chevron still shows direction.+function neutralChange(): ChangeColor {+ return { background: 'transparent', foreground: getColorVar('muted') }+}++// `Metric` contains a render throw to this tile instead of letting it take the scene down, which also+// keeps it out of error tracking — report it so a silently broken tile is still visible.+function captureRenderError(error: Error, info: ErrorInfo): void {+ posthog.captureException(error, {+ feature: 'workflow-metric-card',+ componentStack: info.componentStack ?? undefined,+ })+}++function DrillArrow({ tooltip }: { tooltip?: string }): JSX.Element {+ const arrow = <IconArrowRight className="ml-1 inline-block align-text-bottom text-xl text-muted" aria-hidden />+ if (!tooltip) {+ return arrow+ }+ return (+ <Tooltip>+ <TooltipTrigger render={<span className="inline-flex" />}>{arrow}</TooltipTrigger>+ <TooltipContent>{tooltip}</TooltipContent>+ </Tooltip>+ )+}++export interface WorkflowMetricCardProps {+ name: string+ /** Shown as an info tooltip on the title. */+ description?: ReactNode+ timeSeries: AppMetricsTimeSeriesResponse | null+ previousPeriodTimeSeries?: AppMetricsTimeSeriesResponse | null+ color?: string+ /** Per-series sparkline colors keyed by series name. When the response has more than one series,+ * the tile draws one line per series (colored from here) instead of a single summed line. */+ seriesColors?: Record<string, string>+ /** Sparkline color used when the tile total is zero (e.g. a muted grey). */+ colorIfZero?: string+ loading?: boolean+ onClick?: () => void+ onClickTooltip?: string+ footer?: ReactNode+}++// Collapse a response into the numbers the tile reads (per-index sums plus the grand total). A+// single-metric tile has one series; the combined "messages" tile sums its email + push channels.+function sumSeries(ts: AppMetricsTimeSeriesResponse | null | undefined): { data: number[]; total: number } {+ if (!ts || ts.series.length === 0) {+ return { data: [], total: 0 }+ }+ const data = ts.labels.map((_, i) => ts.series.reduce((acc, series) => acc + (series.values[i] ?? 0), 0))+ return { data, total: data.reduce((acc, v) => acc + v, 0) }+}++/**+ * A summary tile built by composing quill's `Metric`, adapting our app-metrics series shape. The click+ * target, footer, title info icon and loading state are composition-level concerns, so they live here+ * rather than as `Metric` props.+ */+export function WorkflowMetricCard({+ name,+ description,+ timeSeries,+ previousPeriodTimeSeries,+ color,+ seriesColors,+ colorIfZero,+ loading,+ onClick,+ onClickTooltip,+ footer,+}: WorkflowMetricCardProps): JSX.Element {+ const theme = useChartTheme()++ const { data, total } = useMemo(() => sumSeries(timeSeries), [timeSeries])+ const totalPreviousPeriod = useMemo(() => sumSeries(previousPeriodTimeSeries).total, [previousPeriodTimeSeries])++ // A response with more than one series (e.g. the combined email + push "messages" tile) draws one+ // line per channel, colored from seriesColors; a single-series tile keeps the one summed line.+ const sparklineSeries = useMemo<Series[] | undefined>(() => {+ if (!timeSeries || timeSeries.series.length <= 1) {+ return undefined+ }+ return timeSeries.series.map((s) => ({+ key: s.name,+ label: s.name,+ data: s.values,+ // The zero-state color has to be set per series — the sparkline ignores the tile-level+ // `color` whenever `series` is set, so an empty combined tile would keep its channel colors.+ color: total === 0 ? colorIfZero : seriesColors?.[s.name],+ }))+ }, [timeSeries, seriesColors, colorIfZero, total])++ // Only surface a comparison when there's a non-zero baseline — formatPercentageDiff returns null on+ // a zero/absent previous period, so the pill is hidden rather than showing a bogus ∞%.+ const change = useMemo<MetricChange | null>(() => {+ const label = formatPercentageDiff(total, totalPreviousPeriod)+ return label == null ? null : { value: total - totalPreviousPeriod, label }+ }, [total, totalPreviousPeriod])++ const neutral = neutralChange()++ // Labels arrive pre-formatted in the team timezone ('YYYY-MM-DD', or '… HH:mm' for sub-day+ // intervals), so parse them as naive local strings for the tooltip header.+ const renderTooltip = useCallback(+ (ctx: TooltipContext) => (+ <DefaultTooltip+ {...ctx}+ sortedByValue+ showTotal+ labelFormatter={(label: string) =>+ dayjs(label).format(label.includes(' ') ? 'MMM D, HH:mm' : 'MMM D, YYYY')+ }+ valueFormatter={(value: number) => humanFriendlyNumber(value)}+ />+ ),+ []+ )++ const cardClassName = cn(+ CARD_CHROME,+ onClick &&+ 'cursor-pointer transition-colors hover:bg-surface-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent'+ )++ if (loading) {+ return (+ <div className={CARD_CHROME}>+ <div className="flex flex-col px-3">+ <Skeleton className="h-4 w-24" />+ <Skeleton className="mt-3 h-9 w-32" />+ <Skeleton className="mt-4 h-40 w-full" />+ </div>+ </div>+ )+ }++ return (+ <TooltipProvider>+ <div+ className={cardClassName}+ onClick={onClick}+ role={onClick ? 'button' : undefined}+ tabIndex={onClick ? 0 : undefined}+ // Only the card itself activates the drill — a link or icon inside it keeps its own keys.+ onKeyDown={(e) => {+ if (onClick && e.target === e.currentTarget && (e.key === 'Enter' || e.key === ' ')) {+ e.preventDefault()+ onClick()+ }+ }}+ >+ <Metric+ className="px-3"+ onError={captureRenderError}+ value={total}+ data={data}+ series={sparklineSeries}+ labels={timeSeries?.labels}+ theme={theme}+ color={total === 0 ? colorIfZero : color}+ change={change}+ positiveColor={neutral}+ negativeColor={neutral}+ formatValue={(v) => humanFriendlyNumber(v)}+ sparklineHeight={SPARKLINE_HEIGHT}+ sparklineTooltip={renderTooltip}+ >+ <MetricHeader>+ <MetricTitle className="min-w-0">+ {name}+ {description != null && (+ <Tooltip>+ <TooltipTrigger+ render={+ <span+ className="ml-1 inline-flex align-text-bottom text-xl text-muted"+ onClick={(e) => e.stopPropagation()}+ />+ }+ >+ <IconInfo />+ </TooltipTrigger>+ <TooltipContent>{description}</TooltipContent>+ </Tooltip>+ )}+ {onClick && <DrillArrow tooltip={onClickTooltip} />}+ </MetricTitle>+ <MetricDelta />+ </MetricHeader>+ <MetricValue className="mt-2" />+ <MetricSparkline className="-mx-3 mt-4" />+ </Metric>+ {footer && (+ // Stop clicks here from firing the tile's drill — the footer carries its own link.+ <div className="px-3 pt-2 text-center text-xs" onClick={(e) => e.stopPropagation()}>+ {footer}+ </div>+ )}+ </div>+ </TooltipProvider>+ )+}diff --git a/products/workflows/frontend/Workflows/WorkflowMetrics.tsx b/products/workflows/frontend/Workflows/WorkflowMetrics.tsxindex 4adc83ef4423..89b6cae41cd6 100644--- a/products/workflows/frontend/Workflows/WorkflowMetrics.tsx+++ b/products/workflows/frontend/Workflows/WorkflowMetrics.tsx@@ -11,7 +11,6 @@ import { getColorVar } from 'lib/colors'import { AppMetricsFilters } from 'lib/components/AppMetrics/AppMetricsFilters'import { appMetricsLogic } from 'lib/components/AppMetrics/appMetricsLogic'import { AppMetricsTrends } from 'lib/components/AppMetrics/AppMetricsTrends'-import { AppMetricSummary } from 'lib/components/AppMetrics/AppMetricSummary'import { TZLabel } from 'lib/components/TZLabel'import { dayjs } from 'lib/dayjs'import { urls } from 'scenes/urls'@@ -22,6 +21,7 @@ import { getHogFlowStep } from './hogflows/steps/HogFlowSteps'import { HogFlowBatchJob } from './hogflows/types'import { PushMetricsSummary } from './PushMetricsSummary'import { WorkflowLogicProps, workflowLogic } from './workflowLogic'+import { WorkflowMetricCard } from './WorkflowMetricCard'import { WorkflowMetricsSummary } from './WorkflowMetricsSummary'import { type EmailMetric, METRIC_COLORS, buildEmailMetricInvocationSearchParams } from './workflowMetricsSummaryLogic'@@ -191,7 +191,7 @@ function WorkflowRunMetrics(props: WorkflowLogicProps): JSX.Element {<><div className="flex flex-row gap-2 flex-wrap justify-center">{['succeeded', 'failed'].map((key) => (- <AppMetricSummary+ <WorkflowMetricCardkey={key}name={WORKFLOW_METRICS_INFO[key].name}description={WORKFLOW_METRICS_INFO[key].description}@@ -343,7 +343,7 @@ function BatchJobMetrics({ job }: { job: HogFlowBatchJob }): JSX.Element {<><div className="flex flex-row gap-2 flex-wrap justify-center">{['succeeded', 'failed'].map((key) => (- <AppMetricSummary+ <WorkflowMetricCardkey={key}name={WORKFLOW_METRICS_INFO[key].name}description={WORKFLOW_METRICS_INFO[key].description}diff --git a/products/workflows/frontend/Workflows/WorkflowMetricsSummary.tsx b/products/workflows/frontend/Workflows/WorkflowMetricsSummary.tsxindex ec14695ffeb7..3229964127a0 100644--- a/products/workflows/frontend/Workflows/WorkflowMetricsSummary.tsx+++ b/products/workflows/frontend/Workflows/WorkflowMetricsSummary.tsx@@ -7,9 +7,9 @@ import { LemonLabel, LemonTable, LemonTableColumns, LemonTag, Link, SpinnerOverlimport { getColorVar } from 'lib/colors'import { type AppMetricsTimeSeriesResponse } from 'lib/components/AppMetrics/appMetricsLogic'import { AppMetricsTrends } from 'lib/components/AppMetrics/AppMetricsTrends'-import { AppMetricSummary } from 'lib/components/AppMetrics/AppMetricSummary'import { humanFriendlyNumber } from 'lib/utils/numbers'+import { WorkflowMetricCard } from './WorkflowMetricCard'import {type EmailMetric,type EmailMetricRow,@@ -204,9 +204,7 @@ export function WorkflowMetricsSummary({) : inProgressTotal === 0 ? (<LemonLabel className="text-muted text-md mb-2">No workflows in progress</LemonLabel>) : (- <div className="text-6xl text-muted-foreground mb-2">- {humanFriendlyNumber(inProgressTotal)}- </div>+ <div className="text-6xl mb-2">{humanFriendlyNumber(inProgressTotal)}</div>)}</div></div>@@ -232,7 +230,7 @@ export function WorkflowMetricsSummary({const sentSeries = (previous?: boolean): AppMetricsTimeSeriesResponse | null => {if (hasEmail && hasPush) {// Split the combined "Messages sent" tile into Emails + Push lines. The headline- // number stays their sum (AppMetricSummary totals across series); the sparkline+ // number stays their sum (the metric card totals across series); the sparkline// and its tooltip break the total down by channel.const emailSeries = getSingleTrendSeries('email_sent', previous)const pushSeries = getSingleTrendSeries('push_sent', previous)@@ -264,7 +262,7 @@ export function WorkflowMetricsSummary({: withDisplayName(getSingleTrendSeries(metricName, true), name)return (- <AppMetricSummary+ <WorkflowMetricCardkey={summaryMetric}name={name}description={description}@@ -296,7 +294,7 @@ export function WorkflowMetricsSummary({) : conversionStats.started === 0 ? (<LemonLabel className="text-muted text-md mb-2">No workflows started</LemonLabel>) : (- <div className="text-6xl text-muted-foreground mb-2">+ <div className="text-6xl mb-2">{`${(Math.min(conversionRate, 1) * 100).toFixed(1)}%`}</div>)}diff --git a/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts b/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.tsindex 1d84e824e877..508a07ff46a7 100644--- a/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts+++ b/products/workflows/frontend/Workflows/workflowMetricsSummaryLogic.ts@@ -81,8 +81,8 @@ export type EmailMetricRow = {// Single source of truth for metric colors across the workflow metric views. Keyed by the metric's// display name so the same label reads the same color everywhere — in the summary tiles and in the-// trends chart below them. Pass this to `AppMetricsTrends` as `seriesColors` and to `AppMetricSummary`-// so tiles and charts never drift apart.+// trends chart below them. The trends charts take this as `AppMetricsTrends` `seriesColors`; each+// summary tile (`WorkflowMetricCard`) reads a single color for its metric by name, so they never drift.//// Only `success`/`blue`/`purple`/`warning`/`danger` exist as themed color vars; the rest (`orange`,// `indigo`, `red`, `primary`) resolve to white in dark mode. The whole-workflow summary mostly usesdiff --git a/products/workflows/package.json b/products/workflows/package.jsonindex 08ca5be4710f..810a32fe4937 100644--- a/products/workflows/package.json+++ b/products/workflows/package.json@@ -4,6 +4,9 @@"backend:test": "pytest -c ../../pytest.ini --rootdir ../.. backend/ -v --tb=short"},"dependencies": {+ "@posthog/quill-charts": "workspace:*",+ "@posthog/quill-components": "workspace:*",+ "@posthog/quill-primitives": "workspace:*","kea": "catalog:","kea-forms": "catalog:","kea-loaders": "catalog:",