config: add wiki links

main wiki link included with "about" and "user profiles". Sections with
a relevant page have a linked button next to their title when clicked.
Behaviour added by the "wiki_link" field in the "meta" section of a
config "section".
This commit is contained in:
Harvey Tindall
2024-08-10 20:19:38 +01:00
parent 69569e556a
commit 3a0f61e324
7 changed files with 50 additions and 26 deletions
+13 -2
View File
@@ -19,6 +19,7 @@ interface Meta {
advanced?: boolean;
depends_true?: string;
depends_false?: string;
wiki_link?: string;
}
interface Setting {
@@ -31,6 +32,7 @@ interface Setting {
value: string | boolean | number;
depends_true?: string;
depends_false?: string;
wiki_link?: string;
asElement: () => HTMLElement;
update: (s: Setting) => void;
@@ -555,10 +557,19 @@ class sectionPanel {
this._section = document.createElement("div") as HTMLDivElement;
this._section.classList.add("settings-section", "unfocused");
this._section.setAttribute("data-section", sectionName);
this._section.innerHTML = `
<span class="heading">${s.meta.name}</span>
let innerHTML = `
<div class="flex flex-row justify-between">
<span class="heading">${s.meta.name}</span>
`;
if (s.meta.wiki_link) {
innerHTML += `<a class="button ~urge dark:~d_info @low justify-center" target="_blank" href="${s.meta.wiki_link}" title="${window.lang.strings("wiki")}"><i class="ri-book-shelf-line"></i></a>`;
}
innerHTML += `
</div>
<p class="support lg my-2 settings-section-description">${s.meta.description}</p>
`;
this._section.innerHTML = innerHTML;
this.update(s);
}