mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 07:10:33 +00:00
fix:globalhotkeys & quick new.
This commit is contained in:
@@ -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' },
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -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();
|
|
||||||
})(routes);
|
|
||||||
|
|
||||||
const handleSidebarToggleBtn = () => {
|
const handleSidebarToggleBtn = () => {
|
||||||
toggleSidebarExpend();
|
toggleSidebarExpend();
|
||||||
recordSidebarPreviousExpand();
|
|
||||||
};
|
};
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
globalHotkeys,
|
globalHotkeys,
|
||||||
|
|||||||
@@ -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 (
|
||||||
|
|||||||
Reference in New Issue
Block a user