Skip to content

Commit

Permalink
fix(ui): fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Nov 11, 2024
1 parent 5304bba commit 985bdee
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion ui/src/Components/MainModal/Configuration/GridLabelName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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 }}
Expand Down
3 changes: 2 additions & 1 deletion ui/src/Components/MainModal/Configuration/SortLabelName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 985bdee

Please sign in to comment.