mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 21:03:08 +00:00
style: fix formatting with Prettier
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
|
||||
import { useEffect, useCallback } from "react";
|
||||
import { useAppStore, parseShortcut } from "@/store/app-store";
|
||||
import { useEffect, useCallback } from 'react';
|
||||
import { useAppStore, parseShortcut } from '@/store/app-store';
|
||||
|
||||
export interface KeyboardShortcut {
|
||||
key: string; // Can be simple "K" or with modifiers "Shift+N", "Cmd+K"
|
||||
key: string; // Can be simple "K" or with modifiers "Shift+N", "Cmd+K"
|
||||
action: () => void;
|
||||
description?: string;
|
||||
}
|
||||
@@ -18,37 +17,35 @@ function isInputFocused(): boolean {
|
||||
|
||||
// Check if it's a form input element
|
||||
const tagName = activeElement.tagName.toLowerCase();
|
||||
if (tagName === "input" || tagName === "textarea" || tagName === "select") {
|
||||
if (tagName === 'input' || tagName === 'textarea' || tagName === 'select') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if it's a contenteditable element
|
||||
if (activeElement.getAttribute("contenteditable") === "true") {
|
||||
if (activeElement.getAttribute('contenteditable') === 'true') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if it has a role of textbox or searchbox
|
||||
const role = activeElement.getAttribute("role");
|
||||
if (role === "textbox" || role === "searchbox" || role === "combobox") {
|
||||
const role = activeElement.getAttribute('role');
|
||||
if (role === 'textbox' || role === 'searchbox' || role === 'combobox') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if focus is inside an xterm terminal (they use a hidden textarea)
|
||||
const xtermContainer = activeElement.closest(".xterm");
|
||||
const xtermContainer = activeElement.closest('.xterm');
|
||||
if (xtermContainer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Also check if any parent has data-terminal-container attribute
|
||||
const terminalContainer = activeElement.closest("[data-terminal-container]");
|
||||
const terminalContainer = activeElement.closest('[data-terminal-container]');
|
||||
if (terminalContainer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for autocomplete/typeahead dropdowns being open
|
||||
const autocompleteList = document.querySelector(
|
||||
'[data-testid="category-autocomplete-list"]'
|
||||
);
|
||||
const autocompleteList = document.querySelector('[data-testid="category-autocomplete-list"]');
|
||||
if (autocompleteList) {
|
||||
return true;
|
||||
}
|
||||
@@ -60,9 +57,7 @@ function isInputFocused(): boolean {
|
||||
}
|
||||
|
||||
// Check for project picker dropdown being open
|
||||
const projectPickerDropdown = document.querySelector(
|
||||
'[data-testid="project-picker-dropdown"]'
|
||||
);
|
||||
const projectPickerDropdown = document.querySelector('[data-testid="project-picker-dropdown"]');
|
||||
if (projectPickerDropdown) {
|
||||
return true;
|
||||
}
|
||||
@@ -96,38 +91,38 @@ function keyToCode(key: string): string {
|
||||
|
||||
// Special key mappings
|
||||
const specialMappings: Record<string, string> = {
|
||||
"`": "Backquote",
|
||||
"~": "Backquote",
|
||||
"-": "Minus",
|
||||
"_": "Minus",
|
||||
"=": "Equal",
|
||||
"+": "Equal",
|
||||
"[": "BracketLeft",
|
||||
"{": "BracketLeft",
|
||||
"]": "BracketRight",
|
||||
"}": "BracketRight",
|
||||
"\\": "Backslash",
|
||||
"|": "Backslash",
|
||||
";": "Semicolon",
|
||||
":": "Semicolon",
|
||||
"'": "Quote",
|
||||
'"': "Quote",
|
||||
",": "Comma",
|
||||
"<": "Comma",
|
||||
".": "Period",
|
||||
">": "Period",
|
||||
"/": "Slash",
|
||||
"?": "Slash",
|
||||
" ": "Space",
|
||||
"Enter": "Enter",
|
||||
"Tab": "Tab",
|
||||
"Escape": "Escape",
|
||||
"Backspace": "Backspace",
|
||||
"Delete": "Delete",
|
||||
"ArrowUp": "ArrowUp",
|
||||
"ArrowDown": "ArrowDown",
|
||||
"ArrowLeft": "ArrowLeft",
|
||||
"ArrowRight": "ArrowRight",
|
||||
'`': 'Backquote',
|
||||
'~': 'Backquote',
|
||||
'-': 'Minus',
|
||||
_: 'Minus',
|
||||
'=': 'Equal',
|
||||
'+': 'Equal',
|
||||
'[': 'BracketLeft',
|
||||
'{': 'BracketLeft',
|
||||
']': 'BracketRight',
|
||||
'}': 'BracketRight',
|
||||
'\\': 'Backslash',
|
||||
'|': 'Backslash',
|
||||
';': 'Semicolon',
|
||||
':': 'Semicolon',
|
||||
"'": 'Quote',
|
||||
'"': 'Quote',
|
||||
',': 'Comma',
|
||||
'<': 'Comma',
|
||||
'.': 'Period',
|
||||
'>': 'Period',
|
||||
'/': 'Slash',
|
||||
'?': 'Slash',
|
||||
' ': 'Space',
|
||||
Enter: 'Enter',
|
||||
Tab: 'Tab',
|
||||
Escape: 'Escape',
|
||||
Backspace: 'Backspace',
|
||||
Delete: 'Delete',
|
||||
ArrowUp: 'ArrowUp',
|
||||
ArrowDown: 'ArrowDown',
|
||||
ArrowLeft: 'ArrowLeft',
|
||||
ArrowRight: 'ArrowRight',
|
||||
};
|
||||
|
||||
return specialMappings[key] || specialMappings[upperKey] || key;
|
||||
@@ -221,9 +216,7 @@ export function useKeyboardShortcuts(shortcuts: KeyboardShortcut[]) {
|
||||
}
|
||||
|
||||
// Find matching shortcut
|
||||
const matchingShortcut = shortcuts.find(
|
||||
(shortcut) => matchesShortcut(event, shortcut.key)
|
||||
);
|
||||
const matchingShortcut = shortcuts.find((shortcut) => matchesShortcut(event, shortcut.key));
|
||||
|
||||
if (matchingShortcut) {
|
||||
event.preventDefault();
|
||||
@@ -234,9 +227,9 @@ export function useKeyboardShortcuts(shortcuts: KeyboardShortcut[]) {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener("keydown", handleKeyDown);
|
||||
window.addEventListener('keydown', handleKeyDown);
|
||||
return () => {
|
||||
window.removeEventListener("keydown", handleKeyDown);
|
||||
window.removeEventListener('keydown', handleKeyDown);
|
||||
};
|
||||
}, [handleKeyDown]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user