Hotkey labels

This commit is contained in:
Gregory Schier
2024-01-08 15:57:21 -08:00
parent 793bff9f27
commit d5855c45a6
5 changed files with 42 additions and 30 deletions

View File

@@ -90,7 +90,28 @@ export function useAnyHotkey(
window.removeEventListener('keydown', down);
window.removeEventListener('keyup', up);
};
}, [os]);
}, [options.enable, os]);
}
export function useHotKeyLabel(action: HotkeyAction | null): string {
switch (action) {
case 'request.send':
return 'Send Request';
case 'request.create':
return 'New Request';
case 'request.duplicate':
return 'Duplicate Request';
case 'sidebar.toggle':
return 'Toggle Sidebar';
case 'sidebar.focus':
return 'Focus Sidebar';
case 'urlBar.focus':
return 'Focus URL';
case 'environmentEditor.toggle':
return 'Edit Environments';
default:
return 'Unknown';
}
}
export function useFormattedHotkey(action: HotkeyAction | null): string | null {