diff --git a/gameyfin/src/main/frontend/components/administration/ConfigFormField.tsx b/gameyfin/src/main/frontend/components/administration/ConfigFormField.tsx index 5c0f2e7..1e03040 100644 --- a/gameyfin/src/main/frontend/components/administration/ConfigFormField.tsx +++ b/gameyfin/src/main/frontend/components/administration/ConfigFormField.tsx @@ -15,27 +15,27 @@ export default function ConfigFormField({configElement, ...props}: any) { ); } - switch (configElement.type) { - case "Boolean": + switch (configElement.type.toLowerCase()) { + case "boolean": return ( ); - case "String": + case "string": return ( ); - case "Float": + case "float": return ( ); - case "Int": + case "int": return ( ); - case "Array": + case "array": return ( ); diff --git a/gameyfin/src/main/frontend/components/general/input/ArrayInput.tsx b/gameyfin/src/main/frontend/components/general/input/ArrayInput.tsx index 3695b74..b3fd2e7 100644 --- a/gameyfin/src/main/frontend/components/general/input/ArrayInput.tsx +++ b/gameyfin/src/main/frontend/components/general/input/ArrayInput.tsx @@ -1,8 +1,7 @@ import {FieldArray, useField} from "formik"; import {Button, Chip, Input, Popover, PopoverContent, PopoverTrigger} from "@heroui/react"; import {KeyboardEvent, useState} from "react"; -import {Plus, XCircle} from "@phosphor-icons/react"; -import {SmallInfoField} from "Frontend/components/general/SmallInfoField"; +import {Plus} from "@phosphor-icons/react"; // @ts-ignore const ArrayInput = ({label, ...props}) => { @@ -16,7 +15,7 @@ const ArrayInput = ({label, ...props}) => { function handleKeyDown(event: KeyboardEvent) { if (event.key === "Enter" || event.key == "Tab" || event.key === ",") { event.preventDefault(); - + newElementValue .split(",") .map((value) => value.trim()) @@ -58,7 +57,7 @@ const ArrayInput = ({label, ...props}) => {
{meta.touched && meta.error && meta.error.trim().length > 0 && ( - + meta.error )}
diff --git a/gameyfin/src/main/frontend/components/general/input/CheckboxInput.tsx b/gameyfin/src/main/frontend/components/general/input/CheckboxInput.tsx index cd9e088..7e972f5 100644 --- a/gameyfin/src/main/frontend/components/general/input/CheckboxInput.tsx +++ b/gameyfin/src/main/frontend/components/general/input/CheckboxInput.tsx @@ -1,22 +1,28 @@ import {useField} from "formik"; -import {Checkbox} from "@heroui/react"; +import {Checkbox, CheckboxGroup} from "@heroui/react"; // @ts-ignore const CheckboxInput = ({label, ...props}) => { // @ts-ignore - const [field] = useField(props); + const [field, meta] = useField(props); return ( -
+ {label} -
+ ); } diff --git a/gameyfin/src/main/frontend/components/general/input/Input.tsx b/gameyfin/src/main/frontend/components/general/input/Input.tsx index 71a8201..90991a2 100644 --- a/gameyfin/src/main/frontend/components/general/input/Input.tsx +++ b/gameyfin/src/main/frontend/components/general/input/Input.tsx @@ -1,7 +1,5 @@ import {useField} from "formik"; import {Input as NextUiInput} from "@heroui/react"; -import {SmallInfoField} from "Frontend/components/general/SmallInfoField"; -import {XCircle} from "@phosphor-icons/react"; // @ts-ignore const Input = ({label, showErrorUntouched = false, ...props}) => { @@ -9,20 +7,15 @@ const Input = ({label, showErrorUntouched = false, ...props}) => { const [field, meta] = useField(props); return ( -
- -
- {(meta.touched || showErrorUntouched) && meta.error && meta.error.trim().length > 0 && ( - - )} -
-
+ ); } diff --git a/gameyfin/src/main/frontend/components/general/input/SelectInput.tsx b/gameyfin/src/main/frontend/components/general/input/SelectInput.tsx index 01d0824..d293f36 100644 --- a/gameyfin/src/main/frontend/components/general/input/SelectInput.tsx +++ b/gameyfin/src/main/frontend/components/general/input/SelectInput.tsx @@ -4,21 +4,26 @@ import {Select, SelectItem} from "@heroui/react"; // @ts-ignore const SelectInput = ({label, values, ...props}) => { // @ts-ignore - const [field] = useField(props); + const [field, meta] = useField(props); const items = values.map((v: string) => ({key: v, label: v})); return ( - +
+ +
); } diff --git a/gameyfin/src/main/frontend/components/general/input/PluginConfigFormField.tsx b/gameyfin/src/main/frontend/components/general/plugin/PluginConfigFormField.tsx similarity index 91% rename from gameyfin/src/main/frontend/components/general/input/PluginConfigFormField.tsx rename to gameyfin/src/main/frontend/components/general/plugin/PluginConfigFormField.tsx index 9deec2a..8ea1f44 100644 --- a/gameyfin/src/main/frontend/components/general/input/PluginConfigFormField.tsx +++ b/gameyfin/src/main/frontend/components/general/plugin/PluginConfigFormField.tsx @@ -12,18 +12,19 @@ export default function PluginConfigFormField({pluginConfigMetadata, ...props}: ); } - switch (metadata.type) { - case "Boolean": + switch (metadata.type.toLowerCase()) { + case "boolean": return ( ); - case "String": + case "string": return ( ); - case "Float": + case "float": return ( ); - case "Int": + case "int": return (