|
1 | 1 | import { type User } from '@/types' |
2 | 2 | import { Link, router } from '@inertiajs/react' |
3 | | -import React from 'react' |
| 3 | +import React, {useState} from 'react' |
4 | 4 | import { UserCircleIcon } from '@heroicons/react/24/solid' |
5 | 5 |
|
6 | 6 | interface Props { |
7 | 7 | user: User |
8 | 8 | } |
9 | 9 |
|
10 | 10 | export default function Navbar ({ user }: Props): JSX.Element { |
| 11 | + const [activeModal, setActiveModal] = useState(false) |
| 12 | + |
11 | 13 | return ( |
12 | | - <div className="navbar bg-base-100 shadow-md z-10"> |
13 | | - <div className="flex-1"> |
14 | | - {!route().current('home') |
15 | | - ? <a className="btn btn-ghost text-xl" onClick={() => { router.get('/home') }}>Stageboard</a> |
16 | | - : <a className="btn btn-ghost text-xl">Stageboard</a> |
17 | | - } |
18 | | - </div> |
| 14 | + <> |
| 15 | + <div className="navbar bg-base-100 shadow-md z-10"> |
| 16 | + <div className="flex-1"> |
| 17 | + {!route().current('home') |
| 18 | + ? <a className="btn btn-ghost text-xl" onClick={() => { |
| 19 | + router.get('/home') |
| 20 | + }}>Stageboard</a> |
| 21 | + : <a className="btn btn-ghost text-xl">Stageboard</a> |
| 22 | + } |
| 23 | + </div> |
19 | 24 |
|
20 | | - <div className="flex-none"> |
21 | | - <div className="dropdown dropdown-end"> |
22 | | - <div tabIndex={0} role="button" className="btn btn-ghost avatar"> |
23 | | - <p>{user.name}</p> |
24 | | - <div className="w-10 rounded-full"> |
25 | | - <UserCircleIcon /> |
| 25 | + <div className="flex-none"> |
| 26 | + <div className="dropdown dropdown-end"> |
| 27 | + <div tabIndex={0} role="button" className="btn btn-ghost avatar"> |
| 28 | + <p>{user.name}</p> |
| 29 | + <div className="w-10 rounded-full"> |
| 30 | + <UserCircleIcon/> |
| 31 | + </div> |
26 | 32 | </div> |
| 33 | + <ul className="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"> |
| 34 | + <li> |
| 35 | + <Link href={route('profile.edit')} as="button">Profile</Link> |
| 36 | + </li> |
| 37 | + <li> |
| 38 | + <Link href={route('web.page.home')} as="button">Home</Link> |
| 39 | + </li> |
| 40 | + <li> |
| 41 | + <button onClick={() => { setActiveModal(true) }}>About</button> |
| 42 | + </li> |
| 43 | + <li></li> |
| 44 | + <li> |
| 45 | + <Link href={route('logout')} method="post" as="button">Logout</Link> |
| 46 | + </li> |
| 47 | + </ul> |
27 | 48 | </div> |
28 | | - <ul className="menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"> |
29 | | - <li> |
30 | | - <Link href={route('profile.edit')} as="button">Profile</Link> |
31 | | - </li> |
32 | | - <li> |
33 | | - <Link href={route('web.page.home')} as="button">Home</Link> |
34 | | - </li> |
35 | | - <li></li> |
36 | | - <li> |
37 | | - <Link href={route('logout')} method="post" as="button">Logout</Link> |
38 | | - </li> |
39 | | - </ul> |
40 | 49 | </div> |
41 | 50 | </div> |
42 | | - </div> |
| 51 | + <dialog className={'modal' + (activeModal ? ' modal-open' : '')}> |
| 52 | + <div className="modal-box"> |
| 53 | + <h3 className="font-bold text-lg mb-4">About Stageboard</h3> |
| 54 | + <div className="text-sm space-y-4"> |
| 55 | + <div> |
| 56 | + <p>Stageboard v{import.meta.env.VITE_APP_VERSION}</p> |
| 57 | + </div> |
| 58 | + <div> |
| 59 | + <p>Created by: Ivan Rizkyanto</p> |
| 60 | + |
| 61 | + </div> |
| 62 | + <div> |
| 63 | + <a href="https://github.com/stackpan/stageboard/blob/main/LICENSE" className="text-purple-800">MIT License</a> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + <div className="modal-action"> |
| 67 | + <button |
| 68 | + onClick={() => { |
| 69 | + setActiveModal(false) |
| 70 | + }} |
| 71 | + className="btn btn-sm btn-outline" |
| 72 | + > |
| 73 | + Close |
| 74 | + </button> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + </dialog> |
| 78 | + </> |
43 | 79 | ) |
44 | 80 | } |
0 commit comments