@@ -11,9 +11,20 @@ import {
1111 DropdownMenuSeparator ,
1212 DropdownMenuTrigger ,
1313} from '@/components/ui/dropdown-menu' ;
14+ import {
15+ Select ,
16+ SelectContent ,
17+ SelectGroup ,
18+ SelectItem ,
19+ SelectLabel ,
20+ SelectSeparator ,
21+ SelectTrigger ,
22+ SelectValue ,
23+ } from '@/components/ui/select' ;
1424import { Skeleton } from '@/components/ui/skeleton' ;
1525import { AuthContext } from '@/context/auth.context' ;
1626import { useCurrentElectionRoundStore } from '@/context/election-round.store' ;
27+ import { ElectionEvent } from '@/features/election-event/models/election-event' ;
1728import { electionRoundKeys } from '@/features/election-rounds/queries' ;
1829import { staticDataKeys } from '@/hooks/query-keys' ;
1930import { sleep } from '@/lib/utils' ;
@@ -28,7 +39,7 @@ import { sortBy } from 'lodash';
2839import { Fragment , useContext , useEffect , useMemo , useState } from 'react' ;
2940import { ElectionRoundStatus , type FunctionComponent } from '../../../common/types' ;
3041import Logo from './Logo' ;
31- import { ElectionEvent } from '@/features/election-event/models/election-event ' ;
42+ import { Label } from '@/components/ui/label ' ;
3243
3344const navigation = [
3445 { name : 'Dashboard' , to : '/' , roles : [ 'PlatformAdmin' , 'NgoAdmin' ] } ,
@@ -312,7 +323,58 @@ const Header = (): FunctionComponent => {
312323 { item . name }
313324 </ Disclosure . Button >
314325 ) ) }
326+ { userRole !== 'NgoAdmin' ? (
327+ < > </ >
328+ ) : status === 'pending' ? (
329+ < Skeleton className = 'w-[360px] h-[26px] mr-2 rounded-lg bg-secondary-300 text-secondary-900 hover:bg-secondary-300/90' />
330+ ) : (
331+ < div className = 'px-4 py-2 space-y-2 ' >
332+ < Label > Elecction rounds</ Label >
333+ < Select
334+ defaultValue = { selectedElectionRound ?. id ?? '' }
335+ onValueChange = { ( value ) => {
336+ const electionRound = electionRounds ?. find ( ( er ) => er . id === value ) ;
337+ handleSelectElectionRound ( electionRound ) ;
338+ } } >
339+ < SelectTrigger className = 'w-full' >
340+ < SelectValue placeholder = 'Select language' />
341+ </ SelectTrigger >
342+ < SelectContent >
343+ < SelectGroup >
344+ < SelectLabel > Active & Upcomming elections </ SelectLabel >
345+ { activeElections ?. map ( ( electionRound ) => (
346+ < SelectItem key = { electionRound . id } value = { electionRound . id } >
347+ < div className = 'flex items-center gap-2' >
348+ { electionRound ?. status === ElectionRoundStatus . NotStarted ? (
349+ < PauseCircleIcon className = 'w-4 h-4 text-slate-700' />
350+ ) : null }
351+ { electionRound ?. status === ElectionRoundStatus . Started ? (
352+ < PlayCircleIcon className = 'w-4 h-4 text-green-700' />
353+ ) : null }
354+ < div className = 'truncate max-w-[340px]' title = { electionRound . title } >
355+ { electionRound . title }
356+ </ div >
357+ </ div >
358+ </ SelectItem >
359+ ) ) }
360+ < SelectSeparator />
361+ < SelectLabel > Archived elections</ SelectLabel >
362+ { archivedElections ?. map ( ( electionRound ) => (
363+ < SelectItem key = { electionRound . id } value = { electionRound . id } >
364+ < div className = 'flex items-center gap-2' >
365+ < StopCircleIcon className = 'w-4 h-4 text-yellow-700' />
315366
367+ < div className = 'truncate max-w-[340px]' title = { electionRound . title } >
368+ { electionRound . title }
369+ </ div >
370+ </ div >
371+ </ SelectItem >
372+ ) ) }
373+ </ SelectGroup >
374+ </ SelectContent >
375+ </ Select >
376+ </ div >
377+ ) }
316378 < LanguageSelector />
317379 < Disclosure . Button
318380 key = 'Sign Out'
0 commit comments