mirror of
https://github.com/SoPat712/Speeder.git
synced 2026-08-19 11:52:31 -04:00
fix(options): align shortcuts and show autosave status
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user