Finalish MVP

This commit is contained in:
mdares
2026-01-05 16:36:00 +00:00
parent 538b06bd4b
commit ea92b32618
19 changed files with 2289 additions and 701 deletions

View File

@@ -1,8 +1,10 @@
"use client";
import { useState } from "react";
import { useI18n } from "@/lib/i18n/useI18n";
export default function SignupForm() {
const { t } = useI18n();
const [orgName, setOrgName] = useState("");
const [name, setName] = useState("");
const [email, setEmail] = useState("");
@@ -26,14 +28,14 @@ export default function SignupForm() {
const data = await res.json().catch(() => ({}));
if (!res.ok || !data.ok) {
setErr(data.error || "Signup failed");
setErr(data.error || t("signup.error.default"));
return;
}
setVerificationSent(true);
setEmailSent(data.emailSent !== false);
} catch (e: any) {
setErr(e?.message || "Network error");
setErr(e?.message || t("signup.error.network"));
} finally {
setLoading(false);
}
@@ -43,24 +45,22 @@ export default function SignupForm() {
return (
<div className="min-h-screen bg-black flex items-center justify-center p-6">
<div className="w-full max-w-lg rounded-2xl border border-white/10 bg-white/5 p-8">
<h1 className="text-2xl font-semibold text-white">Verify your email</h1>
<h1 className="text-2xl font-semibold text-white">{t("signup.verify.title")}</h1>
<p className="mt-2 text-sm text-zinc-300">
We sent a verification link to <span className="text-white">{email}</span>.
{t("signup.verify.sent", { email: email || t("common.na") })}
</p>
{!emailSent && (
<div className="mt-3 rounded-xl border border-red-500/30 bg-red-500/10 p-3 text-xs text-red-200">
Verification email failed to send. Please contact support.
{t("signup.verify.failed")}
</div>
)}
<div className="mt-4 text-xs text-zinc-500">
Once verified, you can sign in and invite your team.
</div>
<div className="mt-4 text-xs text-zinc-500">{t("signup.verify.notice")}</div>
<div className="mt-6">
<a
href="/login"
className="inline-flex rounded-xl border border-white/10 bg-white/5 px-4 py-2 text-sm text-white hover:bg-white/10"
>
Back to login
{t("signup.verify.back")}
</a>
</div>
</div>
@@ -71,14 +71,12 @@ export default function SignupForm() {
return (
<div className="min-h-screen bg-black flex items-center justify-center p-6">
<form onSubmit={onSubmit} className="w-full max-w-lg rounded-2xl border border-white/10 bg-white/5 p-8">
<h1 className="text-2xl font-semibold text-white">Create your Control Tower</h1>
<p className="mt-1 text-sm text-zinc-400">
Set up your organization and invite the team.
</p>
<h1 className="text-2xl font-semibold text-white">{t("signup.title")}</h1>
<p className="mt-1 text-sm text-zinc-400">{t("signup.subtitle")}</p>
<div className="mt-6 space-y-4">
<div>
<label className="text-sm text-zinc-300">Organization name</label>
<label className="text-sm text-zinc-300">{t("signup.orgName")}</label>
<input
className="mt-1 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-white outline-none"
value={orgName}
@@ -89,7 +87,7 @@ export default function SignupForm() {
<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
<div>
<label className="text-sm text-zinc-300">Your name</label>
<label className="text-sm text-zinc-300">{t("signup.yourName")}</label>
<input
className="mt-1 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-white outline-none"
value={name}
@@ -98,7 +96,7 @@ export default function SignupForm() {
/>
</div>
<div>
<label className="text-sm text-zinc-300">Email</label>
<label className="text-sm text-zinc-300">{t("signup.email")}</label>
<input
className="mt-1 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-white outline-none"
value={email}
@@ -109,7 +107,7 @@ export default function SignupForm() {
</div>
<div>
<label className="text-sm text-zinc-300">Password</label>
<label className="text-sm text-zinc-300">{t("signup.password")}</label>
<input
type="password"
className="mt-1 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-white outline-none"
@@ -126,13 +124,13 @@ export default function SignupForm() {
disabled={loading}
className="mt-2 w-full rounded-xl bg-emerald-400 py-3 font-semibold text-black disabled:opacity-70"
>
{loading ? "Creating account..." : "Create account"}
{loading ? t("signup.submit.loading") : t("signup.submit.default")}
</button>
<div className="text-xs text-zinc-500">
Already have access?{" "}
{t("signup.alreadyHave")}{" "}
<a href="/login" className="text-emerald-300 hover:text-emerald-200">
Sign in
{t("signup.signIn")}
</a>
</div>
</div>