: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
import './InsightLegend.scss'
import clsx from 'clsx'
import { useValues } from 'kea'
import { insightLogic } from 'scenes/insights/insightLogic'
import { trendsDataLogic } from 'products/product_analytics/frontend/insights/trends/trendsDataLogic'
import { InsightLegendRow } from './InsightLegendRow'
export interface InsightLegendProps {
readOnly?: boolean
horizontal?: boolean
inCardView?: boolean
}
export function InsightLegend({ horizontal, inCardView, readOnly = false }: InsightLegendProps): JSX.Element | null {
const { insightProps } = useValues(insightLogic)
const { indexedResults, hasLegend } = useValues(trendsDataLogic(insightProps))
return hasLegend ? (
<div
className={clsx('InsightLegendMenu', 'flex overflow-auto border rounded', {
'InsightLegendMenu--horizontal': horizontal,
'InsightLegendMenu--readonly': readOnly,
'InsightLegendMenu--in-card-view': inCardView,
})}
>
<div className="grid grid-cols-1">
{indexedResults &&
indexedResults.map((item) => <InsightLegendRow key={item.id} item={item} readOnly={readOnly} />)}
</div>
</div>
) : null
}