-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
475 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
frontend/src/components/AuthenticationHeader/AuthenticationHeader.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@import "~/styles/media.css"; | ||
|
||
.authentication-header { | ||
text-align: center; | ||
|
||
.action-group { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
gap: 1rem; | ||
justify-content: center; | ||
margin-top: 2.5rem; | ||
} | ||
|
||
.heading { | ||
font-size: 2rem; | ||
font-weight: 700; | ||
line-height: 3.5rem; | ||
margin-bottom: 0.5rem; | ||
transition: font-size 0.2s ease; | ||
} | ||
|
||
.summary { | ||
color: rgba(var(--color-blue-700-rgb)); | ||
font-weight: 700; | ||
margin-bottom: 0.25rem; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
.summary { | ||
color: rgba(var(--color-blue-400-rgb)); | ||
} | ||
} | ||
|
||
@media (--min-sm) { | ||
.heading { | ||
font-size: 3rem; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import clsx from "clsx"; | ||
import { PropsWithoutRef, ReactNode, JSX } from "react"; | ||
import styles from "./AuthenticationHeader.module.css"; | ||
|
||
type AuthenticationHeaderProps = Overwrite<Omit<PropsWithoutRef<JSX.IntrinsicElements["div"]>, "children">, { | ||
actions?: ReactNode, | ||
description: ReactNode, | ||
summary: ReactNode, | ||
title: ReactNode | ||
}> | ||
|
||
export default function AuthenticationHeader({ actions, className, description, summary, title, ...props }: AuthenticationHeaderProps) { | ||
return ( | ||
<div {...props} className={clsx(styles.authenticationHeader, className)}> | ||
<p className={styles.summary}>{summary}</p> | ||
|
||
<h1 className={styles.heading}> | ||
{title} | ||
</h1> | ||
|
||
<p> | ||
{description} | ||
</p> | ||
|
||
{actions ? ( | ||
<div className={styles.actionGroup}> | ||
{actions} | ||
</div> | ||
) : null} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,15 @@ | ||
.title { | ||
margin-bottom: 2rem; | ||
text-align: center; | ||
|
||
.summary { | ||
color: rgba(var(--color-blue-700-rgb)); | ||
font-weight: 700; | ||
|
||
@media (prefers-color-scheme: dark) { | ||
color: rgba(var(--color-blue-400-rgb)); | ||
} | ||
} | ||
|
||
.heading { | ||
font-size: 3rem; | ||
font-weight: 700; | ||
line-height: 3.5rem; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
.button-group { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
gap: 1rem; | ||
justify-content: center; | ||
margin-block: 2rem; | ||
} | ||
.button-group { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
gap: 1rem; | ||
justify-content: center; | ||
margin-block: 2rem; | ||
} | ||
|
||
.card { | ||
margin-inline: auto; | ||
margin-top: 2rem; | ||
max-width: 32rem; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { useErrorBoundary } from "react-error-boundary"; | |
import { useForm } from "react-hook-form"; | ||
import { Link } from "wouter"; | ||
import ActivityOverlay from "~/components/ActivityOverlay"; | ||
import AuthenticationHeader from "~/components/AuthenticationHeader"; | ||
import Layout from "~/components/Layout"; | ||
import Title from "~/components/Title"; | ||
import { api } from "~/lib/api"; | ||
|
@@ -52,7 +53,7 @@ export default function Bootstrap() { | |
if (accessTokenResponse.ok) { | ||
localStorage.setItem("accessToken", accessTokenResponseJson.accessToken); | ||
} else { | ||
/* TODO: Handle error */ | ||
showBoundary(accessTokenResponseJson); | ||
} | ||
} else { | ||
setErrors(setError, responseJson); | ||
|
@@ -99,65 +100,53 @@ export default function Bootstrap() { | |
) : isAlreadyBootstrapped ? ( | ||
<Layout verticallyCenter> | ||
<div className="container"> | ||
<div className={styles.title}> | ||
<small className={styles.summary}>Bootstrap</small> | ||
|
||
<h2 className={styles.heading}> | ||
Already bootstrapped! | ||
</h2> | ||
|
||
<p> | ||
It looks like PoeticMetric has already been initialized. | ||
</p> | ||
|
||
<div className={styles.buttonGroup}> | ||
<Link className="button button-lg button-blue" to="/"> | ||
Return home | ||
</Link> | ||
|
||
<a className="button button-lg button-blue-ghost" href="mailto:[email protected]"> | ||
Contact support | ||
</a> | ||
</div> | ||
</div> | ||
<AuthenticationHeader | ||
actions={( | ||
<> | ||
<Link className="button button-lg button-blue" to="/"> | ||
Return home | ||
</Link> | ||
|
||
<a className="button button-lg button-blue-ghost" href="mailto:[email protected]"> | ||
Contact support | ||
</a> | ||
</> | ||
)} | ||
description="It looks like PoeticMetric has already been initialized." | ||
summary="Bootstrap" | ||
title="Already bootstrapped!" | ||
/> | ||
</div> | ||
</Layout> | ||
) : isBootstrapped ? ( | ||
<Layout verticallyCenter> | ||
<div className="container"> | ||
<div className={styles.title}> | ||
<small className={styles.summary}>Bootstrap</small> | ||
|
||
<h2 className={styles.heading}> | ||
You are all set! | ||
</h2> | ||
|
||
<p> | ||
PoeticMetric has been successfully initialized. | ||
</p> | ||
|
||
<div className={styles.buttonGroup}> | ||
<AuthenticationHeader | ||
actions={( | ||
<Link className="button button-lg button-blue" to="/sign-up"> | ||
Sign up to create dashboard | ||
</Link> | ||
</div> | ||
</div> | ||
)} | ||
description="PoeticMetric has been successfully initialized." | ||
summary="Bootstrap" | ||
title="You are all set!" | ||
/> | ||
</div> | ||
</Layout> | ||
) : ( | ||
<Layout verticallyCenter> | ||
<div className="container"> | ||
<div className={styles.title}> | ||
<small className={styles.summary}>Bootstrap</small> | ||
|
||
<h1 className={styles.heading}> | ||
Welcome to | ||
<br /> | ||
PoeticMetric! | ||
</h1> | ||
|
||
<p>Complete PoeticMetric installation to continue.</p> | ||
</div> | ||
<AuthenticationHeader | ||
description="Complete PoeticMetric installation to continue." | ||
summary="Bootstrap" | ||
title={( | ||
<> | ||
Welcome to | ||
<br /> | ||
PoeticMetric! | ||
</> | ||
)} | ||
/> | ||
|
||
<div className={clsx("card", styles.card)}> | ||
<ActivityOverlay isActive={state.isSubmitInProgress}> | ||
|
@@ -166,7 +155,12 @@ export default function Bootstrap() { | |
<div className="form-group"> | ||
<label className="form-label" htmlFor="input-user-name">Full name</label> | ||
|
||
<input className={clsx("input", errors.userName && "input-invalid")} id="input-user-name" required {...register("userName")} /> | ||
<input | ||
className={clsx("input", errors.userName && "input-invalid")} | ||
id="input-user-name" | ||
required | ||
{...register("userName")} | ||
/> | ||
|
||
{!!errors.userName ? (<div>{errors.userName.message}</div>) : null} | ||
</div> | ||
|
@@ -188,7 +182,12 @@ export default function Bootstrap() { | |
<div className="form-group"> | ||
<label className="form-label">New password</label> | ||
|
||
<input className={clsx("input", errors.userPassword && "input-invalid")} required type="password" {...register("userPassword")} /> | ||
<input | ||
className={clsx("input", errors.userPassword && "input-invalid")} | ||
required | ||
type="password" | ||
{...register("userPassword")} | ||
/> | ||
|
||
{!!errors.userPassword ? (<div className="form-error">{errors.userPassword.message}</div>) : null} | ||
</div> | ||
|
@@ -209,14 +208,23 @@ export default function Bootstrap() { | |
<div className="form-group"> | ||
<label className="form-label">Organization</label> | ||
|
||
<input className={clsx("input", errors.organizationName && "input-invalid")} required {...register("organizationName")} /> | ||
<input | ||
className={clsx("input", errors.organizationName && "input-invalid")} | ||
required | ||
{...register("organizationName")} | ||
/> | ||
|
||
{!!errors.organizationName ? (<div className="form-error">{errors.organizationName.message}</div>) : null} | ||
</div> | ||
|
||
<div className="form-group"> | ||
<div className="form-group-inline"> | ||
<input className={clsx(errors.createDemoSite && "input-invalid")} id="input-create-demo-site" type="checkbox" {...register("createDemoSite")} /> | ||
<input | ||
className={clsx(errors.createDemoSite && "input-invalid")} | ||
id="input-create-demo-site" | ||
type="checkbox" | ||
{...register("createDemoSite")} | ||
/> | ||
|
||
<label htmlFor="input-create-demo-site">Create demo site</label> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.layout { | ||
margin-block: 2rem; | ||
padding-block: 2rem; | ||
|
||
&.vertically-center { | ||
align-items: center; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.