fix(ui): fix types

This commit is contained in:
Łukasz Mierzwa
2024-11-11 13:50:57 +00:00
committed by Łukasz Mierzwa
parent 5304bba5cf
commit 985bdee534
4 changed files with 8 additions and 5 deletions
@@ -2,7 +2,7 @@ import React, { FC } from "react";
import { observer } from "mobx-react-lite";
import Select from "react-select";
import Select, { OnChangeValue } from "react-select";
import type { OptionT } from "Common/Select";
import type { Settings, CollapseStateT } from "Stores/Settings";
@@ -44,7 +44,7 @@ const AlertGroupCollapseConfiguration: FC<{
settingsStore.alertGroupConfig.config.defaultCollapseState,
)}
options={Object.values(settingsStore.alertGroupConfig.options)}
onChange={(option) =>
onChange={(option: OnChangeValue<OptionT, false>) =>
onCollapseChange((option as OptionT).value as CollapseStateT)
}
hideSelectedOptions
@@ -8,6 +8,7 @@ import type { Settings } from "Stores/Settings";
import { ThemeContext } from "Components/Theme";
import { AnimatedMenu } from "Components/Select";
import { NewLabelName, StringToOption, OptionT } from "Common/Select";
import { OnChangeValue } from "react-select";
const disabledLabel = "Disable multi-grid";
@@ -54,7 +55,7 @@ const GridLabelName: FC<{
]
: staticValues
}
onChange={(option) => {
onChange={(option: OnChangeValue<OptionT, false>) => {
settingsStore.multiGridConfig.setGridLabel((option as OptionT).value);
}}
components={{ Menu: AnimatedMenu }}
@@ -10,6 +10,7 @@ import { useFetchGet } from "Hooks/useFetchGet";
import { ThemeContext } from "Components/Theme";
import { AnimatedMenu } from "Components/Select";
import { NewLabelName, StringToOption } from "Common/Select";
import { OnChangeValue } from "react-select";
const SortLabelName: FC<{
settingsStore: Settings;
@@ -36,7 +37,7 @@ const SortLabelName: FC<{
options={
response ? response.map((value: string) => StringToOption(value)) : []
}
onChange={(option) => {
onChange={(option: OnChangeValue<OptionT, false>) => {
settingsStore.gridConfig.setSortLabel(
(option as OptionT).value as string,
);
@@ -9,6 +9,7 @@ import { ValidationError } from "Components/ValidationError";
import { ThemeContext } from "Components/Theme";
import { AnimatedMenu } from "Components/Select";
import { NewLabelName, OptionT, StringToOption } from "Common/Select";
import { OnChangeValue } from "react-select";
const LabelNameInput: FC<{
matcher: MatcherWithIDT;
@@ -31,7 +32,7 @@ const LabelNameInput: FC<{
response ? response.map((value: string) => StringToOption(value)) : []
}
placeholder={isValid ? "Label name" : <ValidationError />}
onChange={(option) => {
onChange={(option: OnChangeValue<OptionT, false>) => {
matcher.name = (option as OptionT).value;
}}
hideSelectedOptions