aboutsummaryrefslogtreecommitdiff
path: root/src/app/browser.js
diff options
context:
space:
mode:
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>
`