2 lines
4.2 KiB
JavaScript
2 lines
4.2 KiB
JavaScript
import{s as w,t as v,v as z,j as e,u as C,r as a,_ as I,T as h,V as $,$ as A,B as E,a0 as D}from"./index-TNj5auBr.js";import{C as L}from"./Card-Cvh0wiAW.js";import{S as P,H as B}from"./HStack-tSPMb9QU.js";import{B as F}from"./Banner-DVJsik2E.js";import{T as k}from"./TextInput-DL-5979h.js";import{M as N}from"./mail-DG37riix.js";import{L as H,E as R}from"./lock-8veRwQu6.js";import{C as T}from"./CheckboxInput-BZ6EBRFv.js";const u={base:{k1xSpc:"x78zum5",$$css:!0},inline:{k1xSpc:"x3nfvp2",$$css:!0},alignItemsCenter:{kGNEyG:"x6s0dn4",$$css:!0},justifyContentCenter:{kjj79g:"xl56j7k",$$css:!0}},K={sizing:(s,r)=>[{kzqmXN:s!=null?"x5lhr3w":s,kZKoxP:r!=null?"x16ye13r":r,$$css:!0},{"--x-width":(t=>typeof t=="number"?t+"px":t??void 0)(s),"--x-height":(t=>typeof t=="number"?t+"px":t??void 0)(r)}]};function S({axis:s="both",width:r,height:t,isInline:o=!1,children:l,xstyle:n,className:g,style:c,ref:d,...x}){const m=w(z("center",{axis:s}),v(o?u.inline:u.base,(s==="both"||s==="vertical")&&u.alignItemsCenter,(s==="both"||s==="horizontal")&&u.justifyContentCenter,K.sizing(r??null,t??null),n),g,c);return e.jsx("div",{ref:d,...m,...x,children:l})}S.displayName="Center";function p({ref:s,justify:r,align:t,hAlign:o,vAlign:l,...n}){return e.jsx(P,{...n,direction:"vertical",hAlign:o??t,vAlign:l??r,ref:s})}p.displayName="VStack";const M="/assets/mid-mile-approach-Drwn-ig9.jpg";function Y(){const s=C(),[r,t]=a.useState(!1),[o,l]=a.useState(""),[n,g]=a.useState(""),[c,d]=a.useState(""),[x,m]=a.useState(!0),[b,y]=a.useState(!1),f=async()=>{if(!(!o||!n||b)){y(!0),d("");try{const i=await D(o,n);localStorage.setItem("logged_in","true"),localStorage.setItem("auth_token",i.token),localStorage.setItem("user",JSON.stringify(i.user)),s("/dashboard")}catch(i){d(i.message||"Invalid email or password")}finally{y(!1)}}},j=i=>{i.key==="Enter"&&f()};return e.jsxs("div",{style:{minHeight:"100vh",position:"relative",backgroundImage:`url(${M})`,backgroundSize:"cover",backgroundPosition:"center",fontFamily:"system-ui, sans-serif"},children:[e.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(180deg, rgba(15,23,42,0.6) 0%, rgba(192, 18, 39, 0.8) 100%)"}}),e.jsx(S,{axis:"both",style:{position:"relative",minHeight:"100vh",padding:"16px",boxSizing:"border-box"},children:e.jsx(L,{padding:8,width:"100%",maxWidth:440,style:{background:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",border:"1px solid rgba(255, 255, 255, 0.5)",boxShadow:"0 24px 48px rgba(0,0,0,0.2)",boxSizing:"border-box"},children:e.jsxs(p,{gap:4,hAlign:"stretch",children:[e.jsxs(p,{gap:1,hAlign:"center",children:[e.jsx("div",{style:{marginBottom:"8px"},children:e.jsx(I,{})}),e.jsx(h,{type:"display-1",as:"h2",children:"Welcome back"}),e.jsx(h,{type:"body",color:"secondary",size:"sm",children:"Sign in to your Doormile operations account."})]}),c&&e.jsx(F,{status:"error",title:c}),e.jsxs(p,{gap:3,children:[e.jsx(k,{label:"Email",isRequired:!0,size:"lg",type:"email",placeholder:"admin@doormile.com",value:o,onChange:l,onKeyDown:j,startIcon:e.jsx(N,{size:16}),hasAutoFocus:!0}),e.jsxs("div",{style:{position:"relative"},children:[e.jsx(k,{label:"Password",isRequired:!0,size:"lg",type:r?"text":"password",placeholder:"Enter your password",value:n,onChange:g,onKeyDown:j,startIcon:e.jsx(H,{size:16})}),e.jsx("button",{type:"button",onClick:()=>t(i=>!i),"aria-label":r?"Hide password":"Show password",style:{position:"absolute",right:"10px",bottom:0,height:"36px",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",color:"#64748b",padding:0,zIndex:10},children:r?e.jsx($,{size:16}):e.jsx(R,{size:16})})]})]}),e.jsxs(B,{hAlign:"between",vAlign:"center",children:[e.jsx(T,{label:"Remember me",value:x,onChange:m}),e.jsx(A,{href:"#",size:"sm",color:"secondary",children:"Forgot password?"})]}),e.jsx(E,{label:"Sign In",variant:"primary",size:"lg",onClick:f,isLoading:b,isDisabled:!o||!n})]})})}),e.jsx("div",{style:{position:"absolute",bottom:"20px",left:0,right:0,textAlign:"center",zIndex:2},children:e.jsxs(h,{type:"supporting",style:{color:"rgba(255, 255, 255, 0.8)"},children:["© ",new Date().getFullYear()," Doormile Technologies. All rights reserved."]})})]})}export{Y as default};
|