diff --git a/.gitignore b/.gitignore index 2c338e6..e23b00e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ package-lock.json node_modules .env -db/db.json \ No newline at end of file +db/db.json +ui/_/code/env.js \ No newline at end of file diff --git a/db/networks/comalyr/db.json b/db/networks/comalyr/db.json new file mode 100644 index 0000000..e69de29 diff --git a/server/db/db.js b/server/db/db.js index b90a78b..ebde400 100644 --- a/server/db/db.js +++ b/server/db/db.js @@ -1,7 +1,7 @@ import fs from 'fs/promises'; import chalk from 'chalk'; import path from 'path'; -import {nodeModels, edgeModels} from './model/import.js' +import { nodeModels, edgeModels } from './model/import.js' import Edge from "./model/edge.js" import { fileURLToPath } from "url" const __dirname = path.dirname(fileURLToPath(import.meta.url)) diff --git a/server/ws/ws.js b/server/ws/ws.js index d5ac2fd..b280438 100644 --- a/server/ws/ws.js +++ b/server/ws/ws.js @@ -46,7 +46,12 @@ export default class Socket { const cookies = parseCookies(req.headers.cookie); const token = cookies.auth_token; if (!token) throw new Error("No auth token"); - const payload = jwt.verify(token, process.env.JWT_SECRET); + let payload; + try { + payload = jwt.verify(token, process.env.JWT_SECRET); + } catch(e) { + console.error("error: jwt is expired ", e) + } ws.userEmail = payload.email; ws.on('message', (msg) => { diff --git a/ui/_/code/shared.css b/ui/_/code/shared.css index 4eb9571..fe97d86 100644 --- a/ui/_/code/shared.css +++ b/ui/_/code/shared.css @@ -18,6 +18,7 @@ --nodes-src: /_/icons/nodes.svg; --forum-src: /_/icons/forum.svg; --people-src: /_/icons/people.svg; + --settings-src: /_/icons/settings.svg; } :root.dark { @@ -30,6 +31,7 @@ --nodes-src: /_/icons/nodesdark.svg; --forum-src: /_/icons/forumdark.svg; --people-src: /_/icons/peopledark.svg; + --settings-src: /_/icons/settingsdark.svg; } :root.red { diff --git a/ui/_/icons/Column.svg b/ui/_/icons/Column.svg index ab79e11..e4bdbdf 100644 --- a/ui/_/icons/Column.svg +++ b/ui/_/icons/Column.svg @@ -1,4 +1,9 @@ - - - + + + + + + + + diff --git a/ui/_/icons/columnnew.svg b/ui/_/icons/columnnew.svg new file mode 100644 index 0000000..d7a9037 --- /dev/null +++ b/ui/_/icons/columnnew.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ui/_/icons/columnnewbig.png b/ui/_/icons/columnnewbig.png new file mode 100644 index 0000000..eae44d0 Binary files /dev/null and b/ui/_/icons/columnnewbig.png differ diff --git a/ui/_/icons/columnnewsmall.png b/ui/_/icons/columnnewsmall.png new file mode 100644 index 0000000..eb80d81 Binary files /dev/null and b/ui/_/icons/columnnewsmall.png differ diff --git a/ui/_/icons/columnred.svg b/ui/_/icons/columnred.svg new file mode 100644 index 0000000..475331d --- /dev/null +++ b/ui/_/icons/columnred.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ui/_/icons/settings.svg b/ui/_/icons/settings.svg new file mode 100644 index 0000000..73807d5 --- /dev/null +++ b/ui/_/icons/settings.svg @@ -0,0 +1,3 @@ + + + diff --git a/ui/_/icons/settingsdark.svg b/ui/_/icons/settingsdark.svg new file mode 100644 index 0000000..a5f9e01 --- /dev/null +++ b/ui/_/icons/settingsdark.svg @@ -0,0 +1,3 @@ + + + diff --git a/ui/desktop/apps/Settings/Settings.js b/ui/desktop/apps/Settings/Settings.js new file mode 100644 index 0000000..e6ca655 --- /dev/null +++ b/ui/desktop/apps/Settings/Settings.js @@ -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) \ No newline at end of file diff --git a/ui/desktop/components/AppMenu.js b/ui/desktop/components/AppMenu.js index 0e22b5a..88dd99a 100644 --- a/ui/desktop/components/AppMenu.js +++ b/ui/desktop/components/AppMenu.js @@ -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() { diff --git a/ui/desktop/components/AppWindow.js b/ui/desktop/components/AppWindow.js index 61d71c5..f59709f 100644 --- a/ui/desktop/components/AppWindow.js +++ b/ui/desktop/components/AppWindow.js @@ -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") diff --git a/ui/desktop/components/Sidebar.js b/ui/desktop/components/Sidebar.js index 233d533..1086309 100644 --- a/ui/desktop/components/Sidebar.js +++ b/ui/desktop/components/Sidebar.js @@ -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}) diff --git a/ui/desktop/index.html b/ui/desktop/index.html index 94be050..ec7f25a 100644 --- a/ui/desktop/index.html +++ b/ui/desktop/index.html @@ -1,9 +1,9 @@ - Parchment + Forum - +