feat: money in & out Hotkeys.

This commit is contained in:
elforjani13
2021-10-23 20:59:25 +02:00
parent 75acab3348
commit e29db07c32
7 changed files with 31 additions and 16 deletions

View File

@@ -3,11 +3,16 @@ import { useHotkeys } from 'react-hotkeys-hook';
import { useHistory } from 'react-router-dom';
import { getDashboardRoutes } from 'routes/dashboard';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withDialogActions from 'containers/Dialog/withDialogActions';
import { compose } from 'utils';
function GlobalHotkeys({
// #withDashboardActions
toggleSidebarExpend,
// #withDialogActions
openDialog,
}) {
const history = useHistory();
const routes = getDashboardRoutes();
@@ -16,8 +21,8 @@ function GlobalHotkeys({
.filter(({ hotkey }) => hotkey)
.map(({ hotkey }) => hotkey)
.toString();
const handleSidebarToggleBtn = () => {
const handleSidebarToggleBtn = () => {
toggleSidebarExpend();
};
useHotkeys(
@@ -32,7 +37,9 @@ function GlobalHotkeys({
[history],
);
useHotkeys('ctrl+/', (event, handle) => handleSidebarToggleBtn());
useHotkeys('shift+q', (event, handle) => openDialog('money-in', {}));
useHotkeys('shift+d', (event, handle) => openDialog('money-out', {}));
return <div></div>;
}
export default compose(withDashboardActions)(GlobalHotkeys);
export default compose(withDashboardActions, withDialogActions)(GlobalHotkeys);