From 5972d421d805ee6c854ad7680833ec47a4cfb1c7 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Sun, 1 Jan 2023 16:47:07 +0100 Subject: [PATCH] feat(filters): perfect flac disable fields (#605) * feat(filters): perfect flac disable fields * feat(filters): logscore min 0 max 100 * feat(filters): validate numberfield 0 value * feat(filters): cleanup logs * feat(filters): set default priority 0 --- web/src/components/inputs/common.tsx | 8 ++++++-- web/src/components/inputs/input.tsx | 28 +++++++++++++++++++++++++--- web/src/components/inputs/select.tsx | 5 ++++- web/src/screens/filters/details.tsx | 22 +++++++++++----------- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/web/src/components/inputs/common.tsx b/web/src/components/inputs/common.tsx index 5762739..f40072b 100644 --- a/web/src/components/inputs/common.tsx +++ b/web/src/components/inputs/common.tsx @@ -1,4 +1,5 @@ import { Field, FieldProps } from "formik"; +import { classNames } from "../../utils"; interface ErrorFieldProps { name: string; @@ -19,12 +20,14 @@ interface CheckboxFieldProps { name: string; label: string; sublabel?: string; + disabled?: boolean; } const CheckboxField = ({ name, label, - sublabel + sublabel, + disabled }: CheckboxFieldProps) => (
@@ -32,7 +35,8 @@ const CheckboxField = ({ id={name} name={name} type="checkbox" - className="focus:ring-bkue-500 h-4 w-4 text-blue-600 border-gray-300 rounded" + className={classNames("focus:ring-blue-500 h-4 w-4 text-blue-600 border-gray-300 rounded", disabled ? "bg-gray-200" : "")} + disabled={disabled} />
diff --git a/web/src/components/inputs/input.tsx b/web/src/components/inputs/input.tsx index ecf6c90..e4b1d7a 100644 --- a/web/src/components/inputs/input.tsx +++ b/web/src/components/inputs/input.tsx @@ -2,6 +2,7 @@ import { Field, FieldProps } from "formik"; import { classNames } from "../../utils"; import { EyeIcon, EyeSlashIcon } from "@heroicons/react/24/solid"; import { useToggle } from "../../hooks/hooks"; +import { log } from "util"; type COL_WIDTHS = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; @@ -204,6 +205,9 @@ interface NumberFieldProps { placeholder?: string; step?: number; disabled?: boolean; + required?: boolean; + min?: number; + max?: number; } export const NumberField = ({ @@ -211,7 +215,10 @@ export const NumberField = ({ label, placeholder, step, - disabled + min, + max, + disabled, + required }: NumberFieldProps) => (