From 808138de633e410c1d3867d4fb7cb74967647605 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Tue, 30 Jul 2024 16:54:10 +0100 Subject: chore: remove ui directory (#2329) This is still in development, but rather than clutter the commit history and issues with an unreleased project I've split the UI into its own repo. Once ready for release, I'll either merge the ui code back in, or just make the repo public. --- ui/src/components/LoginOrRegister.tsx | 341 ---------------------------------- 1 file changed, 341 deletions(-) delete mode 100644 ui/src/components/LoginOrRegister.tsx (limited to 'ui/src/components/LoginOrRegister.tsx') diff --git a/ui/src/components/LoginOrRegister.tsx b/ui/src/components/LoginOrRegister.tsx deleted file mode 100644 index 97f8a790..00000000 --- a/ui/src/components/LoginOrRegister.tsx +++ /dev/null @@ -1,341 +0,0 @@ -import Logo from "@/assets/logo-light.svg"; -import { useState } from "react"; - -import { login, register } from "@/state/client"; -import { useStore } from "@/state/store"; - -interface LoginProps { - toggleRegister: () => void; - onClose: () => void; -} - -function Login(props: LoginProps) { - const refreshUser = useStore((state) => state.refreshUser); - const [errors, setErrors] = useState(null); - - const doLogin = async (e: React.FormEvent) => { - e.preventDefault(); - - const form = e.currentTarget; - const username = form.username.value; - const password = form.password.value; - const key = form.key.value; - - console.log("Logging in..."); - try { - await login(username, password, key); - refreshUser(); - props.onClose(); - } catch (e: any) { - console.error(e); - setErrors(e); - } - }; - - return ( - <> -
-
- Atuin - -

- Sign in to your account -

- -

- Backup and sync your data across devices. All data is end-to-end - encrypted and stored securely in the cloud. -

-
- -
-
-
- -
- -
-
- -
-
- -
- {/* You can't right now. Sorry. Validate emails first. - - Forgot password? - - */} -
-
-
- -
-
- -
-
- -
-
- -
-
- -
- -
-
- - {errors && ( -

{errors}

- )} - -

- Not a member?{" "} - { - e.preventDefault(); - props.toggleRegister(); - }} - > - Register - -

-
-
- - ); -} - -interface RegisterProps { - toggleLogin: () => void; - onClose: () => void; -} - -function Register(props: RegisterProps) { - const refreshUser = useStore((state) => state.refreshUser); - const [errors, setErrors] = useState(null); - - const doRegister = async (e: React.FormEvent) => { - e.preventDefault(); - - const form = e.currentTarget; - const username = form.username.value; - const email = form.email.value; - const password = form.password.value; - - try { - await register(username, email, password); - refreshUser(); - props.onClose(); - } catch (e: any) { - setErrors(e); - } - }; - - return ( - <> -
-
- Atuin - -

- Register for an account -

- -

- Backup and sync your data across devices. All data is end-to-end - encrypted and stored securely in the cloud. -

-
- -
-
-
- -
- -
-
- -
- -
- -
-
- -
-
- -
- {/* You can't right now. Sorry. Validate emails first. - - Forgot password? - - */} -
-
-
- -
-
- -
- -
-
- - {errors && ( -

{errors}

- )} - -

- Already have an account?{" "} - { - e.preventDefault(); - props.toggleLogin(); - }} - > - Login - -

-
-
- - ); -} - -export default function LoginOrRegister({ onClose }: { onClose: () => void }) { - let [login, setLogin] = useState(false); - - if (login) { - return setLogin(false)} />; - } - - return setLogin(true)} />; -} -- cgit v1.3.1