diff options
author | 0neGal <mail@0negal.com> | 2021-12-30 19:19:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-30 19:19:16 +0100 |
commit | d2e72c40b251373fd662cab426fc04dcac1eb65a (patch) | |
tree | 6a85ad219a06c9814f00cd15d96d1171b997f623 /src/app | |
parent | 4a0ce8d918007a3ed39bd15c28fc1c7931080271 (diff) | |
parent | 9d8ceea77b6f172f0c055c0061bc07e6f45c0d2d (diff) | |
download | Viper-d2e72c40b251373fd662cab426fc04dcac1eb65a.tar.gz Viper-d2e72c40b251373fd662cab426fc04dcac1eb65a.zip |
Merge branch 'main' into feat/version-indicator
Diffstat (limited to 'src/app')
-rw-r--r-- | src/app/index.html | 2 | ||||
-rw-r--r-- | src/app/main.css | 15 | ||||
-rw-r--r-- | src/app/main.js | 23 |
3 files changed, 30 insertions, 10 deletions
diff --git a/src/app/index.html b/src/app/index.html index 80f7701..f5d92e0 100644 --- a/src/app/index.html +++ b/src/app/index.html @@ -7,7 +7,7 @@ <div class="lines"> <div class="line"> <div class="text"> - <div>%%gui.welcome%%</div> + <div class="text" id="welcome">%%gui.welcome%%</div> <div class="versions"> <div id="vpversion"></div> <div id="nsversion"></div> diff --git a/src/app/main.css b/src/app/main.css index cd6c001..aa36c5b 100644 --- a/src/app/main.css +++ b/src/app/main.css @@ -1,4 +1,5 @@ :root { + --disabled: #656E7F; --background: #4C515B; --foreground: #DDE2EB; --subforeground: #AFAFAF; @@ -31,6 +32,12 @@ body, button, input { nobr {white-space: nowrap} +.versions { + height: 15px; + font-size: 12px; + color: var(--subforeground); +} + .line { display: flex; margin-top: 15px; @@ -65,13 +72,9 @@ button:active { transform: scale(0.95); } + #update {background: #81A1C1} #setpath {background: #5E81AC} #northstar {background: #C7777F} #vanilla, #exit {background: #656E7F} - -.versions { - height: 15px; - font-size: 12px; - color: var(--subforeground); -} +button:disabled {background: var(--disabled) !important; opacity: 0.5}
\ No newline at end of file diff --git a/src/app/main.js b/src/app/main.js index 59b28f2..a33ef72 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,15 +31,32 @@ 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)}) + ipcRenderer.on("version", (event, versions) => { vpversion.innerText = lang("gui.versions.viper") + ": " + versions.vp; nsversion.innerText = lang("gui.versions.northstar") + ": " + versions.ns; -}); -ipcRenderer.send("getversion"); +}); ipcRenderer.send("getversion"); setlang(); setInterval(() => { |