From c138bd5400c46fd44834b8152b86a996b67c4a3d Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sat, 30 Nov 2024 04:27:26 +0200 Subject: Fixed settings show --- src/js/arching-kaos-web-ui-settings.js | 51 +++++++++++++++++++++------------- src/js/ui/sections/settingsSection.js | 3 +- 2 files changed, 34 insertions(+), 20 deletions(-) (limited to 'src/js') diff --git a/src/js/arching-kaos-web-ui-settings.js b/src/js/arching-kaos-web-ui-settings.js index c940f31..0435de4 100644 --- a/src/js/arching-kaos-web-ui-settings.js +++ b/src/js/arching-kaos-web-ui-settings.js @@ -157,13 +157,16 @@ function renderAssets(container, value){ function settingPlaceToDOM(key, value){ var container = document.createElement("details"); - container.innerText=key; + var summary = document.createElement("summary"); + console.log("~~KEY: "+key); + summary.innerText=key; + container.appendChild(summary); if ( Array.isArray(value) ){ var ul = document.createElement("select"); value.map((v)=>{ if (v.constructor.name === "Object"){ Object.keys(v).forEach((value)=>{ - makeElement({element:"option", innerText:value + ': ' + v[value], value: value}, ul); + makeElement({element:"option", innerText:`${value}: ${v[value]}`, value: value}, ul); }); } else { makeElement({element:"option", innerText:v, value: v}, ul); @@ -174,25 +177,28 @@ function settingPlaceToDOM(key, value){ console.log("KEY: "+key); switch (key){ case 'ipfs': - makeElement({ element:"summary",innerText:"IPFS" }, container); + makeElement({ element:"h4",innerText:"Gateway" }, container); renderList(container, value.gateway); break; case 'stellar': - makeElement({ element:"summary",innerText:"Asset" }, container); + makeElement({ element:"h4",innerText:"Asset" }, container); renderAssets(container, value.asset); + makeElement({ element:"hr" }, container); - makeElement({ element:"summary",innerText:"Variable Names" }, container); + makeElement({ element:"h4",innerText:"Variable Names" }, container); renderList(container, value.variableNames); + makeElement({ element:"hr" }, container); - makeElement({ element:"summary",innerText:"Horizon" }, container); + makeElement({ element:"h4",innerText:"Horizon" }, container); renderList(container, value.horizon); + makeElement({ element:"hr" }, container); - makeElement({ element:"summary",innerText:"Scan" }, container); + makeElement({ element:"h4",innerText:"Scan" }, container); renderCheck(container, value.scan); break; case 'ak': - makeElement({ element:"summary",innerText:"Connect" }, container); + makeElement({ element:"h4",innerText:"Connect" }, container); renderList(container, value.connect); break; default: @@ -205,17 +211,24 @@ function settingPlaceToDOM(key, value){ getSettingsPage().appendChild(container); } -// settingsKeys.forEach( -// (value) => { -// settingPlaceToDOM(value, settings[value]); -// } -// ); - -/* Small dump as pre text */ -// var predump = document.createElement('pre'); -// predump.innerText = JSON.stringify(settings, null, 2); -// getSettingsPage().appendChild(predump); -/* END of: Small dump as pre text */ +export function showSettings() +{ + for ( var i = 0; i < settingsKeys.length; i++ ) + { + settingPlaceToDOM(settingsKeys[i], settings[settingsKeys[i]]); + } +// settingsKeys.forEach( +// (value) => { +// settingPlaceToDOM(value, settings[value]); +// } +// ); + + /* Small dump as pre text */ + // var predump = document.createElement('pre'); + // predump.innerText = JSON.stringify(settings, null, 2); + // getSettingsPage().appendChild(predump); + /* END of: Small dump as pre text */ +} export function getSettings() { diff --git a/src/js/ui/sections/settingsSection.js b/src/js/ui/sections/settingsSection.js index e6768df..3a0e410 100644 --- a/src/js/ui/sections/settingsSection.js +++ b/src/js/ui/sections/settingsSection.js @@ -1,5 +1,5 @@ import { makeElement } from "../../arching-kaos-generator.js"; -import { getSettings } from "../../arching-kaos-web-ui-settings.js"; +import { getSettings, showSettings } from "../../arching-kaos-web-ui-settings.js"; var settings = getSettings(); console.log(settings); @@ -22,6 +22,7 @@ export function settingsSection() }; makeElement(settingsSection, document.querySelector('.main')); + showSettings(); } export function getSettingsPage() -- cgit v1.2.3