aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/index.html2
-rw-r--r--src/app/main.css3
-rw-r--r--src/app/main.js20
3 files changed, 23 insertions, 2 deletions
diff --git a/src/app/index.html b/src/app/index.html
index 426b4c5..dc65d67 100644
--- a/src/app/index.html
+++ b/src/app/index.html
@@ -6,7 +6,7 @@
<body>
<div class="lines">
<div class="line">
- <div class="text">%%gui.welcome%%</div>
+ <div class="text" id="welcome">%%gui.welcome%%</div>
<div class="buttons">
<button id="exit" onclick="exit()">%%gui.exit%%</button>
<button id="update" onclick="update()">%%gui.update%%</button>
diff --git a/src/app/main.css b/src/app/main.css
index f49cc98..b668f55 100644
--- a/src/app/main.css
+++ b/src/app/main.css
@@ -1,4 +1,5 @@
:root {
+ --disabled: #656E7F;
--background: #4C515B;
--foreground: #DDE2EB;
--btnforeground: var(--foreground);
@@ -64,7 +65,9 @@ button:active {
transform: scale(0.95);
}
+
#update {background: #81A1C1}
#setpath {background: #5E81AC}
#northstar {background: #C7777F}
#vanilla, #exit {background: #656E7F}
+button:disabled {background: var(--disabled) !important; opacity: 0.5}
diff --git a/src/app/main.js b/src/app/main.js
index 9bafaa5..809b5c8 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -20,7 +20,7 @@ if (fs.existsSync("viper.json")) {
settings = {...settings, ...JSON.parse(fs.readFileSync("viper.json", "utf8"))};
settings.zip = path.join(settings.gamepath + "/northstar.zip");
} else {
- alert(lang("gui.missinggamepath"));
+ alert(lang("general.missinggamepath"));
setpath();
}
@@ -31,10 +31,28 @@ function setpath() {ipcRenderer.send("setpath")}
function launch() {ipcRenderer.send("launch")}
function launchVanilla() {ipcRenderer.send("launchVanilla")}
+function log(msg) {
+ console.log(msg);
+ welcome.innerHTML = msg;
+}
+
+function setButtons(state) {
+ let buttons = document.querySelectorAll("button");
+
+ for (let i = 0; i < buttons.length; i++) {
+ buttons[i].disabled = !state;
+ }
+}
+
+ipcRenderer.on("ns-updated", () => {setButtons(true)})
+ipcRenderer.on("ns-updating", () => {setButtons(false)})
+
ipcRenderer.on("newpath", (event, newpath) => {
settings.gamepath = newpath;
})
+ipcRenderer.on("log", (event, msg) => {log(msg)})
+
setlang();
setInterval(() => {
ipcRenderer.send("setsize", document.querySelector(".lines").offsetHeight + 20);