11"use client" ;
22
33import { ChevronDownIcon } from "@heroicons/react/24/outline" ;
4- import DropDownLink from "./DropDownLink " ;
4+ import Link from "next/link " ;
55import Button from "@/components/Button" ;
66import { useAppDispatch , useUser } from "@/store/hooks" ;
77import { clientSignOut } from "@/store/features/auth/authSlice" ;
@@ -14,12 +14,18 @@ export default function DropDown({ openState }: { openState?: boolean }) {
1414 const activeVoyage = allVoyages ?. find (
1515 ( item ) => item . voyageTeam . voyage . status . name === "Active" ,
1616 ) ;
17- const currentVoyage =
18- activeVoyage ?. voyageTeam . name ??
19- "Please join a voyage to see your status information." ;
17+
18+ const currentVoyage = activeVoyage ?. voyageTeam . name
19+ ? `Team - Tier ${ activeVoyage . voyageTeam . name
20+ . split ( "-" ) [ 1 ]
21+ . split ( "tier" ) [ 1 ]
22+ . toUpperCase ( ) } ${ activeVoyage . voyageTeam . name
23+ . split ( "-" ) [ 0 ]
24+ . toUpperCase ( ) } `
25+ : "Please join a voyage to see your status information." ;
2026 const closed = "hidden" ;
2127 const open =
22- "absolute z-[1] w-44 p-4 [&>*]:mt-2 mt-6 shadow bg-base-100 right-0 border border-neutral rounded-2xl" ;
28+ "absolute flex flex-col gap-5 z-[1] w-[250px] p-5 bottom-100 translate-y-[15%] shadow-md bg-base-200 right-0 border border-base-100 rounded-2xl" ;
2329
2430 async function handleClick ( ) {
2531 const [ res , error ] = await serverSignOut ( ) ;
@@ -35,7 +41,7 @@ export default function DropDown({ openState }: { openState?: boolean }) {
3541 }
3642 }
3743
38- const handleDropDownClick = ( event : React . MouseEvent < HTMLUListElement > ) => {
44+ const handleDropDownClick = ( event : React . MouseEvent < HTMLDivElement > ) => {
3945 event . stopPropagation ( ) ;
4046 } ;
4147
@@ -47,35 +53,45 @@ export default function DropDown({ openState }: { openState?: boolean }) {
4753 >
4854 < ChevronDownIcon className = "w-4 cursor-pointer text-base-300" />
4955 </ label >
50- < ul
56+ < div
5157 tabIndex = { 0 }
5258 className = { openState ? open : closed }
5359 onClick = { handleDropDownClick }
5460 >
55- < li className = "rounded-lg bg-secondary-content p-2 text-xs [&>*]:m-1" >
56- < p className = "text-xs text-neutral" > My Status:</ p >
57- { currentVoyage ? (
58- < p className = "border border-transparent font-semibold text-base-300" >
61+ < div className = "rounded-lg bg-secondary-content p-2 text-xs [&>*]:m-1" >
62+ < p className = "text-[10px] font-medium text-neutral-focus" >
63+ My Voyage:
64+ </ p >
65+ { activeVoyage ?. voyageTeam . name ? (
66+ < p className = "border border-transparent text-base font-medium text-base-300" >
5967 { currentVoyage }
6068 </ p >
6169 ) : (
6270 < p className = "border-transparent font-semibold text-base-300" >
6371 { currentVoyage }
6472 </ p >
6573 ) }
66- </ li >
67- < DropDownLink title = "Settings" href = "/hello404" />
74+ </ div >
75+ < Link href = "/hello404" >
76+ < Button
77+ type = "button"
78+ variant = "link"
79+ size = "lg"
80+ className = "m-0 flex w-full justify-start p-2 hover:bg-base-100 hover:text-base-300"
81+ >
82+ Settings
83+ </ Button >
84+ </ Link >
6885 < Button
69- title = "signout"
7086 type = "button"
7187 onClick = { handleClick }
7288 variant = "link"
73- size = { "lg" }
74- className = "m-0 flex w-full justify-start p-2 hover:bg-neutral-content hover:text-base-300"
89+ size = "lg"
90+ className = "m-0 flex w-full justify-start p-2 hover:bg-base-100 hover:text-base-300"
7591 >
7692 Sign Out
7793 </ Button >
78- </ ul >
94+ </ div >
7995 </ div >
8096 ) ;
8197}
0 commit comments