mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: keyboardshortcuts dialog.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import { DialogContent } from 'components';
|
||||
import ShortcutsTable from '../../KeyboardShortcuts/ShortcutsTable';
|
||||
import KeyboardShortcutsFooter from './KeyboardShortcutsFooter';
|
||||
|
||||
import 'style/pages/keyboardShortcuts/KeyboardShortcutDialog.scss';
|
||||
|
||||
export default function KeyboardShortcutsDialogContent() {
|
||||
return (
|
||||
<DialogContent name={'keyboard-shortcuts'}>
|
||||
<ShortcutsTable />
|
||||
<KeyboardShortcutsFooter />
|
||||
</DialogContent>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import { Button, Intent } from '@blueprintjs/core';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
|
||||
import withDialogActions from 'containers/Dialog/withDialogActions';
|
||||
import { compose } from 'utils';
|
||||
|
||||
function KeyboardShortcutsFooter({
|
||||
// #withDialogActions
|
||||
closeDialog,
|
||||
}) {
|
||||
const handleClose = () => {
|
||||
closeDialog('keyboard-shortcuts');
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={'dialog--keyboard-shortcuts__footer'}>
|
||||
<Button intent={Intent.PRIMARY} onClick={handleClose} small={true}>
|
||||
<T id={'oK_'} />
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogActions)(KeyboardShortcutsFooter);
|
||||
@@ -0,0 +1,29 @@
|
||||
import React, { lazy } from 'react';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import { Dialog, DialogSuspense } from 'components';
|
||||
import withDialogRedux from 'components/DialogReduxConnect';
|
||||
import { compose } from 'utils';
|
||||
|
||||
const KeyboardShortcutsContent = lazy(() =>
|
||||
import('./KeyboardShortcutsDialogContent'),
|
||||
);
|
||||
|
||||
/**
|
||||
* Keyboard shortcuts dialog.
|
||||
*/
|
||||
function KeyboardShortcutsDialog({ dialogName, isOpen }) {
|
||||
return (
|
||||
<Dialog
|
||||
name={dialogName}
|
||||
isOpen={isOpen}
|
||||
className={'dialog--keyboard-shortcuts'}
|
||||
title={<T id={'keyboard_shortcuts'} canEscapeKeyClose={true} />}
|
||||
>
|
||||
<DialogSuspense>
|
||||
<KeyboardShortcutsContent />
|
||||
</DialogSuspense>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default compose(withDialogRedux())(KeyboardShortcutsDialog);
|
||||
36
client/src/containers/KeyboardShortcuts/ShortcutsTable.js
Normal file
36
client/src/containers/KeyboardShortcuts/ShortcutsTable.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import { DataTable } from 'components';
|
||||
import { FormattedMessage as T, useIntl } from 'react-intl';
|
||||
import keyboardShortcuts from 'common/keyboardShortcutsOptions';
|
||||
|
||||
/**
|
||||
* keyboard shortcuts table.
|
||||
*/
|
||||
function ShortcutsTable() {
|
||||
const { formatMessage } = useIntl();
|
||||
|
||||
const columns = useMemo(
|
||||
() => [
|
||||
{
|
||||
Header: formatMessage({ id: 'shortcut_keys' }),
|
||||
accessor: 'shortcut_key',
|
||||
disableSortBy: true,
|
||||
className: 'shortcut_key',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
id: 'description',
|
||||
Header: formatMessage({ id: 'description' }),
|
||||
accessor: 'description',
|
||||
disableSortBy: true,
|
||||
className: 'description',
|
||||
width: 250,
|
||||
},
|
||||
],
|
||||
[formatMessage],
|
||||
);
|
||||
|
||||
return <DataTable columns={columns} data={keyboardShortcuts} />;
|
||||
}
|
||||
|
||||
export default ShortcutsTable;
|
||||
Reference in New Issue
Block a user