2021-06-18 15:21:54 -04:00
|
|
|
import { Text } from "preact-i18n";
|
|
|
|
import { Helmet } from "react-helmet";
|
|
|
|
import styles from "./Login.module.scss";
|
|
|
|
import { useContext } from "preact/hooks";
|
|
|
|
import { APP_VERSION } from "../../version";
|
|
|
|
import { LIBRARY_VERSION } from "revolt.js";
|
|
|
|
import { Route, Switch } from "react-router-dom";
|
|
|
|
import { ThemeContext } from "../../context/Theme";
|
2021-06-18 17:47:25 -04:00
|
|
|
import { AppContext } from "../../context/revoltjs/RevoltClient";
|
2021-06-18 15:21:54 -04:00
|
|
|
|
|
|
|
import background from "./background.jpg";
|
|
|
|
|
|
|
|
import { FormLogin } from "./forms/FormLogin";
|
|
|
|
import { FormCreate } from "./forms/FormCreate";
|
|
|
|
import { FormResend } from "./forms/FormResend";
|
|
|
|
import { FormReset, FormSendReset } from "./forms/FormReset";
|
|
|
|
|
2021-06-19 07:34:53 -04:00
|
|
|
export default function Login() {
|
2021-06-18 15:21:54 -04:00
|
|
|
const theme = useContext(ThemeContext);
|
2021-06-19 13:46:05 -04:00
|
|
|
const client = useContext(AppContext);
|
2021-06-18 15:21:54 -04:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.login}>
|
|
|
|
<Helmet>
|
|
|
|
<meta name="theme-color" content={theme.background} />
|
|
|
|
</Helmet>
|
|
|
|
<div className={styles.content}>
|
|
|
|
<div className={styles.attribution}>
|
|
|
|
<span>
|
|
|
|
API:{" "}
|
2021-06-18 17:47:25 -04:00
|
|
|
<code>{client.configuration?.revolt ?? "???"}</code>{" "}
|
2021-06-18 15:21:54 -04:00
|
|
|
· revolt.js: <code>{LIBRARY_VERSION}</code>{" "}
|
|
|
|
· App: <code>{APP_VERSION}</code>
|
|
|
|
</span>
|
|
|
|
<span>
|
|
|
|
{/*<LocaleSelector />*/}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div className={styles.modal}>
|
|
|
|
<Switch>
|
|
|
|
<Route path="/login/create">
|
|
|
|
<FormCreate />
|
|
|
|
</Route>
|
|
|
|
<Route path="/login/resend">
|
|
|
|
<FormResend />
|
|
|
|
</Route>
|
|
|
|
<Route path="/login/reset/:token">
|
|
|
|
<FormReset />
|
|
|
|
</Route>
|
|
|
|
<Route path="/login/reset">
|
|
|
|
<FormSendReset />
|
|
|
|
</Route>
|
|
|
|
<Route path="/">
|
|
|
|
<FormLogin />
|
|
|
|
</Route>
|
|
|
|
</Switch>
|
|
|
|
</div>
|
|
|
|
<div className={styles.attribution}>
|
|
|
|
<span>
|
|
|
|
<Text id="general.image_by" /> ‎@lorenzoherrera
|
|
|
|
‏· unsplash.com
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
className={styles.bg}
|
|
|
|
style={{ background: `url('${background}')` }}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|