MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / HelpV2

Function HelpV2

src/components/HelpV2/HelpV2.tsx:22–120  ·  view source on GitHub ↗
({ onClose, commands }: Props)

Source from the content-addressed store, hash-verified

20};
21
22export function HelpV2({ onClose, commands }: Props): React.ReactNode {
23 const { rows, columns } = useTerminalSize();
24 const maxHeight = Math.floor(rows / 2);
25 // Inside the modal slot, FullscreenLayout already caps height and Pane/Tabs
26 // use flexShrink=0 (see #23592) — our own height= constraint would clip the
27 // footer since Tabs won't shrink to fit. Let the modal slot handle sizing.
28 const insideModal = useIsInsideModal();
29
30 const close = () => onClose('Help dialog dismissed', { display: 'system' });
31 useKeybinding('help:dismiss', close, { context: 'Help' });
32 const exitState = useExitOnCtrlCDWithKeybindings(close);
33 const dismissShortcut = useShortcutDisplay('help:dismiss', 'Help', 'esc');
34
35 const builtinNames = builtInCommandNames();
36 let builtinCommands = commands.filter(cmd => builtinNames.has(cmd.name) && !cmd.isHidden);
37 let antOnlyCommands: Command[] = [];
38
39 // We have to do this in an `if` to help treeshaking
40 if (process.env.USER_TYPE === 'ant') {
41 const internalOnlyNames = new Set(INTERNAL_ONLY_COMMANDS.map(_ => _.name));
42 builtinCommands = builtinCommands.filter(cmd => !internalOnlyNames.has(cmd.name));
43 antOnlyCommands = commands.filter(cmd => internalOnlyNames.has(cmd.name) && !cmd.isHidden);
44 }
45
46 const customCommands = commands.filter(cmd => !builtinNames.has(cmd.name) && !cmd.isHidden);
47
48 const tabs = [
49 <Tab key="general" title="general">
50 <General />
51 </Tab>,
52 ];
53
54 tabs.push(
55 <Tab key="commands" title="commands">
56 <Commands
57 commands={builtinCommands}
58 maxHeight={maxHeight}
59 columns={columns}
60 title="Browse default commands:"
61 onCancel={close}
62 />
63 </Tab>,
64 );
65
66 tabs.push(
67 <Tab key="custom" title="custom-commands">
68 <Commands
69 commands={customCommands}
70 maxHeight={maxHeight}
71 columns={columns}
72 title="Browse custom commands:"
73 emptyMessage="No custom commands found"
74 onCancel={close}
75 />
76 </Tab>,
77 );
78
79 if (process.env.USER_TYPE === 'ant' && antOnlyCommands.length > 0) {

Callers

nothing calls this directly

Calls 7

useTerminalSizeFunction · 0.85
useKeybindingFunction · 0.85
useShortcutDisplayFunction · 0.85
useIsInsideModalFunction · 0.50
hasMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected