Skip to content

Commit 13f38ad

Browse files
committed
Your commit message here
1 parent a31a4bb commit 13f38ad

File tree

5 files changed

+46
-81
lines changed

5 files changed

+46
-81
lines changed

src/App.jsx

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Login, Signup, FourOfour, Verification, Dashboard } from "./Pages"
22

33
import { createBrowserRouter, RouterProvider } from "react-router-dom"
4-
import { AppLayout } from "./Layout"
54

65
import { useSelector } from "react-redux"
76

@@ -12,25 +11,23 @@ function App() {
1211
const router = createBrowserRouter([
1312
{
1413
path: '/',
15-
element: <AppLayout />,
16-
children: [
17-
{
18-
path: 'login',
19-
element: <Login />
20-
},
21-
{
22-
path: 'signup',
23-
element: <Signup />
24-
},
25-
{
26-
path: 'verification',
27-
element: <Verification email={email} />
28-
},
29-
{
30-
path: 'dashboard',
31-
element: <Dashboard />
32-
}
33-
]
14+
element: <Login />
15+
},
16+
{
17+
path: '/login',
18+
element: <Login />
19+
},
20+
{
21+
path: '/signup',
22+
element: <Signup />
23+
},
24+
{
25+
path: '/verification',
26+
element: <Verification email={email} />
27+
},
28+
{
29+
path: '/dashboard',
30+
element: <Dashboard />
3431
},
3532
{
3633
path: '*',

src/Layout/AppLayout.jsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/Layout/index.jsx

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/Pages/404/fourOfour.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import React from 'react'
22

33
const FourOfour = () => {
4+
5+
const backToLogin = () => {
6+
window.location.href = '/login';
7+
}
8+
49
return (
510
<div className="lg:px-24 lg:py-24 md:py-20 md:px-44 px-4 py-24 items-center flex justify-center flex-col-reverse lg:flex-row md:gap-28 gap-16">
611
<div className="xl:pt-24 w-full xl:w-1/2 relative pb-12 lg:pb-0">
@@ -13,7 +18,7 @@ const FourOfour = () => {
1318
doorway to the great nothing
1419
</h1>
1520
<p className="my-2 text-gray-800">Sorry about that! Please visit our hompage to get where you need to go.</p>
16-
<button className="sm:w-full lg:w-auto my-2 border rounded md py-4 px-8 text-center bg-indigo-600 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-700 focus:ring-opacity-50">Take me there!</button>
21+
<button className="sm:w-full lg:w-auto my-2 border rounded md py-4 px-8 text-center bg-indigo-600 text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-700 focus:ring-opacity-50" onClick={backToLogin}>Take me there!</button>
1722
</div>
1823
</div>
1924
<div>

src/Pages/Dashboard/Dashboard.jsx

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
//Firebase
21
import { auth } from '../../Firebase/firebase';
32

3+
//React Hooks
4+
import { useState, useEffect } from 'react';
45

56
//Components
67
import { Button } from '../../Components';
@@ -9,62 +10,38 @@ import { Button } from '../../Components';
910
import { toast, ToastContainer } from "react-toastify";
1011
import 'react-toastify/dist/ReactToastify.css';
1112

12-
13-
// const contacts = ['Contact 1', 'Contact 2', 'Contact 3', 'Contact 4', 'Contact 5', 'Contact 6'];
14-
15-
1613
const Dashboard = () => {
1714

18-
1915
const handleSignout = () => {
2016
auth.signOut()
21-
toast.error(('Signing Out!'), {
17+
toast.error('Signing Out!', {
2218
position: 'top-right'
23-
})
19+
});
2420
setTimeout(() => {
25-
window.location.href = 'login'
26-
}, 2000)
27-
}
21+
window.location.href = '/login';
22+
}, 2000);
23+
};
2824

29-
return (
30-
// <div className="min-h-screen flex bg-gray-100">
31-
// {/* Sidebar */}
32-
// <aside className="bg-white bg-opacity-10 backdrop-blur-md h-screen w-64 p-5 shadow-lg flex flex-col justify-between">
33-
// <nav className="space-y-6 text-xl text-gray-800 flex flex-col gap-y-[20px]">
34-
// <button className="hover:text-gray-600">Chats</button>
35-
// <button className="hover:text-gray-600">Contacts</button>
36-
// <button className="hover:text-gray-600">Settings</button>
37-
// </nav>
38-
// <button className="w-full py-3 bg-red-500 hover:bg-red-600 text-white text-lg rounded-lg">Logout</button>
39-
// </aside>
40-
41-
// {/* Main Section */}
42-
// <main className="flex-1 flex p-6 justify-center items-center">
43-
// {/* Contact List */}
44-
// <section className="w-1/3 bg-white bg-opacity-10 backdrop-blur-md rounded-lg shadow-lg p-4 overflow-y-auto h-[80vh]">
45-
// <h2 className="text-lg font-bold mb-4 text-center">Contacts</h2>
46-
// <div className="space-y-4">
47-
// {contacts.map((contact, index) => (
48-
// <button key={index} className="w-full p-3 bg-white bg-opacity-20 hover:bg-opacity-30 rounded-lg text-gray-800">
49-
// {contact}
50-
// </button>
51-
// ))}
52-
// </div>
53-
// </section>
25+
const [currentUser, setCurrentUser] = useState('');
5426

55-
// {/* Scrollable Chat Section */}
56-
// <section className="flex-1 ml-6 bg-white bg-opacity-10 backdrop-blur-md rounded-lg shadow-lg p-4 h-[80vh]">
57-
// <div className="overflow-y-auto h-full">
58-
// <p className="text-center text-lg text-gray-600">Scrollbar content</p>
59-
// </div>
60-
// </section>
61-
// </main>
62-
// </div>
27+
useEffect(() => {
28+
const user = auth.currentUser;
29+
if (user) {
30+
setCurrentUser(user.displayName);
31+
} else {
32+
setCurrentUser('');
33+
}
34+
}, []);
6335

36+
return (
6437
<>
6538
<div className='w-full h-full min-h-screen flex flex-col justify-center items-center'>
66-
<p>Welcome {auth.currentUser.displayName}</p>
67-
<Button name="Signout" customClass='bg-red-500 hover:bg-red-400 max-w-[350px] w-full mx-[30px]' onCLick={handleSignout} />
39+
<p>Welcome {currentUser || 'User'}</p>
40+
<Button
41+
name="Signout"
42+
customClass='bg-red-500 hover:bg-red-400 max-w-[350px] w-full mx-[30px]'
43+
onClick={handleSignout}
44+
/>
6845
</div>
6946
<ToastContainer />
7047
</>

0 commit comments

Comments
 (0)