-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
200 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { | ||
AlertDialog, | ||
AlertDialogAction, | ||
AlertDialogCancel, | ||
AlertDialogContent, | ||
AlertDialogDescription, | ||
AlertDialogFooter, | ||
AlertDialogHeader, | ||
AlertDialogTitle, | ||
AlertDialogTrigger, | ||
} from '@/components/ui/alert-dialog'; | ||
import { Button } from '@/components/ui/button'; | ||
import { ArrowBigRightDashIcon } from 'lucide-react'; | ||
|
||
interface NewPollConfirmDialogProps { | ||
handleProceedNewPoll: () => void; | ||
} | ||
|
||
const NewPollConfirmDialog = ({ | ||
handleProceedNewPoll, | ||
}: NewPollConfirmDialogProps) => { | ||
return ( | ||
<AlertDialog> | ||
<AlertDialogTrigger asChild> | ||
<Button className='mt-8 flex w-32 self-end bg-gray-600'> | ||
Next Poll | ||
<ArrowBigRightDashIcon className='ml-1 w-8' /> | ||
</Button> | ||
</AlertDialogTrigger> | ||
<AlertDialogContent> | ||
<AlertDialogHeader> | ||
<AlertDialogTitle>Confirmation</AlertDialogTitle> | ||
<AlertDialogDescription> | ||
Creating next new poll will discard current poll records. This | ||
webapp will not keep the poll records and this action cannot be | ||
undone. | ||
</AlertDialogDescription> | ||
</AlertDialogHeader> | ||
<AlertDialogFooter> | ||
<AlertDialogCancel>Cancel</AlertDialogCancel> | ||
<AlertDialogAction onClick={handleProceedNewPoll}> | ||
Continue | ||
</AlertDialogAction> | ||
</AlertDialogFooter> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
); | ||
}; | ||
|
||
export default NewPollConfirmDialog; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { CardTitle } from '@/components/ui/card'; | ||
import { useMemo, useState } from 'react'; | ||
|
||
interface PollSummarySubCardProps { | ||
pollSummary: number[]; | ||
} | ||
|
||
const PollSummarySubCard = ({ pollSummary }: PollSummarySubCardProps) => { | ||
const pollSummaryTop = useMemo(() => { | ||
return pollSummary.indexOf(Math.max(...pollSummary)); | ||
}, [pollSummary]); | ||
|
||
return ( | ||
<div className='mt-8'> | ||
<CardTitle className='font-extrabold uppercase text-primary'> | ||
📊 Poll Summary | ||
</CardTitle> | ||
<div className='mt-8 flex flex-col rounded-md border-2 border-secondary p-8'> | ||
{pollSummary.map((value, index) => { | ||
return ( | ||
<div key={index + 1}> | ||
{index + 1}: {value ?? 0} {pollSummaryTop === index && '👑'} | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default PollSummarySubCard; |
Oops, something went wrong.