Join-9df7f4fb.js (3519B)
1 import{n as y,r as s,u as j,j as e}from"./vendor-95a06cbd.js";import{C as N,H as C}from"./index-96e8ccca.js";const m="inline-block p-4 w-full text-gray-900 bg-gray-100 hover:ring-blue-300 hover:ring-1 focus:ring-transparent focus:outline-none dark:bg-gray-700 dark:text-white",x="inline-block p-4 w-full bg-white hover:text-gray-700 hover:bg-gray-50 hover:ring-blue-300 hover:ring-1 focus:ring-transparent focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700";function _(){const f=y(),r=s.useContext(N),[n,p]=s.useState("https://matrix.art.midnightthoughts.space"),[o,b]=s.useState(""),[l,w]=s.useState(""),[h,v]=s.useState(!0),[a,g]=s.useState("login"),{t}=j(),k=async c=>{r&&(n===""||o===""||l===""||(a==="login"&&!(r!=null&&r.isLoggedIn())?await r.login(n,o,l,h):a==="register"&&!r.isLoggedIn()&&await r.register(n,o,l,h),f("/",{replace:!0})))},i=c=>{const d=c.target,u=d.type==="checkbox"?d.checked:d.value;switch(d.name){case"homeserver":{p(u);break}case"username":{b(u);break}case"password":{w(u);break}case"createProfile":{v(u);break}}};return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("header",{children:e.jsx(C,{})}),e.jsxs("main",{className:"m-12 mt-6",children:[e.jsx("h1",{className:"text-3xl font-bold mb-4 text-white",children:t("Join")}),e.jsxs("div",{className:"flex items-center flex-col",children:[e.jsxs("ul",{className:"w-1/4 mb-8 hidden text-sm font-medium text-center text-gray-500 rounded-lg divide-x divide-gray-200 shadow sm:flex dark:divide-gray-700 dark:text-gray-400",children:[e.jsx("li",{className:"w-full",children:e.jsx("a",{href:"#",className:a==="login"?`${m} rounded-l-lg`:`${x} rounded-l-lg`,onClick:c=>{g("login")},children:t("Login")})}),e.jsx("li",{className:"w-full",children:e.jsx("a",{href:"#",className:a==="register"?`${m} rounded-r-lg`:`${x} rounded-r-lg`,onClick:c=>{g("register")},children:t("Register")})})]}),e.jsxs("form",{onSubmit:k,className:"flex flex-col items-start w-1/4",children:[e.jsx("input",{className:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder:text-data text-white mb-4 w-full",type:"url",placeholder:t("Homeserver"),name:"homeserver",value:n,onInput:i}),e.jsx("input",{className:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder:text-data text-white mb-4 w-full",autoComplete:"username",type:"text",placeholder:t("Username"),name:"username",value:o,onInput:i}),e.jsx("input",{className:"search-bg shadow rounded-lg border-0 py-3 px-4 placeholder:text-data text-white mb-4 w-full",autoComplete:"current-password",type:"password",placeholder:t("Password"),name:"password",value:l,onInput:i}),e.jsxs("label",{className:"mb-4 flex items-center",children:[e.jsx("input",{className:"checked:bg-blue-600 checked:border-transparent checked:bg-no-repeat checked:bg-[url('/tick.svg')] outline-none focus:outline-offset-2 focus:ring-blue-600 focus:ring-offset-2 focus:ring-offset-white p-0 inline-block align-middle box-border select-none shrink-0 shadow h-5 w-5 appearance-none rounded bg-white border-none",type:"checkbox",name:"createProfile",checked:h,onChange:i}),e.jsx("span",{className:"ml-4 text-data text-base font-medium",children:t("Create account")})]}),e.jsx("button",{type:"submit",className:"text-white font-bold text-lg logo-bg rounded-xl py-2 px-10 shadow transition-transform ease-in-out duration-300 hover:scale-105 w-1/2 self-center justify-center flex",children:t(a==="login"?"Login":"Register")})]})]})]})]})}export{_ as default}; 2 //# sourceMappingURL=Join-9df7f4fb.js.map