rebranding to forum, adding settings and stripe page
This commit is contained in:
42
ui/desktop/apps/Settings/Settings.js
Normal file
42
ui/desktop/apps/Settings/Settings.js
Normal file
@@ -0,0 +1,42 @@
|
||||
import env from "/_/code/env.js"
|
||||
|
||||
class Settings extends Shadow {
|
||||
|
||||
handleConnectStripe = () => {
|
||||
const params = new URLSearchParams({
|
||||
response_type: 'code',
|
||||
client_id: env.client_id,
|
||||
scope: 'read_write',
|
||||
redirect_uri: `${env.baseURL}/stripe/onboardingcomplete`,
|
||||
});
|
||||
|
||||
window.location.href = `https://connect.stripe.com/oauth/authorize?${params}`;
|
||||
};
|
||||
|
||||
render() {
|
||||
ZStack(() => {
|
||||
h1("Settings")
|
||||
.fontWeight("bold")
|
||||
.marginTop(4, pct)
|
||||
.marginLeft(5, pct)
|
||||
|
||||
VStack(() => {
|
||||
HStack(() => {
|
||||
p("Stripe Integration")
|
||||
button("Set up Stripe")
|
||||
.maxWidth(10, em)
|
||||
.onClick((done) => {
|
||||
this.handleConnectStripe()
|
||||
})
|
||||
})
|
||||
.gap(10, pct)
|
||||
.verticalAlign("center")
|
||||
})
|
||||
.gap(0.5, em)
|
||||
.paddingLeft(5, pct)
|
||||
.marginTop(4, em)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
register(Settings)
|
||||
@@ -2,7 +2,8 @@ class AppMenu extends Shadow {
|
||||
|
||||
images = {
|
||||
"Dashboard": {src: "house-src", size: "1.5em"},
|
||||
"People": {src: "people-src", size: "1.7em"}
|
||||
"People": {src: "people-src", size: "1.7em"},
|
||||
"Settings": {src: "settings-src", size: "1.7em"}
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import "../apps/Messages/Messages.js"
|
||||
import "../apps/Market/Market.js"
|
||||
import "../apps/Jobs/Jobs.js"
|
||||
import "../apps/People/People.js"
|
||||
import "../apps/Settings/Settings.js"
|
||||
|
||||
class AppWindow extends Shadow {
|
||||
|
||||
@@ -29,6 +30,9 @@ class AppWindow extends Shadow {
|
||||
case "People":
|
||||
People()
|
||||
break;
|
||||
case "Settings":
|
||||
Settings()
|
||||
break;
|
||||
}
|
||||
})
|
||||
.overflow("scroll")
|
||||
|
||||
@@ -17,7 +17,7 @@ class Sidebar extends Shadow {
|
||||
VStack(() => {
|
||||
let selected = window.location.pathname.startsWith("/my")
|
||||
|
||||
img(document.documentElement.classList.contains("red") ? "/_/icons/quillblack.svg" : "/_/icons/quill.svg", "2.5em", "2.5em")
|
||||
img(document.documentElement.classList.contains("red") ? "/_/icons/column.svg" : "/_/icons/columnred.svg", "2.5em", "2.5em")
|
||||
.marginTop(6, vh)
|
||||
.marginBottom(2, vh)
|
||||
.attr({selected: selected ? "" : null})
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Parchment</title>
|
||||
<title>Forum</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="/_/icons/quill.svg">
|
||||
<link rel="icon" href="/_/icons/columnred.svg">
|
||||
<link rel="stylesheet" href="/_/code/shared.css">
|
||||
<script>
|
||||
if(localStorage.getItem("theme")) {
|
||||
|
||||
@@ -28,6 +28,18 @@ let Global = class {
|
||||
}
|
||||
|
||||
onNavigate = async () => {
|
||||
console.log("onnavigate", this.getFirstPathSegment())
|
||||
if(this.getFirstPathSegment() === "stripe") {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const code = params.get("code");
|
||||
|
||||
if (code) {
|
||||
// send this code to your backend
|
||||
console.log("success!: ", code)
|
||||
} else {
|
||||
throw new Error("Stripe code is not present!")
|
||||
}
|
||||
}
|
||||
|
||||
let selectedNetwork = this.networkFromPath()
|
||||
let selectedApp = this.appFromPath()
|
||||
@@ -71,7 +83,7 @@ let Global = class {
|
||||
window.dispatchEvent(event)
|
||||
}
|
||||
|
||||
document.title = (this.currentNetwork === this.profile) ? "Parchment" : `${this.currentNetwork.abbreviation} | Parchment`
|
||||
document.title = (this.currentNetwork === this.profile) ? "Forum" : `${this.currentNetwork.abbreviation} | Forum`
|
||||
}
|
||||
|
||||
setCurrentNetworkAndApp() {
|
||||
@@ -89,9 +101,12 @@ let Global = class {
|
||||
return defaultNetwork.apps[0].toLowerCase()
|
||||
}
|
||||
|
||||
getFirstPathSegment() {
|
||||
return window.location.pathname.split('/').filter(Boolean)[0] || '';
|
||||
}
|
||||
|
||||
networkFromPath = function () {
|
||||
const pathname = window.location.pathname;
|
||||
const firstSegment = pathname.split('/').filter(Boolean)[0] || '';
|
||||
const firstSegment = this.getFirstPathSegment()
|
||||
if(firstSegment === "my") {
|
||||
return this.profile
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user