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 [ export default [
{ id: 'invoices', name: 'Sale invoice', label: 'Shift+I' }, { path: 'invoices/new', name: 'Sale invoice', label: 'Ctrl+Shift+I' },
{ id: 'Purchase invoice', name: 'Purchase invoice' }, { path: 'bill//new', name: 'Purchase invoice',label:'Ctrl+Shift+B' },
{ id: 'manual-journals', name: 'Manual journal', label: 'Shift+M' }, { path: 'make-journal-entry', name: 'Manual journal', label: 'Ctrl+Shift+M' },
{ id: 'expenses', name: 'Expense', label: 'Shift+X' }, { path: 'expenses/new', name: 'Expense', label: 'Ctrl+Shift+X' },
{ id: 'customers', name: 'Customer', label: 'Shift+C' }, { path: 'customers/new', name: 'Customer', label: 'Ctrl+Shift+C' },
{ id: 'vendors', name: 'Vendor', label: 'Shift+V' }, { 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 withDashboardActions from 'containers/Dashboard/withDashboardActions';
import { compose } from 'utils'; import { compose } from 'utils';
function GlobalHotkeys({ function GlobalHotkeys({
// #withDashboardActions // #withDashboardActions
toggleSidebarExpend, toggleSidebarExpend,
recordSidebarPreviousExpand,
}) { }) {
const history = useHistory(); const history = useHistory();
const globalHotkeys = (function (array) { const globalHotkeys = routes
const result = []; .filter(({ hotkey }) => hotkey)
array.forEach(({ hotkey }) => .map(({ hotkey }) => hotkey)
typeof hotkey !== 'undefined' ? result.push(hotkey) : null, .toString();
);
return result.toString(); const handleSidebarToggleBtn = () => {
})(routes);
const handleSidebarToggleBtn = () => {
toggleSidebarExpend(); toggleSidebarExpend();
recordSidebarPreviousExpand();
}; };
useHotkeys( useHotkeys(
globalHotkeys, globalHotkeys,

View File

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