diff --git a/view/src/index.tsx b/view/src/index.tsx index e816ce4..1d59c90 100644 --- a/view/src/index.tsx +++ b/view/src/index.tsx @@ -8,14 +8,16 @@ import "./assets/fonts/fonts.css"; import { Route, Router } from "@solidjs/router"; import RootLayout from "./layouts/RootLayout.tsx"; -import Dashboard from "./pages/dashboard.tsx"; -import Login from "./pages/auth/login.tsx"; +import DashboardPage from "./pages/dashboard.tsx"; +import LoginPage from "./pages/auth/login.tsx"; +import RegisterPage from "./pages/auth/register.tsx"; const root = document.getElementById("root"); render(() => ( - - + + + ), root!); diff --git a/view/src/pages/auth/login.tsx b/view/src/pages/auth/login.tsx index f43c0c0..57f742b 100644 --- a/view/src/pages/auth/login.tsx +++ b/view/src/pages/auth/login.tsx @@ -131,72 +131,78 @@ export default function LoginPage() { return (
-
-
- - - -
- +
+
+
+ - -
handlers[stage()](e)}> - - - - - -
- - {item => - - } - + +
+ -

Choose a way to verify that's you

- - - - - +
+
- - +
handlers[stage()](e)}> + + + + + +
+ + {item => + + } + +
+

Choose a way to verify that's you

+
+ + + +
+ + +
+
+
+ +
diff --git a/view/src/pages/auth/register.tsx b/view/src/pages/auth/register.tsx index 5ccb62d..57cbd31 100644 --- a/view/src/pages/auth/register.tsx +++ b/view/src/pages/auth/register.tsx @@ -1,3 +1,116 @@ -export default function RegisterPage() { +import { createSignal, Show } from "solid-js"; +export default function RegisterPage() { + const [title, setTitle] = createSignal("Create an account"); + const [subtitle, setSubtitle] = createSignal("The first step to join our community."); + + const [error, setError] = createSignal(null); + const [loading, setLoading] = createSignal(false); + const [done, setDone] = createSignal(false); + + async function submit(evt: SubmitEvent) { + evt.preventDefault(); + + const data = Object.fromEntries(new FormData(evt.target as HTMLFormElement)); + if (!data.name || !data.nick || !data.email || !data.password) return; + + setLoading(true); + const res = await fetch("/api/users", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(data) + }); + if (res.status !== 200) { + setError(await res.text()); + } else { + setTitle("Congratulations!"); + setSubtitle("Your account has been created and activation email has sent to your inbox!"); + setDone(true); + } + setLoading(false); + } + + return ( +
+
+
+ + + +
+ +
+
+ + +
+ + + + + + +
+
+ + +
+

What's next?

+ + Go login{" "} + then you can take part in the entire smartsheep community. + +
+
+
+
+
+ ); } \ No newline at end of file