diff --git a/frontend/src/components/visual-editor/form/inputs/message/ButtonInput.tsx b/frontend/src/components/visual-editor/form/inputs/message/ButtonInput.tsx index 067c08a3..dae26a5b 100644 --- a/frontend/src/components/visual-editor/form/inputs/message/ButtonInput.tsx +++ b/frontend/src/components/visual-editor/form/inputs/message/ButtonInput.tsx @@ -6,7 +6,7 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import { Grid, MenuItem } from "@mui/material"; +import { Grid } from "@mui/material"; import { FC } from "react"; import { FieldPath, useFormContext } from "react-hook-form"; @@ -15,11 +15,7 @@ import { ToggleableInput } from "@/app-components/inputs/ToggleableInput"; import { useTranslate } from "@/hooks/useTranslate"; import { useValidationRules } from "@/hooks/useValidationRules"; import { IBlockAttributes } from "@/types/block.types"; -import { - AnyButton, - ButtonType, - WebviewHeightRatio, -} from "@/types/message.types"; +import { AnyButton, ButtonType } from "@/types/message.types"; const buildFieldPath = ( fieldPath: FieldPath, @@ -45,22 +41,7 @@ const ButtonInput: FC = ({ fieldPath, }) => { const { t } = useTranslate(); - const types: { value: ButtonType; label: string }[] = [ - { value: ButtonType.postback, label: t("label.postback") }, - { value: ButtonType.web_url, label: t("label.web_url") }, - ]; const rules = useValidationRules(); - const setButtonType = (type: ButtonType) => { - if (type === ButtonType.postback) { - onChange({ - type: ButtonType.postback, - title: button.title, - payload: button.title, - }); - } else { - onChange({ type: ButtonType.web_url, title: button.title, url: "" }); - } - }; const { register, formState: { errors }, @@ -68,22 +49,7 @@ const ButtonInput: FC = ({ return ( <> - - { - setButtonType(e.target.value as ButtonType); - }} - > - {types.map((item) => ( - - {item.label} - - ))} - - - + = ({ } /> - + {button.type === ButtonType.postback ? ( = ({ /> )} - - {button.type === ButtonType.postback ? null : ( - { - const value = e.target.value; - - onChange({ - ...button, - messenger_extensions: e.target.value !== "none", - webview_height_ratio: - value !== "none" ? (value as WebviewHeightRatio) : undefined, - }); - }} - > - {t("label.none")} - {t("label.compact")} - {t("label.tall")} - {t("label.full")} - - )} - ); }; diff --git a/frontend/src/components/visual-editor/form/inputs/message/ButtonsInput.tsx b/frontend/src/components/visual-editor/form/inputs/message/ButtonsInput.tsx index f1c4a0a5..5597feb4 100644 --- a/frontend/src/components/visual-editor/form/inputs/message/ButtonsInput.tsx +++ b/frontend/src/components/visual-editor/form/inputs/message/ButtonsInput.tsx @@ -98,18 +98,12 @@ const ButtonsInput: FC = ({ return ( - - {t("label.type")} - - + {t("label.title")} - + {t("label.payload")} / {t("label.url")} - - {t("label.webview")} -   @@ -135,7 +129,7 @@ const ButtonsInput: FC = ({ ))} addInput(action.defaultValue)} diff --git a/frontend/src/components/visual-editor/form/inputs/message/QuickRepliesInput.tsx b/frontend/src/components/visual-editor/form/inputs/message/QuickRepliesInput.tsx index 39f45e67..79122a35 100644 --- a/frontend/src/components/visual-editor/form/inputs/message/QuickRepliesInput.tsx +++ b/frontend/src/components/visual-editor/form/inputs/message/QuickRepliesInput.tsx @@ -6,7 +6,7 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import { Abc, LocationOn, RemoveCircleOutline } from "@mui/icons-material"; +import { Abc, RemoveCircleOutline } from "@mui/icons-material"; import AddIcon from "@mui/icons-material/Add"; import { Box, Grid, IconButton } from "@mui/material"; import { FC, Fragment, useEffect, useMemo, useState } from "react"; @@ -46,13 +46,6 @@ const QuickRepliesInput: FC = ({ payload: "", }, }, - { - icon: , - name: t("button.location"), - defaultValue: { - content_type: QuickReplyType.location, - }, - }, ], [t], ); @@ -88,14 +81,11 @@ const QuickRepliesInput: FC = ({ return ( - - {t("label.type")} - - + {t("label.title")} - + {t("label.payload")} @@ -122,7 +112,12 @@ const QuickRepliesInput: FC = ({ ))} addInput(action.defaultValue)} diff --git a/frontend/src/components/visual-editor/form/inputs/message/QuickReplyInput.tsx b/frontend/src/components/visual-editor/form/inputs/message/QuickReplyInput.tsx index 87f89f7c..1e688024 100644 --- a/frontend/src/components/visual-editor/form/inputs/message/QuickReplyInput.tsx +++ b/frontend/src/components/visual-editor/form/inputs/message/QuickReplyInput.tsx @@ -6,7 +6,7 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import { Grid, MenuItem } from "@mui/material"; +import { Grid } from "@mui/material"; import { FC, useState } from "react"; import { useFormContext } from "react-hook-form"; @@ -28,51 +28,15 @@ const QuickReplyInput: FC = ({ idx, }) => { const { t } = useTranslate(); - const [quickReplyType, setQuickReplyType] = useState(value.content_type); + const [quickReplyType, _setQuickReplyType] = useState(value.content_type); const { register, formState: { errors }, } = useFormContext(); - const types = Object.values(QuickReplyType).map((value) => { - return { - value, - label: t(`label.${value}`), - }; - }); return ( <> - - { - const selected = e.target.value as QuickReplyType; - - setQuickReplyType(selected); - - onChange( - selected === QuickReplyType.location - ? { - content_type: QuickReplyType.location, - } - : { - content_type: selected, - title: "", - payload: "", - }, - ); - }} - > - {types.map((item) => ( - - {item.label} - - ))} - - - - + {quickReplyType !== QuickReplyType.location ? ( = ({ /> ) : null} - + {quickReplyType !== QuickReplyType.location ? (