Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
davemarco committed Sep 12, 2024
1 parent 6c45d69 commit acc4571
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions new-log-viewer/src/components/StatusBar/LogLevelFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import React, {
useContext,
useState
} from "react";
import React, {useContext, useState} from "react";

import Option from "@mui/joy/Option";
import Select from "@mui/joy/Select";
Expand All @@ -10,24 +7,24 @@ import {StateContext} from "../../contexts/StateContextProvider";
import {
LOG_LEVEL,
LOG_LEVEL_NAMES_LIST,
LOG_LEVEL_VALUES_LIST,
LOG_LEVEL_VALUES_LIST
} from "../../typings/logs";

export default function LogLevelFilter () {
const [selectedLogLevels, setSelectedLogLevels] =
useState<LOG_LEVEL[]>([...LOG_LEVEL_VALUES_LIST]);
const [selectedLogLevels, setSelectedLogLevels] = useState<LOG_LEVEL[]>([
...LOG_LEVEL_VALUES_LIST,
]);

const {
changeLogLevelFilter,
} = useContext(StateContext);
const {changeLogLevelFilter} = useContext(StateContext);

const handleChange = (
event: React.SyntheticEvent | null,
newValue: Array<string> | null
) => {
// convert strings to numbers.
// convert strings to numbers.
const selected: LOG_LEVEL[] = newValue ?
newValue.map((value) => Number(value)) : [];
newValue.map((value) => Number(value)):
[];

setSelectedLogLevels(selected);
changeLogLevelFilter(selected);
Expand All @@ -37,8 +34,8 @@ export default function LogLevelFilter () {
return (
<Select
// Convert selected log levels to strings for value.
value={selectedLogLevels.map(String)}
multiple
value={selectedLogLevels.map(String)}
sx={{minWidth: "13rem"}}
slotProps={{
listbox: {
Expand Down

0 comments on commit acc4571

Please sign in to comment.