[BUG] fix double click to open app
This commit is contained in:
@@ -3,25 +3,22 @@ class AppMenu extends Shadow {
|
||||
|
||||
onNewSelection() {
|
||||
this.$$("img").forEach((image) => {
|
||||
image.style.background = ""
|
||||
image.style.outline = ""
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
console.log("rendering")
|
||||
HStack(() => {
|
||||
img("/_/icons/Column.svg", "1.5em", "1.5em")
|
||||
.attr({app: "forum"})
|
||||
.padding(0.5, em)
|
||||
.borderRadius(10, px)
|
||||
.background(global.currentApp === "Dashboard" ? "var(--accent)" : "transparent")
|
||||
.outline(global.currentApp() === "Dashboard" ? "1px solid black" : "none")
|
||||
.onClick((finished, e) => {
|
||||
if(finished) {
|
||||
this.onNewSelection()
|
||||
}
|
||||
e.target.style.background = "var(--accent)"
|
||||
if(finished) {
|
||||
window.navigateTo("/dashboard")
|
||||
e.target.style.outline = "1px solid black"
|
||||
global.openApp("Dashboard")
|
||||
}
|
||||
})
|
||||
|
||||
@@ -29,26 +26,24 @@ class AppMenu extends Shadow {
|
||||
.attr({app: "messages"})
|
||||
.padding(0.5, em)
|
||||
.borderRadius(10, px)
|
||||
.background(global.currentApp === "Messages" ? "rgb(112 150 114)" : "transparent")
|
||||
.outline(global.currentApp() === "Messages" ? "1px solid black" : "none")
|
||||
.onClick((finished, e) => {
|
||||
if(finished) {
|
||||
this.onNewSelection()
|
||||
}
|
||||
if(finished) {
|
||||
window.navigateTo("/messages")
|
||||
e.target.style.outline = "1px solid black"
|
||||
global.openApp("Messages")
|
||||
}
|
||||
})
|
||||
img("/_/icons/people.svg", "1.5em", "1.5em")
|
||||
.attr({app: "people"})
|
||||
.padding(0.5, em)
|
||||
.borderRadius(10, px)
|
||||
.background(global.currentApp === "People" ? "#9392bb" : "transparent")
|
||||
.outline(global.currentApp() === "People" ? "1px solid black" : "none")
|
||||
.onClick((finished, e) => {
|
||||
if(finished) {
|
||||
this.onNewSelection()
|
||||
}
|
||||
if(finished) {
|
||||
window.navigateTo(`/people`)
|
||||
e.target.style.outline = "1px solid black"
|
||||
global.openApp("People")
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
32
src/components/AppWindow.js
Normal file
32
src/components/AppWindow.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import "../apps/Forum/Forum.js"
|
||||
import "../apps/Messages/Messages.js"
|
||||
import "../apps/Jobs/Jobs.js"
|
||||
import "../apps/People/People.js"
|
||||
|
||||
class AppWindow extends Shadow {
|
||||
render() {
|
||||
ZStack(() => {
|
||||
let app = global.currentApp()
|
||||
switch(app) {
|
||||
case "Dashboard":
|
||||
Forum()
|
||||
break;
|
||||
|
||||
case "Messages":
|
||||
Messages()
|
||||
break;
|
||||
|
||||
case "People":
|
||||
People()
|
||||
break;
|
||||
}
|
||||
})
|
||||
.height(100, pct)
|
||||
.display("flex")
|
||||
.onNavigate(() => {
|
||||
this.rerender()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
register(AppWindow)
|
||||
Reference in New Issue
Block a user