settings: remove badge note, add tooltips to them

change required and restart required badges to icons with tooltips, and
removed the note at the top of settings. As a result, the sidebar is
much thinner.
This commit is contained in:
Harvey Tindall
2025-11-25 17:13:43 +00:00
parent 442bdd2220
commit 3178ca7572
4 changed files with 38 additions and 22 deletions

View File

@@ -22,15 +22,17 @@
}
.tooltip.below .content {
top: 2.5rem;
left: 0;
top: calc(100% + 0.125rem);
left: 50%;
right: 0;
transform: translateX(-50%);
}
.tooltip.above .content {
bottom: 2.5rem;
left: 0;
bottom: calc(100% + 0.125rem);
left: 50%;
right: 0;
transform: translateX(-50%);
}
.tooltip.darker .content {

View File

@@ -921,7 +921,6 @@
<input type="search" class="field ~neutral @low input settings-section-button justify-between" id="settings-search" placeholder="{{ .strings.search }}">
<button class="button ~neutral @low center -ml-10 rounded-s-none settings-search-clear" aria-label="{{ .strings.clearSearch }}" text="{{ .strings.clearSearch }}"><i class="ri-close-line"></i></button>
</div>
<aside class="aside sm ~urge dark:~d_info @low" id="settings-message">Note: <span class="badge ~critical">*</span> indicates a required field, <span class="badge ~info dark:~d_warning">R</span> indicates changes require a restart.</aside>
<div id="settings-loader" class="flex flex-row flex-wrap gap-2">
<span class="button ~neutral @low justify-center grow" id="setting-about"><span class="flex">{{ .strings.aboutProgram }} <i class="ri-information-line ml-2"></i></span></span>
<a class="button ~urge dark:~d_info @low justify-center grow" target="_blank" href="https://wiki.jfa-go.com"><span class="flex">{{ .strings.wiki }} <i class="ri-book-shelf-line ml-2"></i></a>

View File

@@ -209,7 +209,9 @@
"backupCanBeFound": "The backup can be found on the server at {filepath}.",
"backupCanDownload": "Alternatively, click below to download the backup.",
"wikiPage": "Wiki Page",
"wiki": "Wiki"
"wiki": "Wiki",
"restartRequired": "Restart required",
"required": "Required"
},
"notifications": {
"pathCopied": "Full path copied to clipboard.",

View File

@@ -74,6 +74,9 @@ const splitDependant = (section: string, dep: string): string[] => {
return parts
};
let RestartRequiredBadge: HTMLElement;
let RequiredBadge: HTMLElement;
class DOMSetting {
protected _hideEl: HTMLElement;
protected _input: HTMLInputElement;
@@ -133,12 +136,10 @@ class DOMSetting {
set required(state: boolean) {
if (state) {
this._required.classList.remove("unfocused");
this._required.classList.add("badge", "~critical");
this._required.textContent = "*";
this._required.innerHTML = RequiredBadge.outerHTML;
} else {
this._required.classList.add("unfocused");
this._required.classList.remove("badge", "~critical");
this._required.textContent = "";
this._required.textContent = ``;
}
}
@@ -146,12 +147,10 @@ class DOMSetting {
set requires_restart(state: boolean) {
if (state) {
this._restart.classList.remove("unfocused");
this._restart.classList.add("badge", "~info", "dark:~d_warning");
this._restart.textContent = "R";
this._restart.innerHTML = RestartRequiredBadge.outerHTML;
} else {
this._restart.classList.add("unfocused");
this._restart.classList.remove("badge", "~info", "dark:~d_warning");
this._restart.textContent = "";
this._restart.textContent = ``;
}
}
@@ -619,7 +618,7 @@ class groupButton {
this._button.innerHTML = `
<span class="group-button-name"></span>
<label>
<i class="icon ri-arrow-down-s-line"></i>
<i class="icon ri-arrow-down-s-line text-xl"></i>
<input class="unfocused" type="checkbox">
</label>
`;
@@ -1072,14 +1071,28 @@ export class settingsList {
this._searchbox.oninput(null);
};
};
// Create (restart)required badges (can't do on load as window.lang is unset)
RestartRequiredBadge = (() => {
const rr = document.createElement("span");
rr.classList.add("tooltip", "below");
rr.innerHTML = `
<span class="badge ~info dark:~d_warning"><i class="icon ri-refresh-line align-baseline h-full"></i></span>
<span class="content sm">${window.lang.strings("restartRequired")}</span>
`;
// What possessed me to put this in the DOMSelect constructor originally? like what????????
const message = document.getElementById("settings-message") as HTMLElement;
message.innerHTML = window.lang.var("strings",
"settingsRequiredOrRestartMessage",
`<span class="badge ~critical">*</span>`,
`<span class="badge ~info dark:~d_warning">R</span>`
);
return rr;
})();
RequiredBadge = (() => {
const r = document.createElement("span");
r.classList.add("tooltip", "below");
r.innerHTML = `
<span class="badge ~critical"><i class="icon ri-asterisk align-baseline h-full"></i></span>
<span class="content sm">${window.lang.strings("required")}</span>
`;
return r;
})();
}
private _addMatrix = () => {