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 +++++++++++++++++++++++++++ src/lang/de.json | 4 ++-- src/lang/en.json | 4 ++-- src/lang/es.json | 4 ++-- src/lang/fr.json | 4 ++-- src/lang/zh.json | 4 ++-- 6 files changed, 37 insertions(+), 10 deletions(-) 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); }); diff --git a/src/lang/de.json b/src/lang/de.json index 21292dd..ee797a1 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -290,8 +290,8 @@ }, "request": { - "no_vp_release_notes": "Viper Release Notes konnten nicht geladen werden.\nVersuche es erneut später!", - "no_ns_release_notes": "Northstar Release Notes konnten nicht geladen werden.\nVersuche es erneut später!" + "no_vp_release_notes": "

Viper Release Notes konnten nicht geladen werden.

Versuche es erneut später!", + "no_ns_release_notes": "

Northstar Release Notes konnten nicht geladen werden.

Versuche es erneut später!" }, "tooltip": { diff --git a/src/lang/en.json b/src/lang/en.json index 2bf2b0e..eca640d 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -290,8 +290,8 @@ }, "request": { - "no_vp_release_notes": "Couldn't fetch Viper release notes.\nTry again later!", - "no_ns_release_notes": "Couldn't fetch Northstar release notes.\nTry again later!" + "no_vp_release_notes": "

Couldn't fetch Viper release notes.

Try again later!", + "no_ns_release_notes": "

Couldn't fetch Northstar release notes.

Try again later!" }, "tooltip": { diff --git a/src/lang/es.json b/src/lang/es.json index c453926..5d3bb27 100644 --- a/src/lang/es.json +++ b/src/lang/es.json @@ -290,8 +290,8 @@ }, "request": { - "no_vp_release_notes": "No se pudo encontrar las notas de lanzamiento de Viper.\n¡Intenta mas tarde!", - "no_ns_release_notes": "No se pudo encontrar las notas de lanzamiento de Northstar.\n¡Intenta mas tarde!" + "no_vp_release_notes": "

No se pudo encontrar las notas de lanzamiento de Viper.

¡Intenta mas tarde!", + "no_ns_release_notes": "

No se pudo encontrar las notas de lanzamiento de Northstar.

¡Intenta mas tarde!" }, "tooltip": { diff --git a/src/lang/fr.json b/src/lang/fr.json index caa785f..b527147 100644 --- a/src/lang/fr.json +++ b/src/lang/fr.json @@ -290,8 +290,8 @@ }, "request": { - "no_vp_release_notes": "Impossible de récupérer les notes de mises à jour de Viper.\nVeuillez réessayer plus tard.", - "no_ns_release_notes": "Impossible de récupérer les notes de mises à jour de Northstar.\nVeuillez réessayer plus tard." + "no_vp_release_notes": "

Impossible de récupérer les notes de mises à jour de Viper.

Veuillez réessayer plus tard.", + "no_ns_release_notes": "

Impossible de récupérer les notes de mises à jour de Northstar.

Veuillez réessayer plus tard." }, "tooltip": { diff --git a/src/lang/zh.json b/src/lang/zh.json index 7d53b44..a1ccd71 100644 --- a/src/lang/zh.json +++ b/src/lang/zh.json @@ -289,8 +289,8 @@ }, "request": { - "no_vp_release_notes": "无法获取Viper的更新日志.\n请稍后再试!", - "no_ns_release_notes": "无法获取Northstar的更新日志.\n请稍后再试!" + "no_vp_release_notes": "

无法获取Viper的更新日志.

请稍后再试!", + "no_ns_release_notes": "

无法获取Northstar的更新日志.

请稍后再试!" }, "tooltip": { -- cgit v1.2.3