fix:globalhotkeys & quick new.

This commit is contained in:
elforjani3
2021-01-19 12:23:05 +02:00
parent 61e42edc23
commit d14e5d6fa7
3 changed files with 14 additions and 20 deletions

View File

@@ -1,8 +1,8 @@
export default [
{ id: 'invoices', name: 'Sale invoice', label: 'Shift+I' },
{ id: 'Purchase invoice', name: 'Purchase invoice' },
{ id: 'manual-journals', name: 'Manual journal', label: 'Shift+M' },
{ id: 'expenses', name: 'Expense', label: 'Shift+X' },
{ id: 'customers', name: 'Customer', label: 'Shift+C' },
{ id: 'vendors', name: 'Vendor', label: 'Shift+V' },
{ path: 'invoices/new', name: 'Sale invoice', label: 'Ctrl+Shift+I' },
{ path: 'bill//new', name: 'Purchase invoice',label:'Ctrl+Shift+B' },
{ path: 'make-journal-entry', name: 'Manual journal', label: 'Ctrl+Shift+M' },
{ path: 'expenses/new', name: 'Expense', label: 'Ctrl+Shift+X' },
{ path: 'customers/new', name: 'Customer', label: 'Ctrl+Shift+C' },
{ path: 'vendors/new', name: 'Vendor', label: 'Ctrl+Shift+V' },
];

View File

@@ -5,25 +5,19 @@ import routes from 'routes/dashboard';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import { compose } from 'utils';
function GlobalHotkeys({
// #withDashboardActions
toggleSidebarExpend,
recordSidebarPreviousExpand,
}) {
const history = useHistory();
const globalHotkeys = (function (array) {
const result = [];
array.forEach(({ hotkey }) =>
typeof hotkey !== 'undefined' ? result.push(hotkey) : null,
);
return result.toString();
})(routes);
const handleSidebarToggleBtn = () => {
const globalHotkeys = routes
.filter(({ hotkey }) => hotkey)
.map(({ hotkey }) => hotkey)
.toString();
const handleSidebarToggleBtn = () => {
toggleSidebarExpend();
recordSidebarPreviousExpand();
};
useHotkeys(
globalHotkeys,

View File

@@ -12,8 +12,8 @@ import quickNewOptions from 'common/quickNewOptions';
function QuickNewDropdown() {
const history = useHistory();
const handleClickQuickNew = ({ id }) => {
history.push(`/${id}`);
const handleClickQuickNew = ({path }) => {
history.push(`/${path}`);
};
return (