|
1 | | -import React from 'react'; |
| 1 | +//Firebase |
| 2 | +import { auth } from '../../Firebase/firebase'; |
| 3 | + |
| 4 | + |
| 5 | +//Components |
| 6 | +import { Button } from '../../Components'; |
| 7 | + |
| 8 | +//Toast |
| 9 | +import { toast, ToastContainer } from "react-toastify"; |
| 10 | +import 'react-toastify/dist/ReactToastify.css'; |
| 11 | + |
| 12 | + |
| 13 | +// const contacts = ['Contact 1', 'Contact 2', 'Contact 3', 'Contact 4', 'Contact 5', 'Contact 6']; |
2 | 14 |
|
3 | | -// Sample data for contacts |
4 | | -const contacts = ['Contact 1', 'Contact 2', 'Contact 3', 'Contact 4', 'Contact 5', 'Contact 6']; |
5 | 15 |
|
6 | 16 | const Dashboard = () => { |
| 17 | + |
| 18 | + |
| 19 | + const handleSignout = () => { |
| 20 | + auth.signOut() |
| 21 | + toast.error(('Signing Out!'), { |
| 22 | + position: 'top-right' |
| 23 | + }) |
| 24 | + setTimeout(() => { |
| 25 | + window.location.href = 'login' |
| 26 | + }, 2000) |
| 27 | + } |
| 28 | + |
7 | 29 | return ( |
8 | | - <div className="min-h-screen flex bg-gray-100"> |
9 | | - {/* Sidebar */} |
10 | | - <aside className="bg-white bg-opacity-10 backdrop-blur-md h-screen w-64 p-5 shadow-lg flex flex-col justify-between"> |
11 | | - <nav className="space-y-6 text-xl text-gray-800 flex flex-col gap-y-[20px]"> |
12 | | - <button className="hover:text-gray-600">Chats</button> |
13 | | - <button className="hover:text-gray-600">Contacts</button> |
14 | | - <button className="hover:text-gray-600">Settings</button> |
15 | | - </nav> |
16 | | - <button className="w-full py-3 bg-red-500 hover:bg-red-600 text-white text-lg rounded-lg">Logout</button> |
17 | | - </aside> |
18 | | - |
19 | | - {/* Main Section */} |
20 | | - <main className="flex-1 flex p-6 justify-center items-center"> |
21 | | - {/* Contact List */} |
22 | | - <section className="w-1/3 bg-white bg-opacity-10 backdrop-blur-md rounded-lg shadow-lg p-4 overflow-y-auto h-[80vh]"> |
23 | | - <h2 className="text-lg font-bold mb-4 text-center">Contacts</h2> |
24 | | - <div className="space-y-4"> |
25 | | - {contacts.map((contact, index) => ( |
26 | | - <button key={index} className="w-full p-3 bg-white bg-opacity-20 hover:bg-opacity-30 rounded-lg text-gray-800"> |
27 | | - {contact} |
28 | | - </button> |
29 | | - ))} |
30 | | - </div> |
31 | | - </section> |
32 | | - |
33 | | - {/* Scrollable Chat Section */} |
34 | | - <section className="flex-1 ml-6 bg-white bg-opacity-10 backdrop-blur-md rounded-lg shadow-lg p-4 h-[80vh]"> |
35 | | - <div className="overflow-y-auto h-full"> |
36 | | - <p className="text-center text-lg text-gray-600">Scrollbar content</p> |
37 | | - </div> |
38 | | - </section> |
39 | | - </main> |
40 | | - </div> |
| 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> |
| 54 | + |
| 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> |
| 63 | + |
| 64 | + <> |
| 65 | + <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} /> |
| 68 | + </div> |
| 69 | + <ToastContainer /> |
| 70 | + </> |
41 | 71 | ); |
42 | 72 | }; |
43 | 73 |
|
|
0 commit comments