import { PopoverContent, PopoverArrow, PopoverBody, useEventListener, Portal, IconButton, } from '@chakra-ui/react' import { ExpandIcon } from 'assets/icons' import { ConditionItem, ConditionBlock, InputBlockType, IntegrationBlockType, LogicBlockType, Block, BlockOptions, BlockWithOptions, Webhook, } from 'models' import { useRef } from 'react' import { TextInputSettingsBody, NumberInputSettingsBody, EmailInputSettingsBody, UrlInputSettingsBody, DateInputSettingsBody, } from './bodies' import { ChoiceInputSettingsBody } from './bodies/ChoiceInputSettingsBody' import { CodeSettings } from './bodies/CodeSettings' import { ConditionSettingsBody } from './bodies/ConditionSettingsBody' import { FileInputSettings } from './bodies/FileInputSettings' import { GoogleAnalyticsSettings } from './bodies/GoogleAnalyticsSettings' import { GoogleSheetsSettingsBody } from './bodies/GoogleSheetsSettingsBody' import { PaymentSettings } from './bodies/PaymentSettings' import { PhoneNumberSettingsBody } from './bodies/PhoneNumberSettingsBody' import { RatingInputSettings } from './bodies/RatingInputSettingsBody' import { RedirectSettings } from './bodies/RedirectSettings' import { SendEmailSettings } from './bodies/SendEmailSettings' import { SetVariableSettings } from './bodies/SetVariableSettings' import { TypebotLinkSettingsForm } from './bodies/TypebotLinkSettingsForm' import { WebhookSettings } from './bodies/WebhookSettings' import { ZapierSettings } from './bodies/ZapierSettings' type Props = { block: BlockWithOptions | ConditionBlock webhook?: Webhook onExpandClick: () => void onBlockChange: (updates: Partial) => void } export const SettingsPopoverContent = ({ onExpandClick, ...props }: 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 BlockSettings = ({ block, onBlockChange, }: { block: BlockWithOptions | ConditionBlock webhook?: Webhook onBlockChange: (block: Partial) => void }): JSX.Element => { const handleOptionsChange = (options: BlockOptions) => { onBlockChange({ options } as Partial) } const handleItemChange = (updates: Partial) => { onBlockChange({ items: [{ ...(block as ConditionBlock).items[0], ...updates }], } as Partial) } switch (block.type) { case InputBlockType.TEXT: { return ( ) } case InputBlockType.NUMBER: { return ( ) } case InputBlockType.EMAIL: { return ( ) } case InputBlockType.URL: { return ( ) } case InputBlockType.DATE: { return ( ) } case InputBlockType.PHONE: { return ( ) } case InputBlockType.CHOICE: { return ( ) } case InputBlockType.PAYMENT: { return ( ) } case InputBlockType.RATING: { return ( ) } case InputBlockType.FILE: { return ( ) } case LogicBlockType.SET_VARIABLE: { return ( ) } case LogicBlockType.CONDITION: { return ( ) } case LogicBlockType.REDIRECT: { return ( ) } case LogicBlockType.CODE: { return ( ) } case LogicBlockType.TYPEBOT_LINK: { return ( ) } case IntegrationBlockType.GOOGLE_SHEETS: { return ( ) } case IntegrationBlockType.GOOGLE_ANALYTICS: { return ( ) } case IntegrationBlockType.ZAPIER: { return } case IntegrationBlockType.MAKE_COM: { return ( ) } case IntegrationBlockType.PABBLY_CONNECT: { return ( ) } case IntegrationBlockType.WEBHOOK: { return ( ) } case IntegrationBlockType.EMAIL: { return ( ) } } }