Files
Investidor-V2/resources/js/pages/auth/register.tsx
T
paulomassigue 2209b83820
tests / ci (push) Canceled after 0s
login de cadastro padronizado
2026-11-09 15:05:20 +02:00

162 lines
7.4 KiB
TypeScript

import { participationIdentity } from '@/lib/participation-identity';
import { useTempoUi } from '@/components/tempo-brand';
import { Form, Head } from '@inertiajs/react';
import { UserPlus } from 'lucide-react';
import AuthTempoCard from '@/components/auth-tempo-card';
import InputError from '@/components/input-error';
import PasswordInput from '@/components/password-input';
import TextLink from '@/components/text-link';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Spinner } from '@/components/ui/spinner';
import { login } from '@/routes';
import { store } from '@/routes/register';
type Props = {
passwordRules: string;
};
const controlClass =
'h-auto rounded-xl border-slate-300 bg-white px-3.5 py-3 text-sm text-slate-900 shadow-sm placeholder:text-slate-400 hover:border-slate-400 focus-visible:border-[#ed1c24] focus-visible:ring-4 focus-visible:ring-[#ed1c24]/10';
const labelClass =
'mb-1.5 block text-xs leading-normal font-bold text-slate-800';
export default function Register({ passwordRules }: Props) {
const { t } = useTempoUi();
return (
<>
<Head title={t('Criar conta')} />
<AuthTempoCard
badge={t('Bolsa de Parcerias, Investidores e Capital')}
title={t('Criar conta')}
description={t(
'Crie uma conta simples para continuar e acompanhar a sua operação. Não é necessário configurar MFA para participar.',
)}
footer={
<>
{t('Já tem conta?')}{' '}
<TextLink
href={login()}
tabIndex={6}
className="font-bold text-[#ed1c24] no-underline hover:underline"
>
{t('Entrar')}
</TextLink>
</>
}
>
<Form
{...store.form()}
resetOnSuccess={['password', 'password_confirmation']}
disableWhileProcessing
className="flex flex-col gap-5"
>
{({ processing, errors }) => (
<div className="grid gap-5">
<div className="grid gap-1.5">
<Label htmlFor="name" className={labelClass}>
{t('Nome')}
</Label>
<Input
id="name"
defaultValue={participationIdentity().name}
type="text"
required
tabIndex={1}
autoComplete="name"
name="name"
placeholder={t('Nome completo')}
className={controlClass}
/>
<InputError message={errors.name} />
</div>
<div className="grid gap-1.5">
<Label htmlFor="email" className={labelClass}>
Email
</Label>
<Input
id="email"
defaultValue={participationIdentity().email}
type="email"
required
tabIndex={2}
autoComplete="email"
name="email"
placeholder="email@example.com"
className={controlClass}
/>
<InputError message={errors.email} />
</div>
<div className="grid gap-1.5">
<Label
htmlFor="password"
className={labelClass}
>
{t('Palavra-passe')}
</Label>
<PasswordInput
id="password"
required
tabIndex={3}
autoComplete="new-password"
name="password"
placeholder={t('Palavra-passe')}
passwordrules={passwordRules}
className={`${controlClass} pr-10`}
/>
<InputError message={errors.password} />
</div>
<div className="grid gap-1.5">
<Label
htmlFor="password_confirmation"
className={labelClass}
>
{t('Confirmar palavra-passe')}
</Label>
<PasswordInput
id="password_confirmation"
required
tabIndex={4}
autoComplete="new-password"
name="password_confirmation"
placeholder={t('Confirmar palavra-passe')}
passwordrules={passwordRules}
className={`${controlClass} pr-10`}
/>
<InputError
message={errors.password_confirmation}
/>
</div>
<Button
type="submit"
className="mt-1 flex w-full items-center justify-center gap-2 rounded-xl bg-[#ed1c24] px-6 py-4 font-bold text-white shadow-lg shadow-red-900/15 transition hover:-translate-y-0.5 hover:bg-[#c6161d] hover:shadow-xl disabled:translate-y-0 disabled:cursor-not-allowed disabled:opacity-60"
tabIndex={5}
data-test="register-user-button"
>
{processing ? (
<Spinner />
) : (
<UserPlus size={18} />
)}
{t('Criar conta')}
</Button>
</div>
)}
</Form>
</AuthTempoCard>
</>
);
}
Register.layout = {
variant: 'tempo-card',
title: 'Criar conta',
description:
'Crie uma conta simples para continuar e acompanhar a sua operação. Não é necessário configurar MFA para participar.',
};