Skip to content

Commit aa6beac

Browse files
committed
feat: add hint for navigating back to history using comma key
1 parent 746b094 commit aa6beac

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/renderer/pages/Settings.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ body.opaque .settings {
7575
letter-spacing: -0.02em;
7676
}
7777

78+
.settings-hint {
79+
margin-left: auto;
80+
font-size: 0.75rem;
81+
color: rgba(255, 255, 255, 0.5);
82+
}
83+
7884
.back-btn {
7985
background: rgba(255, 255, 255, 0.08);
8086
border: 1px solid rgba(255, 255, 255, 0.12);

src/renderer/pages/Settings.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ export default function Settings({
9292
}
9393
}, [isRecordingShortcut, handleKeyDown]);
9494

95+
// Handle comma key to go back to history
96+
useEffect(() => {
97+
const handleGlobalKeyDown = (e: KeyboardEvent) => {
98+
// Don't handle if recording shortcut or editing API key
99+
if (isRecordingShortcut || isEditingApiKey) return;
100+
101+
if (e.key === ",") {
102+
e.preventDefault();
103+
window.electronAPI.navigate("history");
104+
}
105+
};
106+
107+
window.addEventListener("keydown", handleGlobalKeyDown);
108+
return () => window.removeEventListener("keydown", handleGlobalKeyDown);
109+
}, [isRecordingShortcut, isEditingApiKey]);
110+
95111
const handleTransparencyChange = (value: boolean) => {
96112
onTransparencyChange(value);
97113
window.electronAPI.setTransparency(value);
@@ -172,6 +188,7 @@ export default function Settings({
172188
<div className="settings">
173189
<header className="settings-header">
174190
<h1>Settings</h1>
191+
<p className="settings-hint">Press , to go back</p>
175192
</header>
176193
<main className="settings-content">
177194
<div className="setting-group">

0 commit comments

Comments
 (0)