aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-01-21 01:23:50 +0100
committer0neGal <mail@0negal.com>2022-01-21 01:23:50 +0100
commit8747588222f1bd434af802262b1479ef5b606097 (patch)
tree281faabfeb1c6d66eadcbd42470818ebdfc4de5d
parent9ceb136cc6fbc2fcc0d3305da207de4afc7580fc (diff)
downloadViper-8747588222f1bd434af802262b1479ef5b606097.tar.gz
Viper-8747588222f1bd434af802262b1479ef5b606097.zip
actually loads thunderstore now
-rw-r--r--src/app/browser.js47
-rw-r--r--src/app/index.html2
-rw-r--r--src/app/main.css7
3 files changed, 40 insertions, 16 deletions
diff --git a/src/app/browser.js b/src/app/browser.js
index ae3e453..50cabfe 100644
--- a/src/app/browser.js
+++ b/src/app/browser.js
@@ -1,22 +1,39 @@
-function Browser(state) {
- if (state) {
- overlay.classList.add("shown")
- browser.classList.add("shown")
- return
- } else if (! state) {
- if (state != undefined) {
- overlay.classList.remove("shown")
- browser.classList.remove("shown")
+var Browser = {
+ toggle: (state) => {
+ if (state) {
+ overlay.classList.add("shown")
+ browser.classList.add("shown")
return
+ } else if (! state) {
+ if (state != undefined) {
+ overlay.classList.remove("shown")
+ browser.classList.remove("shown")
+ return
+ }
}
- }
- overlay.classList.toggle("shown")
- browser.classList.toggle("shown")
-};Browser()
+ overlay.classList.toggle("shown")
+ browser.classList.toggle("shown")
+ },
+ loadfront: async () => {
+ let packages = await (await fetch("https://northstar.thunderstore.io/api/v1/package/")).json();
+
+ for (let i in packages) {
+ let pkg = {...packages[i], ...packages[i].versions[0]};
+
+ new BrowserEl({
+ title: pkg.name,
+ image: pkg.icon,
+ author: pkg.owner,
+ description: pkg.description
+ })
+ }
+ }
+}; Browser.toggle()
+Browser.loadfront()
document.body.addEventListener("keyup", (e) => {
- if (e.key == "Escape") {Browser(false)}
+ if (e.key == "Escape") {Browser.toggle(false)}
})
function BrowserEl(properties) {
@@ -36,6 +53,8 @@ function BrowserEl(properties) {
<div class="text">
<div class="title">${properties.title}</div>
<div class="description">${properties.description} - by ${properties.author}</div>
+ <button>Install</button>
+ <button>Info</button>
</div>
</div>
`
diff --git a/src/app/index.html b/src/app/index.html
index 0866816..131ec38 100644
--- a/src/app/index.html
+++ b/src/app/index.html
@@ -13,7 +13,7 @@
<div id="close" onclick="ipcRenderer.send('exit')"></div>
</div>
- <div id="overlay" onclick="Browser()"></div>
+ <div id="overlay" onclick="Browser.toggle(false)"></div>
<div id="browser">
<input id="search" placeholder="Search...">
</div>
diff --git a/src/app/main.css b/src/app/main.css
index d3d3b72..3c406ee 100644
--- a/src/app/main.css
+++ b/src/app/main.css
@@ -75,7 +75,7 @@
#browser .el, #browser #search {
--spacing: calc(var(--padding) / 2);
- --height: calc(var(--padding) * 2.5);
+ --height: calc(var(--padding) * 3);
color: white;
display: flex;
@@ -100,10 +100,15 @@
width: var(--height);
height: var(--height);
margin-right: var(--spacing);
+ border-radius: var(--spacing);
}
#browser .el .title {font-size: 1.2em}
#browser .el .description {font-size: 0.8em}
+#browser .el button {
+ background: var(--blue);
+ margin-top: var(--spacing);
+}
#winbtns {
z-index: 2;