import { PopoverContent, PopoverArrow, PopoverBody, useEventListener, Portal, Stack, IconButton, Flex, } from '@chakra-ui/react' import { ExpandIcon } from 'assets/icons' import { useTypebot } from 'contexts/TypebotContext/TypebotContext' import { InputStep, InputStepType, IntegrationStepType, LogicStepType, Step, StepOptions, } from 'models' import { useRef } from 'react' import { TextInputSettingsBody, NumberInputSettingsBody, EmailInputSettingsBody, UrlInputSettingsBody, DateInputSettingsBody, } from './bodies' import { ChoiceInputSettingsBody } from './bodies/ChoiceInputSettingsBody' import { ConditionSettingsBody } from './bodies/ConditionSettingsBody' import { GoogleSheetsSettingsBody } from './bodies/GoogleSheetsSettingsBody' import { PhoneNumberSettingsBody } from './bodies/PhoneNumberSettingsBody' import { SetVariableSettingsBody } from './bodies/SetVariableSettingsBody' type Props = { step: Step onExpandClick: () => void } export const SettingsPopoverContent = ({ step, onExpandClick }: Props) => { const ref = useRef(null) const handleMouseDown = (e: React.MouseEvent) => e.stopPropagation() const handleMouseWheel = (e: WheelEvent) => { e.stopPropagation() } useEventListener('wheel', handleMouseWheel, ref.current) return ( } size="xs" onClick={onExpandClick} /> ) } export const StepSettings = ({ step }: { step: Step }) => { const { updateStep } = useTypebot() const handleOptionsChange = (options: StepOptions) => updateStep(step.id, { options } as Partial) switch (step.type) { case InputStepType.TEXT: { return ( ) } case InputStepType.NUMBER: { return ( ) } case InputStepType.EMAIL: { return ( ) } case InputStepType.URL: { return ( ) } case InputStepType.DATE: { return ( ) } case InputStepType.PHONE: { return ( ) } case InputStepType.CHOICE: { return ( ) } case LogicStepType.SET_VARIABLE: { return ( ) } case LogicStepType.CONDITION: { return ( ) } case IntegrationStepType.GOOGLE_SHEETS: { return ( ) } default: { return <> } } }