aboutsummaryrefslogtreecommitdiff
path: root/src/app/browser.js
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 /src/app/browser.js
parent9ceb136cc6fbc2fcc0d3305da207de4afc7580fc (diff)
downloadViper-8747588222f1bd434af802262b1479ef5b606097.tar.gz
Viper-8747588222f1bd434af802262b1479ef5b606097.zip
actually loads thunderstore now
Diffstat (limited to 'src/app/browser.js')
-rw-r--r--src/app/browser.js47
1 files changed, 33 insertions, 14 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>
`