fix(options): align shortcuts and show autosave status

This commit is contained in:
2026-07-26 11:14:55 -04:00
parent a02b7b57f7
commit 0afb56abe0
3 changed files with 22 additions and 9 deletions
+15 -5
View File
@@ -322,7 +322,7 @@ label em {
.shortcut-row {
display: grid;
grid-template-columns: minmax(0, 1fr) 120px 120px;
grid-template-columns: minmax(0, 1fr) 120px 120px 38px;
gap: 12px;
align-items: center;
padding: 10px 0;
@@ -334,10 +334,6 @@ label em {
border-top: 0;
}
.shortcut-row.customs {
grid-template-columns: minmax(0, 1fr) 120px 120px 38px;
}
.shortcut-label {
color: var(--text);
font-weight: 500;
@@ -1061,6 +1057,20 @@ button.lucide-result-tile.lucide-picked {
font-weight: 500;
}
#status:not(:empty) {
position: fixed;
right: 20px;
bottom: 20px;
z-index: 1000;
min-height: 0;
margin: 0;
padding: 10px 14px;
border: 1px solid var(--border-strong);
border-radius: 999px;
background: var(--panel);
box-shadow: 0 8px 24px rgba(17, 24, 39, 0.16);
}
#status:empty {
display: none;
}
+6 -4
View File
@@ -165,6 +165,7 @@ function createDefaultBinding(action, code, value) {
var tcDefaults = vscGetSettingsDefaults();
var optionsSyncSettingsLoaded = false;
var autoSaveTimer = null;
var saveStatusTimer = null;
function scheduleAutoSave() {
if (!optionsSyncSettingsLoaded) return;
@@ -179,7 +180,7 @@ function scheduleAutoSave() {
return;
}
autoSaveTimer = null;
save_options();
save_options(true);
}, 300);
autoSaveTimer = scheduledTimer;
}
@@ -807,8 +808,9 @@ function validate() {
return valid;
}
function save_options() {
function save_options(isAutoSave) {
clearTimeout(autoSaveTimer);
clearTimeout(saveStatusTimer);
autoSaveTimer = null;
var status = document.getElementById("status");
if (!optionsSyncSettingsLoaded) {
@@ -1121,8 +1123,8 @@ function save_options() {
status.textContent = "Error: Unable to save options - " + error.message;
return;
}
status.textContent = "Options saved";
setTimeout(function () {
status.textContent = isAutoSave === true ? "Auto-saved" : "Options saved";
saveStatusTimer = setTimeout(function () {
status.textContent = "";
}, 1000);
});
+1
View File
@@ -81,6 +81,7 @@ describe("options.js", () => {
await vi.advanceTimersByTimeAsync(300);
expect(chrome.storage.sync._dump().rememberSpeed).toBe(true);
expect(document.getElementById("status").textContent).toBe("Auto-saved");
});
it("does not partially save options when a required site shortcut is invalid", async () => {