MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / KeyProbe

Function KeyProbe

graph-ui/src/help/HelpOverlay.tsx:73–129  ·  view source on GitHub ↗

* Der Tastentest: was ankam, in sieben Zeilen. * * Der Griff haengt am Fenster und in derselben einfangenden Phase wie der der * Anwendung, also unmittelbar hinter ihm: was der Test zeigt, ist das Ereignis * in genau der Lage, in der die Verdrahtung es gesehen hat, samt der Marke, die * sie dar

()

Source from the content-addressed store, hash-verified

71 * am Fenster ruft. Ein Test, der die Regel nachbaut, prueft seine Kopie.
72 */
73function KeyProbe(): JSX.Element {
74 const [reading, setReading] = useState<KeyProbeReading | undefined>(undefined);
75
76 useEffect(() => {
77 const onKeyDown = (event: globalThis.KeyboardEvent): void => {
78 setReading(readKeyEvent(event, event.target as Element | null, WIRED_MENU_SHORTCUTS));
79 };
80 window.addEventListener('keydown', onKeyDown, KEY_LISTENER_OPTIONS);
81 return () => window.removeEventListener('keydown', onKeyDown, KEY_LISTENER_OPTIONS);
82 }, []);
83
84 const shown = reading ?? NO_KEY_READING;
85 const empty = reading === undefined;
86 const or = (value: string): string => (empty || value.length === 0 ? help.keyProbeNone : value);
87 const fields: { field: string; value: string }[] = [
88 { field: 'code', value: or(shown.code) },
89 { field: 'key', value: or(shown.key) },
90 { field: 'modifiers', value: empty ? help.keyProbeNone : modifiersOf(shown) },
91 { field: 'defaultPrevented', value: empty ? help.keyProbeNone : String(shown.defaultPrevented) },
92 {
93 field: 'consumedBy',
94 value: empty ? help.keyProbeNone : help.keyProbeConsumers[shown.consumedBy] ?? shown.consumedBy,
95 },
96 { field: 'target', value: or(shown.targetTag) },
97 {
98 field: 'shortcut',
99 value: empty
100 ? help.keyProbeNone
101 : shown.shortcut.length > 0
102 ? help.keyProbeShortcut(shown.shortcut)
103 : help.keyProbeNoShortcut,
104 },
105 ];
106
107 return (
108 <div className="atlas-help-keyprobe" data-testid="atlas-help-keyprobe" data-pressed={!empty}>
109 <h4 className="atlas-help-keyprobe-title">{help.keyProbeTitle}</h4>
110 <p className="atlas-help-text">{help.keyProbeIntro}</p>
111 <dl className="atlas-help-defs">
112 {fields.map((entry) => (
113 <div
114 className="atlas-help-def"
115 data-testid="atlas-help-keyprobe-field"
116 data-field={entry.field}
117 key={entry.field}
118 >
119 <dt className="atlas-help-term">{help.keyProbeFields[entry.field] ?? entry.field}</dt>
120 <dd className="atlas-help-desc" data-testid="atlas-help-keyprobe-value">
121 {entry.value}
122 </dd>
123 </div>
124 ))}
125 </dl>
126 <p className="atlas-help-note">{empty ? help.keyProbeIdle : help.keyProbeNote}</p>
127 </div>
128 );
129}
130

Callers

nothing calls this directly

Calls 2

orFunction · 0.85
modifiersOfFunction · 0.85

Tested by

no test coverage detected