From 6c036186d1a1295604966114f052e61ac4c01253 Mon Sep 17 00:00:00 2001 From: 0neGal Date: Sat, 3 Feb 2024 20:18:36 +0100 Subject: added back error for fetching release notes This time it's inside the GUI and not just random output. --- src/app/js/launcher.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/app/js/launcher.js') diff --git a/src/app/js/launcher.js b/src/app/js/launcher.js index 3130253..1c383b4 100644 --- a/src/app/js/launcher.js +++ b/src/app/js/launcher.js @@ -24,6 +24,8 @@ function page(page) { }; page(1) function formatRelease(notes) { + if (! notes) {return ""} + let content = ""; if (notes.length === 1) { @@ -58,13 +60,38 @@ function formatRelease(notes) { }); } +// sets content of `div` to a single release block with centered text +// inside it, the text being `lang(lang_key)` +let set_error_content = (div, lang_key) => { + div.innerHTML = + "
" + + "

" + + lang(lang_key) + + "

" + + "
"; +} + // Updates the Viper release notes ipcRenderer.on("vp-notes", (event, response) => { + if (! response) { + return set_error_content( + vpReleaseNotes, + "request.no_vp_release_notes" + ) + } + vpReleaseNotes.innerHTML = formatRelease(response); }); // Updates the Northstar release notes ipcRenderer.on("ns-notes", (event, response) => { + if (! response) { + return set_error_content( + nsRelease, + "request.no_ns_release_notes" + ) + } + nsRelease.innerHTML = formatRelease(response); }); -- cgit v1.2.3