adding error handling for signup, moving delete account button in sidebar to bottom
This commit is contained in:
@@ -1 +1 @@
|
||||
VITE_API_URL=
|
||||
VITE_API_URL=https://frm.so
|
||||
@@ -94,10 +94,7 @@ class AuthPage extends Shadow {
|
||||
this.display("none")
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
.attr("id", "content")
|
||||
|
||||
})
|
||||
.attr("selected", "1")
|
||||
.width(100, vw)
|
||||
|
||||
@@ -132,6 +132,7 @@ class Signup extends Shadow {
|
||||
} else {
|
||||
const { error } = await res.json();
|
||||
console.error(error)
|
||||
this.$("p").attr("errormessage", error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import util from "../util.js"
|
||||
|
||||
class AppMenu extends Shadow {
|
||||
selected = ""
|
||||
apps = global.currentNetwork.apps
|
||||
apps = global.currentNetwork.apps.filter(app => (app !== "Settings" && app !== "Website"))
|
||||
darkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
|
||||
getImageURL(appName) {
|
||||
@@ -29,7 +29,7 @@ class AppMenu extends Shadow {
|
||||
|
||||
render() {
|
||||
let apps = this.apps
|
||||
let appCount = apps.filter(app => app !== "Settings").length
|
||||
let appCount = apps.length
|
||||
let horizontalMargin = {
|
||||
1: 50,
|
||||
2: 10,
|
||||
@@ -42,7 +42,6 @@ class AppMenu extends Shadow {
|
||||
|
||||
for(let i = 0; i < apps.length; i++) {
|
||||
let app = apps[i]
|
||||
if (app === "Settings") continue;
|
||||
|
||||
img(this.getImageURL(app), "1.3em")
|
||||
.attr({app: app})
|
||||
|
||||
@@ -18,9 +18,12 @@ class AppWindow extends Shadow {
|
||||
}
|
||||
|
||||
async getCustomApp(app) {
|
||||
if (app == "Dashboard") { app = "Announcements" }
|
||||
await import(`${util.HOST}/apps/${app.toLowerCase()}/${app.toLowerCase()}.js`);
|
||||
this.rerender()
|
||||
if(window[app]) {
|
||||
this.rerender()
|
||||
} else {
|
||||
console.error("Could not get app: ", app)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,19 +10,18 @@ class Sidebar extends Shadow {
|
||||
|
||||
SidebarItem(text) {
|
||||
return p(text)
|
||||
.fontSize(1.5, em)
|
||||
.fontSize(1.2, em)
|
||||
.fontWeight("bold")
|
||||
.color("var(--headertext)")
|
||||
.fontFamily("Arial")
|
||||
.marginLeft(1, em)
|
||||
.marginLeft(3, em)
|
||||
.marginTop(2, em)
|
||||
.onTap(function (done) {
|
||||
if (done) {
|
||||
if (this.innerText === "Logout") {
|
||||
global.onLogout()
|
||||
$("home-").closeSidebar();
|
||||
return
|
||||
} else if (this.innerText === "Delete account") {
|
||||
$("sidebar-").deleteAccount();
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -63,10 +62,21 @@ class Sidebar extends Shadow {
|
||||
if(done)
|
||||
this.openProfile()
|
||||
})
|
||||
.paddingBottom(1, em)
|
||||
|
||||
this.SidebarItem("Logout")
|
||||
this.SidebarItem("Delete account")
|
||||
})
|
||||
|
||||
button("Delete Account")
|
||||
.fontSize(0.9, em)
|
||||
.marginTop("auto")
|
||||
.marginBottom(2, em)
|
||||
.background("var(--darkred)")
|
||||
.paddingVertical(1, em)
|
||||
.border("none")
|
||||
.outline("1px solid var(--divider)")
|
||||
.color("var(--text)")
|
||||
.onTap((done) => this.deleteAccount())
|
||||
})
|
||||
.gap(1, em)
|
||||
.paddingTop(15, vh)
|
||||
.paddingHorizontal(1, em)
|
||||
|
||||
@@ -30,7 +30,7 @@ class TopBar extends Shadow {
|
||||
|
||||
p()
|
||||
.state("app", function () {
|
||||
this.innerText = global.currentApp() === "Dashboard" ? "Announcements" : global.currentApp()
|
||||
this.innerText = global.currentApp()
|
||||
})
|
||||
.color("var(--headertext)")
|
||||
.textAlign("center")
|
||||
|
||||
@@ -12,6 +12,7 @@ let Global = class {
|
||||
profile = null
|
||||
currentNetwork = ""
|
||||
lastApp = ""
|
||||
util = util
|
||||
|
||||
currentApp() {
|
||||
const pathname = window.location.pathname;
|
||||
|
||||
Reference in New Issue
Block a user