chore: tidy
This commit is contained in:
parent
40a02ea088
commit
5af4fcf6a5
|
@ -1,10 +1,11 @@
|
||||||
// 3rd party.
|
// 3rd party.
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import React, {useEffect, useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
// 2nd party.
|
// 2nd party.
|
||||||
import {compose} from '@avocado/core';
|
import {compose} from '@avocado/core';
|
||||||
import contempo from 'contempo';
|
import contempo from 'contempo';
|
||||||
// 1st party.
|
// 1st party.
|
||||||
|
import {useEvent} from '../hooks/use-event';
|
||||||
import QuickStatus from './quick-status';
|
import QuickStatus from './quick-status';
|
||||||
import Hotbar from './hotbar';
|
import Hotbar from './hotbar';
|
||||||
import Inventory from './inventory';
|
import Inventory from './inventory';
|
||||||
|
@ -16,16 +17,9 @@ const decorate = compose(
|
||||||
|
|
||||||
const MenuComponent = ({app}) => {
|
const MenuComponent = ({app}) => {
|
||||||
const [opened, setOpened] = useState(false);
|
const [opened, setOpened] = useState(false);
|
||||||
useEffect(() => {
|
useEvent(app, 'isMenuOpenedChanged', (_, isOpened) => {
|
||||||
const onMenuOpenedChanged = () => {
|
setOpened(isOpened);
|
||||||
setOpened(app.isMenuOpened);
|
});
|
||||||
}
|
|
||||||
onMenuOpenedChanged();
|
|
||||||
app.on('isMenuOpenedChanged', onMenuOpenedChanged);
|
|
||||||
return () => {
|
|
||||||
app.off('isMenuOpenedChanged', onMenuOpenedChanged);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
return <div className="menu unselectable">
|
return <div className="menu unselectable">
|
||||||
<div className={classnames(
|
<div className={classnames(
|
||||||
'menu-inner',
|
'menu-inner',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user