File size: 1,787 Bytes
af1bee9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import { Modal } from '@mantine/core';
import { isMac } from './shell/TopBar';
const mod = () => (isMac() ? '⌘' : 'Ctrl');
const ROWS: [string[], string][] = [
[['MOD', 'K'], 'Search, go to a page, open a test run or ask a question'],
[['/'], 'Search (opens the same palette)'],
[['N'], 'Start a new test run'],
[['['], 'Hide or show the sidebar'],
[['G', 'H'], 'Go to Home'],
[['G', 'R'], 'Go to Test runs'],
[['G', 'S'], 'Go to Scenarios'],
[['G', 'D'], 'Go to Defects'],
[['G', 'P'], 'Go to Reports'],
[['G', 'E'], 'Go to Test environments'],
[['Alt', '1 2 3'], 'On a test run: the conversation, the message box, the details panel'],
[['MOD', '\\'], 'On a test run: show or hide the details panel'],
[['Esc'], 'Close a menu, the palette or a sheet'],
[['?'], 'Show this list'],
];
/** The keyboard shortcut list (the ? key). Approving, deciding, signing off and the emergency stop have no single-key shortcut by design. */
export function KeyboardSheet({ opened, onClose }: { opened: boolean; onClose: () => void }) {
return (
<Modal opened={opened} onClose={onClose} title="Keyboard shortcuts" size={520} data-testid="shortcuts">
<p className="trio-lede" style={{ marginTop: 0 }}>Single keys work when you are not typing in a field.</p>
<dl className="trio-keys">
{ROWS.map(([keys, what]) => (
<div key={what}>
<dt>{keys.map((k, i) => <kbd key={i} className="fpt-kbd">{k === 'MOD' ? mod() : k}</kbd>)}</dt>
<dd>{what}</dd>
</div>
))}
</dl>
<p className="trio-foot">Approving, deciding on failures, signing off and the emergency stop never have a one-key shortcut. They always need a visible button.</p>
</Modal>
);
}
|