Skip to content

Commit

Permalink
workaround for dashboard card menu overflow #440
Browse files Browse the repository at this point in the history
  • Loading branch information
io53 committed Sep 9, 2024
1 parent 54d7e65 commit 5a0323d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/states/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,29 @@ class Dashboard extends Component {
</Box>
<EditNameDialog open={this.state.rename} onClose={() => this.setState({ ...this.state, rename: null })} sensor={this.state.rename} updateSensor={(s) => this.updateSensor(s)} />
<ConfirmationDialog open={this.state.showResetOrderConfirmation} title="dialog_are_you_sure" description='reset_order_confirmation' onClose={(yes) => this.resetOrder(yes)} />
{!this.getCurrentSensor() && <ExtraPadding />}
</>
)
}
}

function ExtraPadding() {
const [extraBottomPadding, setExtraBottomPadding] = React.useState(window.innerHeight < 800 ? 20 : 0);

React.useEffect(() => {
const handleResize = () => {
setExtraBottomPadding(window.innerHeight < 800 ? 20 : 0);
};

window.addEventListener('resize', handleResize);
return () => {
window.removeEventListener('resize', handleResize);
};
}, []);

return <Box height={`${extraBottomPadding}px`} />;
}

export default withTranslation()(withColorMode((props) => (
<Dashboard
{...props}
Expand Down

0 comments on commit 5a0323d

Please sign in to comment.