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.

868 B
Raw Blame
import { useActions, useValues } from 'kea'

import { LemonSwitch } from '@posthog/lemon-ui'

import { contentAutopilotPromptsLogic } from './contentAutopilotPromptsLogic'

export const ContentAutopilotPromptActiveSwitch = ({
    promptId,
    active,
    label,
}: {
    promptId: string
    active: boolean
    label?: string
}): JSX.Element => {
    const { promptActiveUpdating } = useValues(contentAutopilotPromptsLogic)
    const { setPromptActive } = useActions(contentAutopilotPromptsLogic)

    return (
        <LemonSwitch
            checked={active}
            onChange={(checked) => setPromptActive(promptId, checked)}
            loading={!!promptActiveUpdating[promptId]}
            label={label}
            aria-label={active ? 'Turn prompt off' : 'Turn prompt on'}
            data-attr="content-autopilot-prompt-active-toggle"
        />
    )
}