Spaces:
Running
Running
Separate, redesigned sign-in and sign-up pages
Browse files- frontend/src/components/Shell.tsx +4 -4
- frontend/src/lib/i18n.tsx +28 -0
- frontend/src/pages/Auth.tsx +165 -51
frontend/src/components/Shell.tsx
CHANGED
|
@@ -29,18 +29,18 @@ export function PublicHeader() {
|
|
| 29 |
const { profile } = useAuth();
|
| 30 |
const { t } = useI18n();
|
| 31 |
return (
|
| 32 |
-
<header className="mx-auto flex max-w-6xl items-center justify-between gap-
|
| 33 |
<Link to="/" aria-label="EvalBot home"><Logo /></Link>
|
| 34 |
<nav className="flex items-center gap-1 sm:gap-2">
|
| 35 |
<Link to="/jobs" className="hidden rounded-xl px-3 py-2 text-sm font-medium text-ink hover:bg-sunken sm:inline-block">{t("browse_jobs")}</Link>
|
| 36 |
<LangSwitch />
|
| 37 |
-
<ThemeSwitch />
|
| 38 |
{profile ? (
|
| 39 |
<Link to="/app" className="rounded-xl bg-nile px-4 py-2 text-sm font-medium text-white dark:text-paper">{t("nav_dashboard")}</Link>
|
| 40 |
) : (
|
| 41 |
<>
|
| 42 |
-
<Link to="/login" className="
|
| 43 |
-
<Link to="/signup" className="rounded-xl bg-nile px-
|
| 44 |
</>
|
| 45 |
)}
|
| 46 |
</nav>
|
|
|
|
| 29 |
const { profile } = useAuth();
|
| 30 |
const { t } = useI18n();
|
| 31 |
return (
|
| 32 |
+
<header className="mx-auto flex max-w-6xl items-center justify-between gap-2 px-3 py-5 sm:gap-4 sm:px-6">
|
| 33 |
<Link to="/" aria-label="EvalBot home"><Logo /></Link>
|
| 34 |
<nav className="flex items-center gap-1 sm:gap-2">
|
| 35 |
<Link to="/jobs" className="hidden rounded-xl px-3 py-2 text-sm font-medium text-ink hover:bg-sunken sm:inline-block">{t("browse_jobs")}</Link>
|
| 36 |
<LangSwitch />
|
| 37 |
+
<span className="hidden sm:inline-flex"><ThemeSwitch /></span>
|
| 38 |
{profile ? (
|
| 39 |
<Link to="/app" className="rounded-xl bg-nile px-4 py-2 text-sm font-medium text-white dark:text-paper">{t("nav_dashboard")}</Link>
|
| 40 |
) : (
|
| 41 |
<>
|
| 42 |
+
<Link to="/login" className="whitespace-nowrap rounded-xl border border-line bg-surface px-2.5 py-2 text-sm font-medium text-ink hover:border-nile hover:text-nile sm:px-3.5">{t("sign_in")}</Link>
|
| 43 |
+
<Link to="/signup" className="whitespace-nowrap rounded-xl bg-nile px-2.5 py-2 text-sm font-medium text-white hover:bg-nile-deep sm:px-3.5 dark:text-paper">{t("sign_up")}</Link>
|
| 44 |
</>
|
| 45 |
)}
|
| 46 |
</nav>
|
frontend/src/lib/i18n.tsx
CHANGED
|
@@ -42,6 +42,20 @@ const en = {
|
|
| 42 |
password_hint: "At least 8 characters.",
|
| 43 |
accounts_soon: "Accounts are being set up. In the meantime you can analyze a recorded interview or practice single questions.",
|
| 44 |
open_demo: "Open the analyzer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
onboard_title: "How will you use EvalBot?", onboard_candidate: "Practice interviews",
|
| 47 |
onboard_candidate_d: "Prepare for jobs in your track and track your progress.", onboard_recruiter: "Hire for my company",
|
|
@@ -189,6 +203,20 @@ const ar: Dict = {
|
|
| 189 |
password_hint: "8 أحرف على الأقل.",
|
| 190 |
accounts_soon: "يتم تجهيز الحسابات حالياً. وفي الأثناء يمكنك تحليل مقابلة مسجّلة أو التدرّب على أسئلة منفردة.",
|
| 191 |
open_demo: "افتح أداة التحليل",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
onboard_title: "كيف ستستخدم EvalBot؟", onboard_candidate: "أتدرّب على المقابلات",
|
| 194 |
onboard_candidate_d: "استعد للوظائف في مجالك وتابع تطوّرك.", onboard_recruiter: "أوظّف لشركتي",
|
|
|
|
| 42 |
password_hint: "At least 8 characters.",
|
| 43 |
accounts_soon: "Accounts are being set up. In the meantime you can analyze a recorded interview or practice single questions.",
|
| 44 |
open_demo: "Open the analyzer",
|
| 45 |
+
auth_signin_sub: "Sign in to continue to your interviews or your hiring dashboard.",
|
| 46 |
+
auth_signup_sub: "Free to use. It takes less than a minute.", auth_tabs: "Sign in or create an account",
|
| 47 |
+
account_type: "I'm joining as", kind_candidate: "Job seeker", kind_candidate_d: "Practice, find jobs and apply",
|
| 48 |
+
kind_company: "Company", kind_company_d: "Post jobs and review candidates", your_name: "Your name", work_email: "Work email",
|
| 49 |
+
create_company_account: "Create company account", forgot_need_email: "Enter your email first, then tap “Forgot your password?”.",
|
| 50 |
+
show_password: "Show password", hide_password: "Hide password",
|
| 51 |
+
side_title: "Interviews that tell you exactly what to improve.",
|
| 52 |
+
side_p1: "Spoken mock interviews for 30 career tracks, with follow-up questions like a real interviewer.",
|
| 53 |
+
side_p2: "A score and a stronger version of every answer, in English or Arabic.",
|
| 54 |
+
side_p3: "Delivery scores trained on how human panels rated 138 real interviews.",
|
| 55 |
+
side_title_c: "Hire faster, with the same fair interview for everyone.",
|
| 56 |
+
side_c1: "Post a job and share one link. Candidates interview whenever it suits them.",
|
| 57 |
+
side_c2: "A ranked shortlist with scores, recordings, transcripts and a written assessment.",
|
| 58 |
+
side_c3: "A hiring dashboard: funnel, score distribution, top 10 candidates and CSV export.",
|
| 59 |
|
| 60 |
onboard_title: "How will you use EvalBot?", onboard_candidate: "Practice interviews",
|
| 61 |
onboard_candidate_d: "Prepare for jobs in your track and track your progress.", onboard_recruiter: "Hire for my company",
|
|
|
|
| 203 |
password_hint: "8 أحرف على الأقل.",
|
| 204 |
accounts_soon: "يتم تجهيز الحسابات حالياً. وفي الأثناء يمكنك تحليل مقابلة مسجّلة أو التدرّب على أسئلة منفردة.",
|
| 205 |
open_demo: "افتح أداة التحليل",
|
| 206 |
+
auth_signin_sub: "سجّل الدخول لتكمل مقابلاتك أو لوحة التوظيف الخاصة بشركتك.",
|
| 207 |
+
auth_signup_sub: "مجاني، ويستغرق أقل من دقيقة.", auth_tabs: "تسجيل الدخول أو إنشاء حساب",
|
| 208 |
+
account_type: "أنضم بصفتي", kind_candidate: "باحث عن عمل", kind_candidate_d: "أتدرّب وأبحث عن وظائف وأتقدّم",
|
| 209 |
+
kind_company: "شركة", kind_company_d: "أنشر وظائف وأراجع المرشحين", your_name: "اسمك", work_email: "بريد العمل",
|
| 210 |
+
create_company_account: "إنشاء حساب الشركة", forgot_need_email: "اكتب بريدك أولاً، ثم اضغط «نسيت كلمة المرور؟».",
|
| 211 |
+
show_password: "إظهار كلمة المرور", hide_password: "إخفاء كلمة المرور",
|
| 212 |
+
side_title: "مقابلات توضّح لك بالضبط ما تحتاج إلى تحسينه.",
|
| 213 |
+
side_p1: "مقابلات تدريبية صوتية في 30 مجالاً، مع أسئلة متابعة كما يفعل المحاوِر الحقيقي.",
|
| 214 |
+
side_p2: "درجة ونسخة أقوى من كل إجابة، بالعربية أو الإنجليزية.",
|
| 215 |
+
side_p3: "درجات الأداء مدرّبة على تقييم لجان بشرية لـ 138 مقابلة حقيقية.",
|
| 216 |
+
side_title_c: "وظّف أسرع، بمقابلة واحدة عادلة للجميع.",
|
| 217 |
+
side_c1: "انشر الوظيفة وشارك رابطاً واحداً، ويجري المرشحون المقابلة في الوقت المناسب لهم.",
|
| 218 |
+
side_c2: "قائمة مرتّبة بالدرجات والتسجيلات ونصوص الإجابات وتقييم مكتوب.",
|
| 219 |
+
side_c3: "لوحة توظيف: مسار التقديم، وتوزيع الدرجات، وأفضل 10 مرشحين، وتصدير CSV.",
|
| 220 |
|
| 221 |
onboard_title: "كيف ستستخدم EvalBot؟", onboard_candidate: "أتدرّب على المقابلات",
|
| 222 |
onboard_candidate_d: "استعد للوظائف في مجالك وتابع تطوّرك.", onboard_recruiter: "أوظّف لشركتي",
|
frontend/src/pages/Auth.tsx
CHANGED
|
@@ -1,23 +1,61 @@
|
|
|
|
|
| 1 |
import { useState, type FormEvent } from "react";
|
| 2 |
import { Link, useNavigate, useSearchParams } from "react-router-dom";
|
| 3 |
-
import {
|
| 4 |
-
import { Button, ErrorNote, Field, Input } from "../components/ui";
|
|
|
|
| 5 |
import { useAuth } from "../lib/auth";
|
| 6 |
import { useI18n } from "../lib/i18n";
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
export default function Auth({ mode }: { mode: "signin" | "signup" }) {
|
| 9 |
const { t } = useI18n();
|
| 10 |
-
const { signIn, signUp, signInWithGoogle, resetPassword, config } = useAuth();
|
| 11 |
const [params] = useSearchParams();
|
| 12 |
const nav = useNavigate();
|
|
|
|
|
|
|
| 13 |
const [email, setEmail] = useState("");
|
| 14 |
const [password, setPassword] = useState("");
|
|
|
|
| 15 |
const [name, setName] = useState("");
|
|
|
|
| 16 |
const [busy, setBusy] = useState(false);
|
| 17 |
const [error, setError] = useState<string | null>(null);
|
| 18 |
const [notice, setNotice] = useState<string | null>(null);
|
| 19 |
-
const
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
const submit = async (e: FormEvent) => {
|
| 23 |
e.preventDefault();
|
|
@@ -27,10 +65,21 @@ export default function Auth({ mode }: { mode: "signin" | "signup" }) {
|
|
| 27 |
if (mode === "signin") {
|
| 28 |
await signIn(email, password);
|
| 29 |
nav(next || "/app");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
} else {
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
}
|
| 35 |
} catch (err: any) {
|
| 36 |
setError(err?.message || t("error_generic"));
|
|
@@ -41,7 +90,7 @@ export default function Auth({ mode }: { mode: "signin" | "signup" }) {
|
|
| 41 |
|
| 42 |
const forgot = async () => {
|
| 43 |
if (!email) {
|
| 44 |
-
setError(t("
|
| 45 |
return;
|
| 46 |
}
|
| 47 |
try {
|
|
@@ -52,51 +101,116 @@ export default function Auth({ mode }: { mode: "signin" | "signup" }) {
|
|
| 52 |
}
|
| 53 |
};
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
return (
|
| 56 |
-
<div className="min-h-screen">
|
| 57 |
-
<
|
| 58 |
-
<
|
| 59 |
-
<
|
| 60 |
-
|
| 61 |
-
<div className="
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
<
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
</Button>
|
| 75 |
-
|
| 76 |
-
</>
|
| 77 |
-
)}
|
| 78 |
-
{mode === "signup" && (
|
| 79 |
-
<Field label={t("full_name")}><Input value={name} onChange={(e) => setName(e.target.value)} required autoComplete="name" /></Field>
|
| 80 |
)}
|
| 81 |
-
|
| 82 |
-
<
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
<
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
</form>
|
| 92 |
-
)}
|
| 93 |
-
<p className="mt-8 text-sm text-muted">
|
| 94 |
-
{mode === "signin" ? t("no_account") : t("have_account")}{" "}
|
| 95 |
-
<Link to={`${mode === "signin" ? "/signup" : "/login"}${next ? `?next=${encodeURIComponent(next)}` : ""}`} className="font-medium text-nile hover:underline">
|
| 96 |
-
{mode === "signin" ? t("sign_up") : t("sign_in")}
|
| 97 |
-
</Link>
|
| 98 |
-
</p>
|
| 99 |
-
</main>
|
| 100 |
</div>
|
| 101 |
);
|
| 102 |
}
|
|
|
|
| 1 |
+
import { Building2, CheckCircle2, Eye, EyeOff, UserRound } from "lucide-react";
|
| 2 |
import { useState, type FormEvent } from "react";
|
| 3 |
import { Link, useNavigate, useSearchParams } from "react-router-dom";
|
| 4 |
+
import { LangSwitch, ThemeSwitch } from "../components/Shell";
|
| 5 |
+
import { Button, ErrorNote, Field, Input, Logo, Waveform } from "../components/ui";
|
| 6 |
+
import { api } from "../lib/api";
|
| 7 |
import { useAuth } from "../lib/auth";
|
| 8 |
import { useI18n } from "../lib/i18n";
|
| 9 |
|
| 10 |
+
type Kind = "candidate" | "company";
|
| 11 |
+
|
| 12 |
+
/** Brand panel shown beside the sign-in and sign-up forms on wide screens. */
|
| 13 |
+
function SidePanel({ kind, mode }: { kind: Kind; mode: "signin" | "signup" }) {
|
| 14 |
+
const { t } = useI18n();
|
| 15 |
+
const points = kind === "company" && mode === "signup"
|
| 16 |
+
? [t("side_c1"), t("side_c2"), t("side_c3")]
|
| 17 |
+
: [t("side_p1"), t("side_p2"), t("side_p3")];
|
| 18 |
+
return (
|
| 19 |
+
<aside className="relative hidden flex-col justify-between overflow-hidden bg-ink p-10 text-paper lg:flex xl:p-14 dark:bg-sunken dark:text-ink">
|
| 20 |
+
<Link to="/" aria-label="EvalBot home" className="[&_span]:!text-paper dark:[&_span]:!text-ink"><Logo size={32} /></Link>
|
| 21 |
+
<div className="space-y-8">
|
| 22 |
+
<div className="h-16 w-64"><Waveform bars={30} animated color="var(--color-amber)" /></div>
|
| 23 |
+
<h2 className="max-w-md font-display text-4xl font-semibold leading-tight">
|
| 24 |
+
{kind === "company" && mode === "signup" ? t("side_title_c") : t("side_title")}
|
| 25 |
+
</h2>
|
| 26 |
+
<ul className="max-w-md space-y-4">
|
| 27 |
+
{points.map((p) => (
|
| 28 |
+
<li key={p} className="flex items-start gap-3 text-[15px] leading-relaxed opacity-90">
|
| 29 |
+
<CheckCircle2 size={20} className="mt-0.5 flex-none text-amber" /> {p}
|
| 30 |
+
</li>
|
| 31 |
+
))}
|
| 32 |
+
</ul>
|
| 33 |
+
</div>
|
| 34 |
+
<p className="max-w-md text-sm opacity-60">{t("footer_privacy")}</p>
|
| 35 |
+
</aside>
|
| 36 |
+
);
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
export default function Auth({ mode }: { mode: "signin" | "signup" }) {
|
| 40 |
const { t } = useI18n();
|
| 41 |
+
const { signIn, signUp, signInWithGoogle, resetPassword, config, refresh } = useAuth();
|
| 42 |
const [params] = useSearchParams();
|
| 43 |
const nav = useNavigate();
|
| 44 |
+
const next = params.get("next");
|
| 45 |
+
const [kind, setKind] = useState<Kind>(params.get("as") === "company" ? "company" : "candidate");
|
| 46 |
const [email, setEmail] = useState("");
|
| 47 |
const [password, setPassword] = useState("");
|
| 48 |
+
const [showPw, setShowPw] = useState(false);
|
| 49 |
const [name, setName] = useState("");
|
| 50 |
+
const [company, setCompany] = useState("");
|
| 51 |
const [busy, setBusy] = useState(false);
|
| 52 |
const [error, setError] = useState<string | null>(null);
|
| 53 |
const [notice, setNotice] = useState<string | null>(null);
|
| 54 |
+
const qs = (extra: Record<string, string> = {}) => {
|
| 55 |
+
const p = new URLSearchParams({ ...(next ? { next } : {}), ...extra });
|
| 56 |
+
const s = p.toString();
|
| 57 |
+
return s ? `?${s}` : "";
|
| 58 |
+
};
|
| 59 |
|
| 60 |
const submit = async (e: FormEvent) => {
|
| 61 |
e.preventDefault();
|
|
|
|
| 65 |
if (mode === "signin") {
|
| 66 |
await signIn(email, password);
|
| 67 |
nav(next || "/app");
|
| 68 |
+
return;
|
| 69 |
+
}
|
| 70 |
+
const r = await signUp(email, password, name);
|
| 71 |
+
if (r.needsConfirmation) {
|
| 72 |
+
setNotice(t("check_email"));
|
| 73 |
+
return;
|
| 74 |
+
}
|
| 75 |
+
if (kind === "company") {
|
| 76 |
+
await api.post("/companies", { name: company.trim() });
|
| 77 |
+
await refresh();
|
| 78 |
+
nav("/app");
|
| 79 |
} else {
|
| 80 |
+
await api.patch("/me", { role: "candidate" }).catch(() => undefined);
|
| 81 |
+
await refresh();
|
| 82 |
+
nav(next || "/app");
|
| 83 |
}
|
| 84 |
} catch (err: any) {
|
| 85 |
setError(err?.message || t("error_generic"));
|
|
|
|
| 90 |
|
| 91 |
const forgot = async () => {
|
| 92 |
if (!email) {
|
| 93 |
+
setError(t("forgot_need_email"));
|
| 94 |
return;
|
| 95 |
}
|
| 96 |
try {
|
|
|
|
| 101 |
}
|
| 102 |
};
|
| 103 |
|
| 104 |
+
const tab = (to: "signin" | "signup", label: string) => (
|
| 105 |
+
<Link to={`${to === "signin" ? "/login" : "/signup"}${qs(kind === "company" && to === "signup" ? { as: "company" } : {})}`} replace
|
| 106 |
+
aria-current={mode === to ? "page" : undefined}
|
| 107 |
+
className={`flex-1 rounded-lg px-4 py-2.5 text-center text-[15px] font-medium transition-colors ${mode === to ? "bg-surface text-ink shadow-sm" : "text-muted hover:text-ink"}`}>
|
| 108 |
+
{label}
|
| 109 |
+
</Link>
|
| 110 |
+
);
|
| 111 |
+
|
| 112 |
+
const kindCard = (k: Kind, Icon: typeof UserRound, title: string, desc: string) => (
|
| 113 |
+
<button type="button" onClick={() => setKind(k)} aria-pressed={kind === k}
|
| 114 |
+
className={`flex flex-1 items-start gap-3 rounded-xl border p-3.5 text-start transition-colors ${kind === k ? "border-nile bg-nile-soft" : "border-line bg-surface hover:border-nile"}`}>
|
| 115 |
+
<Icon size={20} className={`mt-0.5 flex-none ${kind === k ? "text-nile" : "text-muted"}`} />
|
| 116 |
+
<span>
|
| 117 |
+
<span className={`block text-[15px] font-semibold ${kind === k ? "text-nile-deep" : "text-ink"}`}>{title}</span>
|
| 118 |
+
<span className="mt-0.5 block text-xs text-muted">{desc}</span>
|
| 119 |
+
</span>
|
| 120 |
+
</button>
|
| 121 |
+
);
|
| 122 |
+
|
| 123 |
+
const disabled = config && !config.enabled;
|
| 124 |
+
|
| 125 |
return (
|
| 126 |
+
<div className="grid min-h-screen lg:grid-cols-[1fr_1.1fr]">
|
| 127 |
+
<SidePanel kind={kind} mode={mode} />
|
| 128 |
+
<div className="flex flex-col">
|
| 129 |
+
<header className="flex items-center justify-between px-5 py-4 sm:px-8">
|
| 130 |
+
<Link to="/" className="lg:invisible" aria-label="EvalBot home"><Logo /></Link>
|
| 131 |
+
<div className="flex items-center gap-1"><LangSwitch /><ThemeSwitch /></div>
|
| 132 |
+
</header>
|
| 133 |
+
<main className="flex flex-1 items-center justify-center px-5 pb-12 sm:px-8">
|
| 134 |
+
<div className="w-full max-w-md">
|
| 135 |
+
<div className="flex rounded-xl bg-sunken p-1" role="tablist" aria-label={t("auth_tabs")}>
|
| 136 |
+
{tab("signin", t("sign_in"))}
|
| 137 |
+
{tab("signup", t("sign_up"))}
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<h1 className="mt-8 text-3xl font-semibold text-ink">{mode === "signin" ? t("auth_signin_title") : t("auth_signup_title")}</h1>
|
| 141 |
+
<p className="mt-1.5 text-muted">{mode === "signin" ? t("auth_signin_sub") : t("auth_signup_sub")}</p>
|
| 142 |
+
|
| 143 |
+
{disabled ? (
|
| 144 |
+
<div className="mt-6 space-y-4">
|
| 145 |
+
<p className="rounded-xl bg-amber-soft px-4 py-3 text-ink">{t("accounts_soon")}</p>
|
| 146 |
+
<a href="/demo" className="inline-block rounded-xl bg-nile px-5 py-3 font-medium text-white dark:text-paper">{t("open_demo")}</a>
|
| 147 |
+
</div>
|
| 148 |
+
) : notice ? (
|
| 149 |
+
<p className="mt-6 rounded-xl bg-nile-soft px-4 py-3 text-nile-deep">{notice}</p>
|
| 150 |
+
) : (
|
| 151 |
+
<form onSubmit={submit} className="mt-7 space-y-4">
|
| 152 |
+
{mode === "signup" && (
|
| 153 |
+
<div>
|
| 154 |
+
<span className="mb-1.5 block text-sm font-medium text-ink">{t("account_type")}</span>
|
| 155 |
+
<div className="flex flex-col gap-2 sm:flex-row">
|
| 156 |
+
{kindCard("candidate", UserRound, t("kind_candidate"), t("kind_candidate_d"))}
|
| 157 |
+
{kindCard("company", Building2, t("kind_company"), t("kind_company_d"))}
|
| 158 |
+
</div>
|
| 159 |
+
</div>
|
| 160 |
+
)}
|
| 161 |
+
{config?.supabase_url && config.providers?.google && (
|
| 162 |
+
<>
|
| 163 |
+
<Button type="button" variant="outline" className="w-full" onClick={() => signInWithGoogle().catch((e) => setError(e.message))}>
|
| 164 |
+
<svg width="18" height="18" viewBox="0 0 48 48" aria-hidden="true"><path fill="#FFC107" d="M43.6 20.5H42V20H24v8h11.3C33.7 32.7 29.2 36 24 36c-6.6 0-12-5.4-12-12s5.4-12 12-12c3.1 0 5.8 1.2 7.9 3.1l5.7-5.7C34 6.1 29.3 4 24 4 12.9 4 4 12.9 4 24s8.9 20 20 20 20-8.9 20-20c0-1.3-.1-2.4-.4-3.5z"/><path fill="#FF3D00" d="M6.3 14.7l6.6 4.8C14.7 15.1 19 12 24 12c3.1 0 5.8 1.2 7.9 3.1l5.7-5.7C34 6.1 29.3 4 24 4 16.3 4 9.7 8.3 6.3 14.7z"/><path fill="#4CAF50" d="M24 44c5.2 0 9.9-2 13.4-5.2l-6.2-5.2C29.2 35.1 26.7 36 24 36c-5.2 0-9.6-3.3-11.3-7.9l-6.5 5C9.5 39.6 16.2 44 24 44z"/><path fill="#1976D2" d="M43.6 20.5H42V20H24v8h11.3c-.8 2.2-2.2 4.2-4.1 5.6l6.2 5.2C37 39.2 44 34 44 24c0-1.3-.1-2.4-.4-3.5z"/></svg>
|
| 165 |
+
{t("google")}
|
| 166 |
+
</Button>
|
| 167 |
+
<div className="flex items-center gap-3 text-sm text-muted"><span className="h-px flex-1 bg-line" />{t("or")}<span className="h-px flex-1 bg-line" /></div>
|
| 168 |
+
</>
|
| 169 |
+
)}
|
| 170 |
+
{mode === "signup" && (
|
| 171 |
+
<Field label={kind === "company" ? t("your_name") : t("full_name")}>
|
| 172 |
+
<Input value={name} onChange={(e) => setName(e.target.value)} required autoComplete="name" />
|
| 173 |
+
</Field>
|
| 174 |
+
)}
|
| 175 |
+
{mode === "signup" && kind === "company" && (
|
| 176 |
+
<Field label={t("company_name")}><Input value={company} onChange={(e) => setCompany(e.target.value)} required minLength={2} autoComplete="organization" /></Field>
|
| 177 |
+
)}
|
| 178 |
+
<Field label={kind === "company" && mode === "signup" ? t("work_email") : t("email")}>
|
| 179 |
+
<Input type="email" value={email} onChange={(e) => setEmail(e.target.value)} required autoComplete="email" dir="ltr" />
|
| 180 |
+
</Field>
|
| 181 |
+
<div>
|
| 182 |
+
<div className="mb-1.5 flex items-center justify-between">
|
| 183 |
+
<label htmlFor="pw" className="text-sm font-medium text-ink">{t("password")}</label>
|
| 184 |
+
{mode === "signin" && config?.supabase_url && (
|
| 185 |
+
<button type="button" onClick={forgot} className="text-sm text-nile hover:underline">{t("forgot")}</button>
|
| 186 |
+
)}
|
| 187 |
+
</div>
|
| 188 |
+
<div className="relative">
|
| 189 |
+
<Input id="pw" type={showPw ? "text" : "password"} value={password} onChange={(e) => setPassword(e.target.value)} required
|
| 190 |
+
minLength={mode === "signup" ? 8 : 1} autoComplete={mode === "signup" ? "new-password" : "current-password"} dir="ltr" className="pe-11" />
|
| 191 |
+
<button type="button" onClick={() => setShowPw((v) => !v)} aria-label={showPw ? t("hide_password") : t("show_password")}
|
| 192 |
+
className="absolute end-2 top-1/2 -translate-y-1/2 rounded-lg p-1.5 text-muted hover:text-ink">
|
| 193 |
+
{showPw ? <EyeOff size={18} /> : <Eye size={18} />}
|
| 194 |
+
</button>
|
| 195 |
+
</div>
|
| 196 |
+
{mode === "signup" && <span className="mt-1 block text-xs text-muted">{t("password_hint")}</span>}
|
| 197 |
+
</div>
|
| 198 |
+
{error && <ErrorNote>{error}</ErrorNote>}
|
| 199 |
+
<Button type="submit" busy={busy} className="w-full" size="lg">
|
| 200 |
+
{mode === "signin" ? t("sign_in") : kind === "company" ? t("create_company_account") : t("sign_up")}
|
| 201 |
</Button>
|
| 202 |
+
</form>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
)}
|
| 204 |
+
|
| 205 |
+
<p className="mt-8 text-center text-sm text-muted">
|
| 206 |
+
{mode === "signin" ? t("no_account") : t("have_account")}{" "}
|
| 207 |
+
<Link to={`${mode === "signin" ? "/signup" : "/login"}${qs()}`} className="font-medium text-nile hover:underline">
|
| 208 |
+
{mode === "signin" ? t("sign_up") : t("sign_in")}
|
| 209 |
+
</Link>
|
| 210 |
+
</p>
|
| 211 |
+
</div>
|
| 212 |
+
</main>
|
| 213 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
</div>
|
| 215 |
);
|
| 216 |
}
|