freshyo/apps/web-ui/.output/public/assets/register-D51Ue4qE.js
2026-05-10 16:45:39 +05:30

1 line
No EOL
1.7 KiB
JavaScript

import{c as e,d as t,f as n,h as r,l as i,u as a}from"./src-C0xjWfnx.js";import{t as o}from"./useNavigate-VRicZWJI.js";import{n as s}from"./trpc-client-QrVjRqP1.js";import{l as c}from"./index-BXnbw4dQ.js";var l=r(n()),u=t();function d(){let{register:t}=c(),n=o(),[r,d]=(0,l.useState)(``),[f,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(``),[g,_]=(0,l.useState)(``),v=s.user.auth.register.useMutation({onSuccess:e=>{e.token&&e.user&&(t(e.token,e.user),n({to:`/home`}))}});return(0,u.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-gradient-to-b from-brand-400 to-brand-700 p-4`,children:(0,u.jsxs)(`div`,{className:`w-full max-w-md`,children:[(0,u.jsx)(a,{weight:`bold`,className:`mb-2 text-center text-4xl text-white`,children:`Create Account`}),(0,u.jsx)(a,{className:`mb-8 text-center text-lg text-blue-100`,children:`Join Freshyo today`}),(0,u.jsx)(`div`,{className:`rounded-2xl bg-white p-8 shadow-xl`,children:(0,u.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),v.mutate({name:r,email:f,mobile:m,password:g})},className:`flex flex-col gap-4`,children:[(0,u.jsx)(e,{placeholder:`Full Name`,value:r,onChange:e=>d(e.target.value),required:!0}),(0,u.jsx)(e,{placeholder:`Email`,type:`email`,value:f,onChange:e=>p(e.target.value)}),(0,u.jsx)(e,{placeholder:`Mobile Number`,value:m,onChange:e=>{let t=e.target.value.replace(/\D/g,``);t.length<=10&&h(t)},required:!0}),(0,u.jsx)(e,{placeholder:`Password`,type:`password`,value:g,onChange:e=>_(e.target.value),required:!0}),(0,u.jsx)(i,{type:`submit`,fullWidth:!0,className:`mt-2 h-12 rounded-xl bg-brand-600 text-white shadow-lg`,disabled:v.isPending,textContent:v.isPending?`Creating...`:`Register`})]})})]})})}export{d as component};