diff --git a/src/components/fields/Rating/Settings.tsx b/src/components/fields/Rating/Settings.tsx index 9894ba95..5504bd08 100644 --- a/src/components/fields/Rating/Settings.tsx +++ b/src/components/fields/Rating/Settings.tsx @@ -1,41 +1,48 @@ import { ISettingsProps } from "@src/components/fields/types"; -import { Slider, InputLabel } from "@mui/material"; +import { Slider, InputLabel, TextField, Grid } from "@mui/material"; +import ToggleButton from "@mui/material/ToggleButton"; +import ToggleButtonGroup from "@mui/material/ToggleButtonGroup"; export default function Settings({ onChange, config }: ISettingsProps) { return ( <> - Maximum number of stars - `${v} max stars`} - aria-labelledby="max-slider" - valueLabelDisplay="on" - onChange={(_, v) => { - onChange("max")(v); - }} - step={1} - marks - min={1} - max={15} - /> - - Slider precision - `${v} rating step size`} - aria-labelledby="precision-slider" - valueLabelDisplay="on" - onChange={(_, v) => { - onChange("precision")(v); - }} - step={0.25} - marks - min={0.25} - max={1} - /> + + + { + onChange("max")(parseInt(e.target.value)); + }} + inputProps={{ min: 1, max: 20 }} + /> + + + Star fraction + { + onChange("precision")(value); + }} + aria-label="text alignment" + > + + 1/4 + + + 1/2 + + + 1 + + + + ); } diff --git a/src/components/fields/Reference/index.tsx b/src/components/fields/Reference/index.tsx index 2ea0491e..9d5b0f43 100644 --- a/src/components/fields/Reference/index.tsx +++ b/src/components/fields/Reference/index.tsx @@ -34,6 +34,5 @@ export const config: IFieldConfig = { SideDrawerField, //settings: Settings, filter: { operators: filterOperators }, - requireConfiguration: true, }; export default config; diff --git a/src/components/fields/SingleSelect/Settings.tsx b/src/components/fields/SingleSelect/Settings.tsx index 69649a26..103bb2cd 100644 --- a/src/components/fields/SingleSelect/Settings.tsx +++ b/src/components/fields/SingleSelect/Settings.tsx @@ -21,9 +21,13 @@ export default function Settings({ onChange, config }: ISettingsProps) { const [newOption, setNewOption] = useState(""); const handleAdd = () => { if (newOption.trim() !== "") { - onChange("options")([...options, newOption.trim()]); - setNewOption(""); - listEndRef.current.scrollIntoView({ behavior: "smooth", block: "end" }); + if (options.includes(newOption)) { + window.alert(`"${newOption}" is already an option`); + } else { + onChange("options")([...options, newOption.trim()]); + setNewOption(""); + listEndRef.current.scrollIntoView({ behavior: "smooth", block: "end" }); + } } }; diff --git a/src/components/fields/Status/ConditionModalContent.tsx b/src/components/fields/Status/ConditionModalContent.tsx index 15d36d91..044769bc 100644 --- a/src/components/fields/Status/ConditionModalContent.tsx +++ b/src/components/fields/Status/ConditionModalContent.tsx @@ -41,22 +41,21 @@ export default function ConditionModalContent({ )} {type === "number" && ( -
- =" }, - { label: "More than", value: ">" }, - ]} - onChange={(v) => handleUpdate("operator")(v)} - value={operator} - multiple={false} - label="Select operator" - /> -
+ =" }, + { label: "More than", value: ">" }, + ]} + onChange={(v) => handleUpdate("operator")(v)} + value={operator} + multiple={false} + label="Select operator" + /> handleUpdate("label")(e.target.value)} />