Skip to content

: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.

798 B
Raw Blame
import { IconCopy } from '@posthog/icons'

import { Spinner } from 'lib/lemon-ui/Spinner'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'

import { SceneDataAttrKeyProps } from './utils'

interface SceneDuplicateProps extends SceneDataAttrKeyProps {
    onClick: () => void
    loading?: boolean
}

export function SceneDuplicate({ dataAttrKey, onClick, loading }: SceneDuplicateProps): JSX.Element {
    return (
        <ButtonPrimitive
            menuItem
            onClick={onClick}
            disabled={loading}
            data-attr={`${dataAttrKey}-duplicate-button`}
            tooltip={loading ? 'Duplicating…' : 'Duplicate resource'}
        >
            {loading ? <Spinner textColored /> : <IconCopy />}
            Duplicate
        </ButtonPrimitive>
    )
}