2024-03-13 18:06:43 +00:00
|
|
|
import type { MetaFunction } from "@remix-run/node";
|
|
|
|
import { Link } from "@remix-run/react";
|
|
|
|
import { Button } from "~/components/ui/button";
|
|
|
|
import logoPng from "~/images/lume-logo.png?url";
|
|
|
|
import lumeColorLogoPng from "~/images/lume-color-logo.png?url";
|
|
|
|
import discordLogoPng from "~/images/discord-logo.png?url";
|
|
|
|
import lumeBgPng from "~/images/lume-bg-image.png?url";
|
|
|
|
import { Field, FieldCheckbox } from "~/components/forms";
|
|
|
|
import { getFormProps, useForm } from "@conform-to/react";
|
|
|
|
import { z } from "zod";
|
|
|
|
import { getZodConstraint, parseWithZod } from "@conform-to/zod";
|
2024-03-05 19:25:40 +00:00
|
|
|
|
|
|
|
export const meta: MetaFunction = () => {
|
2024-03-13 18:06:43 +00:00
|
|
|
return [{ title: "Sign Up" }];
|
|
|
|
};
|
2024-03-05 19:25:40 +00:00
|
|
|
|
2024-03-13 17:32:07 +00:00
|
|
|
const RegisterSchema = z
|
2024-03-07 14:04:59 +00:00
|
|
|
.object({
|
2024-03-13 18:06:43 +00:00
|
|
|
firstName: z.string().min(1),
|
|
|
|
lastName: z.string().min(1),
|
2024-03-07 14:04:59 +00:00
|
|
|
email: z.string().email(),
|
|
|
|
password: z
|
|
|
|
.string()
|
|
|
|
.min(8, { message: "Password must be at least 8 characters" }),
|
|
|
|
confirmPassword: z
|
|
|
|
.string()
|
|
|
|
.min(8, { message: "Password must be at least 8 characters" }),
|
|
|
|
termsOfService: z.boolean({
|
2024-03-13 18:06:43 +00:00
|
|
|
required_error: "You must agree to the terms of service",
|
|
|
|
}),
|
2024-03-07 14:04:59 +00:00
|
|
|
})
|
|
|
|
.superRefine((data, ctx) => {
|
|
|
|
if (data.password !== data.confirmPassword) {
|
|
|
|
return ctx.addIssue({
|
|
|
|
code: z.ZodIssueCode.custom,
|
|
|
|
path: ["confirmPassword"],
|
2024-03-13 18:06:43 +00:00
|
|
|
message: "Passwords do not match",
|
|
|
|
});
|
2024-03-07 14:04:59 +00:00
|
|
|
}
|
2024-03-13 18:06:43 +00:00
|
|
|
return true;
|
|
|
|
});
|
2024-03-07 14:04:59 +00:00
|
|
|
|
2024-03-13 17:32:07 +00:00
|
|
|
export default function Register() {
|
2024-03-05 19:25:40 +00:00
|
|
|
const [form, fields] = useForm({
|
2024-03-13 17:32:07 +00:00
|
|
|
id: "register",
|
|
|
|
constraint: getZodConstraint(RegisterSchema),
|
2024-03-07 14:04:59 +00:00
|
|
|
onValidate({ formData }) {
|
2024-03-13 18:06:43 +00:00
|
|
|
return parseWithZod(formData, { schema: RegisterSchema });
|
|
|
|
},
|
|
|
|
});
|
2024-03-07 14:04:59 +00:00
|
|
|
|
2024-03-05 19:25:40 +00:00
|
|
|
return (
|
2024-03-07 14:04:59 +00:00
|
|
|
<div className="p-10 h-screen relative">
|
2024-03-05 19:25:40 +00:00
|
|
|
<header>
|
2024-03-07 14:04:59 +00:00
|
|
|
<img src={logoPng} alt="Lume logo" className="h-10" />
|
2024-03-05 19:25:40 +00:00
|
|
|
</header>
|
2024-03-07 14:04:59 +00:00
|
|
|
<form
|
|
|
|
className="w-full p-2 max-w-md space-y-4 mt-12 bg-background"
|
2024-03-13 18:06:43 +00:00
|
|
|
{...getFormProps(form)}>
|
2024-03-05 19:25:40 +00:00
|
|
|
<span className="!mb-12 space-y-2">
|
|
|
|
<h2 className="text-3xl font-bold">All roads lead to Lume</h2>
|
|
|
|
<p className="text-input-placeholder">
|
|
|
|
🤘 Get 50 GB free storage and download for free,{" "}
|
|
|
|
<b
|
|
|
|
className="text-primar
|
2024-03-13 18:06:43 +00:00
|
|
|
y-2">
|
2024-03-05 19:25:40 +00:00
|
|
|
forever
|
|
|
|
</b>
|
|
|
|
.{" "}
|
|
|
|
</p>
|
|
|
|
</span>
|
2024-03-13 18:06:43 +00:00
|
|
|
<div className="flex gap-4">
|
|
|
|
<Field
|
|
|
|
className="flex-1"
|
|
|
|
inputProps={{ name: fields.firstName.name }}
|
|
|
|
labelProps={{ children: "First Name" }}
|
|
|
|
errors={fields.firstName.errors}
|
|
|
|
/>
|
|
|
|
<Field
|
|
|
|
className="flex-1"
|
|
|
|
inputProps={{ name: fields.lastName.name }}
|
|
|
|
labelProps={{ children: "Last Name" }}
|
|
|
|
errors={fields.lastName.errors}
|
|
|
|
/>
|
|
|
|
</div>
|
2024-03-05 19:25:40 +00:00
|
|
|
<Field
|
|
|
|
inputProps={{ name: fields.email.name }}
|
|
|
|
labelProps={{ children: "Email" }}
|
|
|
|
errors={fields.email.errors}
|
|
|
|
/>
|
|
|
|
<Field
|
|
|
|
inputProps={{ name: fields.password.name, type: "password" }}
|
|
|
|
labelProps={{ children: "Password" }}
|
|
|
|
errors={fields.password.errors}
|
|
|
|
/>
|
|
|
|
<Field
|
|
|
|
inputProps={{ name: fields.confirmPassword.name, type: "password" }}
|
|
|
|
labelProps={{ children: "Confirm Password" }}
|
|
|
|
errors={fields.confirmPassword.errors}
|
|
|
|
/>
|
|
|
|
<FieldCheckbox
|
|
|
|
inputProps={{ name: fields.termsOfService.name, form: form.id }}
|
|
|
|
labelProps={{
|
2024-03-07 14:04:59 +00:00
|
|
|
children: (
|
|
|
|
<span>
|
|
|
|
I agree to the
|
|
|
|
<Link
|
|
|
|
to="/terms-of-service"
|
2024-03-13 18:06:43 +00:00
|
|
|
className="text-primary-1 text-md hover:underline hover:underline-offset-4 mx-1">
|
2024-03-07 14:04:59 +00:00
|
|
|
Terms of Service
|
|
|
|
</Link>
|
|
|
|
and
|
|
|
|
<Link
|
|
|
|
to="/privacy-policy"
|
2024-03-13 18:06:43 +00:00
|
|
|
className="text-primary-1 text-md hover:underline hover:underline-offset-4 mx-1">
|
2024-03-07 14:04:59 +00:00
|
|
|
Privacy Policy
|
|
|
|
</Link>
|
|
|
|
</span>
|
2024-03-13 18:06:43 +00:00
|
|
|
),
|
2024-03-05 19:25:40 +00:00
|
|
|
}}
|
|
|
|
errors={fields.termsOfService.errors}
|
|
|
|
/>
|
|
|
|
<Button className="w-full h-14">Create Account</Button>
|
2024-03-07 14:04:59 +00:00
|
|
|
<p className="text-input-placeholder w-full text-right">
|
|
|
|
Already have an account?{" "}
|
|
|
|
<Link
|
|
|
|
to="/login"
|
2024-03-13 18:06:43 +00:00
|
|
|
className="text-primary-1 text-md hover:underline hover:underline-offset-4">
|
2024-03-07 14:04:59 +00:00
|
|
|
Login here instead →
|
|
|
|
</Link>
|
|
|
|
</p>
|
2024-03-05 19:25:40 +00:00
|
|
|
</form>
|
2024-03-07 14:04:59 +00:00
|
|
|
<div className="fixed inset-0 -z-10 overflow-clip">
|
|
|
|
<img
|
|
|
|
src={lumeBgPng}
|
|
|
|
alt="Lume background"
|
|
|
|
className="absolute top-0 right-0 md:w-2/3 object-cover z-[-1]"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<footer className="my-5">
|
2024-03-05 19:25:40 +00:00
|
|
|
<ul className="flex flex-row">
|
|
|
|
<li>
|
|
|
|
<Link to="https://discord.lumeweb.com">
|
|
|
|
<Button
|
|
|
|
variant={"link"}
|
2024-03-13 18:06:43 +00:00
|
|
|
className="flex flex-row gap-x-2 text-input-placeholder">
|
2024-03-05 19:25:40 +00:00
|
|
|
<img className="h-5" src={discordLogoPng} alt="Discord Logo" />
|
|
|
|
Connect with us
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<Link to="https://lumeweb.com">
|
|
|
|
<Button
|
|
|
|
variant={"link"}
|
2024-03-13 18:06:43 +00:00
|
|
|
className="flex flex-row gap-x-2 text-input-placeholder">
|
2024-03-05 19:25:40 +00:00
|
|
|
<img className="h-5" src={lumeColorLogoPng} alt="Lume Logo" />
|
|
|
|
Connect with us
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</footer>
|
|
|
|
</div>
|
2024-03-13 18:06:43 +00:00
|
|
|
);
|
2024-03-05 19:25:40 +00:00
|
|
|
}
|