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