import React from 'react';
import { useTranslation } from 'next-i18next';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
import { useShortcutsModal } from '~/stores/modal';
import styles from './ShortcutsModal.module.scss';
const ShortcutsModal = (): JSX.Element => {
const { t } = useTranslation();
const { data: status, close } = useShortcutsModal();
const bodyContent = () => {
if (status == null || !status.isOpened) {
return <>>;
}
// add classes to cmd-key by OS
const platform = window.navigator.platform.toLowerCase();
const isMac = (platform.indexOf('mac') > -1);
const additionalClassByOs = isMac ? 'mac' : 'win';
return (
{t('modal_shortcuts.global.title')}
{/* Open/Close shortcut help */}
-
+
/
{/* Create Page */}
-
{t('modal_shortcuts.global.Create Page')}
C
{/* Edit Page */}
-
{t('modal_shortcuts.global.Edit Page')}
E
{/* Search */}
-
{t('modal_shortcuts.global.Search')}
/
{/* Show Contributors */}
-
{/* Mirror Mode */}
-
{t('modal_shortcuts.global.MirrorMode')}
{t('modal_shortcuts.editor.title')}
{/* Search in Editor */}
-
{t('modal_shortcuts.editor.Search in Editor')}
+
F
{/* Save Page */}
-
{t('modal_shortcuts.editor.Save Page')}
{t('modal_shortcuts.editor.Only Editor')}
+
S
{/* Indent */}
-
{t('modal_shortcuts.editor.Indent')}
Tab
{/* Outdent */}
-
{t('modal_shortcuts.editor.Outdent')}
Shift
+
Tab
{/* Delete Line */}
-
{t('modal_shortcuts.editor.Delete Line')}
+
Shift
+
K
{/* Insert Line */}
-
{t('modal_shortcuts.editor.Post Comment')}
+
Enter
{/* Move Line */}
-
{t('modal_shortcuts.editor.Move Line')}
+
arrow_downward
or
arrow_upward
{/* Copy Line */}
-
{t('modal_shortcuts.editor.Copy Line')}
+
Shift
+
arrow_downward
or
arrow_upward
{/* Toggle Line */}
-
{t('modal_shortcuts.editor.Toggle Line')}
+
/
{/* TODO: Add docs link button https://redmine.weseek.co.jp/issues/161862 */}
);
};
return (
<>
{ status != null && (
{t('Shortcuts')}
{bodyContent()}
) }
>
);
};
export default ShortcutsModal;