Skip to content

Commit

Permalink
#209 fixed oddness with sensor menu in compare
Browse files Browse the repository at this point in the history
  • Loading branch information
io53 committed Jul 24, 2024
1 parent 668eb13 commit 8fc5e98
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/components/SensorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,25 @@ export const SensorPicker = ({ sensors, canBeSelected, onSensorChange, normalSty
{i18next.t("sensors")}
</Box>
</MenuButton>
<MenuList mt="2" zIndex={10} ml={2}>
<MenuList mt="2" zIndex={10} ml={2} maxH={"800px"} overflowY={"scroll"}>
{sensors.map((x, i) => {
if (!x) return null;
let divider = <></>;
let borderStyle = {};
if (i === 0) borderStyle = { borderTopLeftRadius: 6, borderTopRightRadius: 6 };
if (i === sensors.length - 1) borderStyle = { borderBottomLeftRadius: 6, borderBottomRightRadius: 6 };
else divider = <MenuDivider />;
return <div key={x.sensor + "div"}>
<MenuItem key={x.sensor} isDisabled={canBeSelected && !canBeSelected.map(y => y.sensor).includes(x.sensor)} className={!normalStyle ? "ddlItem" : "ddlItemAlt"} style={{ ...borderStyle }} onClick={() => handleSensorChange(x.sensor)}>{x.name || x.sensor}</MenuItem>
return <>
<MenuItem key={x.sensor}
isDisabled={canBeSelected && !canBeSelected.map(y => y.sensor).includes(x.sensor)}
className={!normalStyle ? "ddlItem" : "ddlItemAlt"}
style={{ ...borderStyle }}
onClick={() => handleSensorChange(x.sensor)}
>
{x.name || x.sensor}
</MenuItem>
{divider}
</div>;
</>;
})}
</MenuList>
</Menu>
Expand Down

0 comments on commit 8fc5e98

Please sign in to comment.