patch-testing-coworker / web /src /components /KeyboardSheet.tsx
EnergyVenom's picture
Deploy Trio Co-Worker (Apple-style UI, state-sync safety, Fusion pod and AI from settings, monthly/quarterly cycles)
33ce28f verified
Raw History Blame Contribute Delete
1.79 kB
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>
);
}