: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 { IconX } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
import { WizardStep, alertWizardLogic } from './alertWizardLogic'
import { AlertWizardStepper } from './AlertWizardStepper'
import { ConfigureStep } from './steps/ConfigureStep'
import { DestinationStep } from './steps/DestinationStep'
import { TriggerStep } from './steps/TriggerStep'
export interface AlertWizardProps {
onCancel: () => void
onSwitchToTraditional: () => void
hideTriggerStep?: boolean
hideCloseButton?: boolean
}
export function AlertWizard({
onCancel,
onSwitchToTraditional,
hideTriggerStep,
hideCloseButton,
}: AlertWizardProps): JSX.Element {
const { currentStep } = useValues(alertWizardLogic)
const { setStep } = useActions(alertWizardLogic)
return (
<div className="flex flex-col min-h-[400px]">
<div className="grid grid-cols-[1fr_auto_1fr] items-center">
<div />
<AlertWizardStepper currentStep={currentStep} onStepClick={setStep} hideTriggerStep={hideTriggerStep} />
{hideCloseButton ? (
<div />
) : (
<LemonButton
type="tertiary"
size="small"
icon={<IconX />}
onClick={onCancel}
aria-label="Close wizard"
className="justify-self-start ml-2"
/>
)}
</div>
<div className="max-w-lg mx-auto flex-1 w-full mt-4">
{currentStep === WizardStep.Destination && <DestinationStep />}
{currentStep === WizardStep.Trigger && !hideTriggerStep && <TriggerStep />}
{currentStep === WizardStep.Configure && <ConfigureStep />}
</div>
<p className="text-center text-xs text-muted mt-6">
Need more control?{' '}
<button type="button" onClick={onSwitchToTraditional} className="text-link hover:underline">
Go back to traditional editor
</button>
</p>
</div>
)
}