: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 { useActions, useValues } from 'kea'
import { IconImage } from '@posthog/icons'
import { ButtonPrimitive, DisabledReasonsObject } from 'lib/ui/Button/ButtonPrimitives'
import { CaptureImageTarget, captureImageLogic } from './captureImageLogic'
interface SceneCopyImageButtonProps {
target: CaptureImageTarget
dataAttrKey: string
disabledReasons?: DisabledReasonsObject
}
export function SceneCopyImageButton({ target, dataAttrKey, disabledReasons }: SceneCopyImageButtonProps): JSX.Element {
const { copyImage } = useActions(captureImageLogic)
const { isCapturing } = useValues(captureImageLogic)
return (
<ButtonPrimitive
menuItem
onClick={() => copyImage(target)}
data-attr={`${dataAttrKey}-copy-image`}
tooltip="Copy the chart to your clipboard as a PNG"
disabledReasons={{ ...disabledReasons, 'Copying…': isCapturing }}
>
<IconImage />
Copy as PNG
</ButtonPrimitive>
)
}