summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src/hooks')
-rw-r--r--apps/web/src/hooks/use-keybindings.ts95
1 files changed, 0 insertions, 95 deletions
diff --git a/apps/web/src/hooks/use-keybindings.ts b/apps/web/src/hooks/use-keybindings.ts
index 3f96c340..0c524214 100644
--- a/apps/web/src/hooks/use-keybindings.ts
+++ b/apps/web/src/hooks/use-keybindings.ts
@@ -21,68 +21,10 @@ export function useKeybindingsListener() {
useEffect(() => {
const eventOptions: AddEventListenerOptions = { capture: true };
- // #region agent log
- fetch("http://127.0.0.1:7245/ingest/669b22f8-172b-4e65-aa3f-1c702ede83f7", {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- "X-Debug-Session-Id": "3997d9",
- },
- body: JSON.stringify({
- sessionId: "3997d9",
- runId: "initial",
- hypothesisId: "H1",
- location: "use-keybindings.ts:effect",
- message: "Keybindings listener mounted",
- data: {
- overlayDepth,
- isLoadingProject,
- isRecording,
- keybindingCount: Object.keys(keybindings).length,
- },
- timestamp: Date.now(),
- }),
- }).catch(() => {});
- // #endregion
const handleKeyDown = (ev: KeyboardEvent) => {
const normalizedKey = (ev.key ?? "").toLowerCase();
- const shouldLogKey =
- ev.code === "Space" ||
- ev.code.startsWith("Key") ||
- ["escape", "delete", "backspace", "enter"].includes(normalizedKey);
if (overlayDepth > 0 || isLoadingProject || isRecording) {
- if (shouldLogKey) {
- // #region agent log
- fetch(
- "http://127.0.0.1:7245/ingest/669b22f8-172b-4e65-aa3f-1c702ede83f7",
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- "X-Debug-Session-Id": "3997d9",
- },
- body: JSON.stringify({
- sessionId: "3997d9",
- runId: "initial",
- hypothesisId: "H2",
- location: "use-keybindings.ts:blocked",
- message: "Shortcut blocked by runtime gate",
- data: {
- key: ev.key,
- code: ev.code,
- overlayDepth,
- isLoadingProject,
- isRecording,
- targetTag:
- ev.target instanceof HTMLElement ? ev.target.tagName : null,
- },
- timestamp: Date.now(),
- }),
- },
- ).catch(() => {});
- // #endregion
- }
return;
}
@@ -93,43 +35,6 @@ export function useKeybindingsListener() {
isTypableDOMElement({ element: activeElement });
const boundAction = binding ? keybindings[binding] : undefined;
- if (shouldLogKey || binding || boundAction) {
- // #region agent log
- fetch(
- "http://127.0.0.1:7245/ingest/669b22f8-172b-4e65-aa3f-1c702ede83f7",
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- "X-Debug-Session-Id": "3997d9",
- },
- body: JSON.stringify({
- sessionId: "3997d9",
- runId: "initial",
- hypothesisId: !binding ? "H3" : isTextInput ? "H5" : "H4",
- location: "use-keybindings.ts:keydown",
- message: "Shortcut keydown observed",
- data: {
- key: ev.key,
- code: ev.code,
- binding,
- boundAction: boundAction ?? null,
- isTextInput,
- keybindingCount: Object.keys(keybindings).length,
- activeTag:
- activeElement instanceof HTMLElement
- ? activeElement.tagName
- : null,
- targetTag:
- ev.target instanceof HTMLElement ? ev.target.tagName : null,
- },
- timestamp: Date.now(),
- }),
- },
- ).catch(() => {});
- // #endregion
- }
-
if (normalizedKey === "escape" && isTextInput) {
activeElement.blur();
return;