: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 { IconSparkles } from '@posthog/icons'
import { LemonButton, Spinner } from '@posthog/lemon-ui'
import { contentAutopilotPromptSuggestionsLogic } from './contentAutopilotPromptSuggestionsLogic'
export const ContentAutopilotPromptSuggestButton = ({
type = 'secondary',
size,
}: {
type?: 'primary' | 'secondary'
size?: 'small'
}): JSX.Element => {
const { job } = useValues(contentAutopilotPromptSuggestionsLogic)
const { openSuggest } = useActions(contentAutopilotPromptSuggestionsLogic)
return (
<LemonButton
type={type}
size={size}
icon={job?.status === 'pending' ? <Spinner /> : <IconSparkles />}
onClick={openSuggest}
data-attr="content-autopilot-prompts-suggest"
>
{job?.status === 'pending'
? 'Suggesting prompts'
: job?.status === 'completed' && job.suggestions.length > 0
? `Review suggestions (${job.suggestions.length})`
: 'Suggest prompts'}
</LemonButton>
)
}