Displaying location info from websocket

This commit is contained in:
metacryst
2025-10-31 21:54:57 -05:00
parent 152faaecee
commit 620d50cad7
9 changed files with 222 additions and 6 deletions

View File

@@ -1,11 +1,19 @@
import "./LocationList.js"
class Home extends Shadow {
render() {
ZStack(() => {
p("BLOCKCATCHER")
.x(2, em).y(1, em)
.fontSize(1.2, em)
.fontFamily("Arial")
LocationList()
})
.backgroundColor("#aebdff")
.display("block")
.width(100, vw).height(100, vh)
.color("#60759f")
}
}

View File

@@ -0,0 +1,26 @@
class LocationList extends Shadow {
list = []
render() {
VStack(() => {
this.list.forEach((update) => {
console.log(update.name)
HStack(() => {
p(update.timestamp)
p(update.name)
p(update.latitude)
p(update.longitude)
})
.gap(1, em)
})
})
.onEvent("update-location", (e) => {
console.log("location received: ", e.detail)
this.list.unshift(e.detail)
this.rerender()
})
.x(2, em).y(5, em)
}
}
window.registerShadow(LocationList)