diff --git a/client/src/pages/Home.jsx b/client/src/pages/Home.jsx index c5001bae..a1d327dd 100644 --- a/client/src/pages/Home.jsx +++ b/client/src/pages/Home.jsx @@ -1,101 +1,89 @@ import React, { useState } from 'react'; - -import { IoIosArrowRoundBack } from "react-icons/io"; +import { IoIosArrowRoundBack } from 'react-icons/io'; import { useNavigate } from 'react-router-dom'; - import Login from './Login'; import { useAuth } from 'src/context/AuthContext'; import { useDialog } from 'src/context/DialogContext'; - const userID = Math.random().toFixed(12).toString(36).slice(2); - const Home = () => { - const { dispatchAuth } = useAuth(); - const { setDialog } = useDialog(); - const navigate = useNavigate(); - - - const [isLogginWithEmail, setIsLogginWithEmail] = useState(false); - - - function loginAnonymously() { - dispatchAuth({ - type: 'LOGIN', - payload: { - loginType: 'anonymous', - loginId: userID, - email: null, - }, - }); - } - - - const handleLoginAnonymously = () => { - setDialog({ - isOpen: true, - text: 'Are you sure you want to login anonymously?', - noBtnText: 'Cancel', - yesBtnText: 'Yes, log in anonymously', - handler: loginAnonymously - }); - }; - - - const handleBackClick = () => { - navigate(-1); // Go back to the previous page - }; - - - return ( -
-
-
- {isLogginWithEmail &&
- -
} -
-

WHISPER

-

- Chat anonymously and safely with people for free -

-
- - - {isLogginWithEmail ? ( - - ) : ( -
- - -
- )} -
-
- -
-
-
- ); + const { dispatchAuth } = useAuth(); + const { setDialog } = useDialog(); + const navigate = useNavigate(); + + const [isLogginWithEmail, setIsLogginWithEmail] = useState(false); + + function loginAnonymously() { + dispatchAuth({ + type: 'LOGIN', + payload: { + loginType: 'anonymous', + loginId: userID, + email: null, + }, + }); + } + + const handleLoginAnonymously = () => { + setDialog({ + isOpen: true, + text: 'Are you sure you want to login anonymously?', + noBtnText: 'Cancel', + yesBtnText: 'Yes, log in anonymously', + handler: loginAnonymously, + }); + }; + + const handleBackClick = () => { + navigate(-1); // Go back to the previous page + }; + + return ( +
+
+
+ {isLogginWithEmail && ( +
+ +
+ )} +
+

WHISPER

+

+ Chat anonymously and safely with people for free +

+
+ + {isLogginWithEmail ? ( + + ) : ( +
+ + +
+ )} +
+
+ +
+
+
+ ); }; - export default Home; - - -