mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
feat: add multiple attachment input
This commit is contained in:
@@ -11,6 +11,7 @@ import { FormControlLabel, MenuItem, Switch } from "@mui/material";
|
||||
import { ControllerRenderProps } from "react-hook-form";
|
||||
|
||||
import AttachmentInput from "@/app-components/attachment/AttachmentInput";
|
||||
import MultipleAttachmentInput from "@/app-components/attachment/MultipleAttachmentInput";
|
||||
import { Adornment } from "@/app-components/inputs/Adornment";
|
||||
import AutoCompleteEntitySelect from "@/app-components/inputs/AutoCompleteEntitySelect";
|
||||
import { Input } from "@/app-components/inputs/Input";
|
||||
@@ -20,7 +21,7 @@ import { useTranslate } from "@/hooks/useTranslate";
|
||||
import { EntityType, Format } from "@/services/types";
|
||||
import { IBlock } from "@/types/block.types";
|
||||
import { IHelper } from "@/types/helper.types";
|
||||
import { ISetting } from "@/types/setting.types";
|
||||
import { ISetting, SettingType } from "@/types/setting.types";
|
||||
import { MIME_TYPES } from "@/utils/attachment";
|
||||
|
||||
interface RenderSettingInputProps {
|
||||
@@ -45,7 +46,7 @@ const SettingInput: React.FC<RenderSettingInputProps> = ({
|
||||
});
|
||||
|
||||
switch (setting.type) {
|
||||
case "text":
|
||||
case SettingType.text:
|
||||
case "textarea":
|
||||
return (
|
||||
<Input
|
||||
@@ -185,6 +186,18 @@ const SettingInput: React.FC<RenderSettingInputProps> = ({
|
||||
size={128}
|
||||
/>
|
||||
);
|
||||
|
||||
case SettingType.multiple_attachment:
|
||||
return (
|
||||
<MultipleAttachmentInput
|
||||
label={label}
|
||||
{...field}
|
||||
value={field.value}
|
||||
accept={MIME_TYPES["images"].join(",")}
|
||||
format="full"
|
||||
size={128}
|
||||
/>
|
||||
);
|
||||
default:
|
||||
return <Input {...field} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user