Skip to content

Commit

Permalink
fix bug where answer is given in stats menu before finishing the game
Browse files Browse the repository at this point in the history
  • Loading branch information
SargisYonan committed Dec 11, 2024
1 parent 501493c commit f8f46df
Showing 1 changed file with 54 additions and 9 deletions.
63 changes: 54 additions & 9 deletions src/components/modals/StatsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,62 @@ export const StatsModal = ({
</BaseModal>
)
}
return (
<BaseModal title={wordwithvowels} isOpen={isOpen} handleClose={handleClose}>
<div style={{ direction: 'rtl' }}>
<h4 dir="ltr" className="text-lg leading-8 font-large dark:text-white">
[{partofspeech}] {definition}

if (isGameLost || isGameWon) {
return (
<BaseModal
title={wordwithvowels}
isOpen={isOpen}
handleClose={handleClose}
>
<div style={{ direction: 'rtl' }}>
<h4
dir="ltr"
className="text-lg leading-8 font-large dark:text-white"
>
[{partofspeech}] {definition}
</h4>
</div>

<h4 className="text-4xl leading-15 font-large dark:text-white">
{STATISTICS_TITLE}
</h4>
</div>
<StatBar gameStats={gameStats} />
<h4 className="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100">
{GUESS_DISTRIBUTION_TEXT}
</h4>
<Histogram gameStats={gameStats} />
<div className="mt-5 sm:mt-6 columns-2 dark:text-white">
<div>
<h5>{NEW_WORD_TEXT}</h5>
<Countdown
className="text-lg font-medium text-gray-900 dark:text-gray-100"
date={tomorrow}
daysInHours={true}
/>
</div>
<button
type="button"
className="mt-2 w-full rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:text-4xl"
onClick={() => {
shareStatus(guesses, isGameLost, isHardMode)
handleShare()
}}
>
{SHARE_TEXT}
</button>
</div>
</BaseModal>
)
}

<h4 className="text-4xl leading-15 font-large dark:text-white">
{STATISTICS_TITLE}
</h4>
// Game finished and
return (
<BaseModal
title={STATISTICS_TITLE}
isOpen={isOpen}
handleClose={handleClose}
>
<StatBar gameStats={gameStats} />
<h4 className="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100">
{GUESS_DISTRIBUTION_TEXT}
Expand Down

0 comments on commit f8f46df

Please sign in to comment.