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