feat: add multiple attachment input

This commit is contained in:
hexastack
2024-10-31 19:56:23 +01:00
parent 1792b125d3
commit f7ae8682e0
3 changed files with 140 additions and 2 deletions

View File

@@ -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} />;
}