Skip to content

Commit 8e369b8

Browse files
authored
Merge pull request #45 from betfinio/bugfix/44-stones-bug
fix: prevent winning info from overlapping
2 parents 323e52c + c56b01e commit 8e369b8

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

src/components/Roulette/Wheel.tsx

+3-26
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ import { StonesABI, ZeroAddress, arrayFrom } from '@betfinio/abi';
1111
import { BetValue } from '@betfinio/components/shared';
1212
import { Bet } from '@betfinio/ui';
1313
import { useQueryClient } from '@tanstack/react-query';
14-
import { cx } from 'class-variance-authority';
1514
import { AnimatePresence, motion, useAnimation } from 'framer-motion';
1615
import { useEffect, useRef, useState } from 'react';
17-
import { useTranslation } from 'react-i18next';
1816
import { useAccount, useWatchContractEvent } from 'wagmi';
1917
import arrowdown from '../../assets/Roulette/arrow-down.svg';
2018
import neonImage from '../../assets/Roulette/neon-glow.png';
@@ -100,11 +98,11 @@ const Wheel = () => {
10098
const { data: status = 0 } = useRoundStatus(currentRound);
10199
const [_, end] = getRoundTimes(currentRound);
102100
useEffect(() => {
103-
if (status > 0 || end < Date.now() / 1000 || actualRound !== currentRound) {
101+
if (status > 0 || end < Date.now() / 1000) {
104102
setShowWinnerMessage(true);
105103
setShowCountdown(false);
106104
setSelectedStone(winner || 1);
107-
} else {
105+
} else if (actualRound === currentRound) {
108106
setShowCountdown(true);
109107
setShowWinnerMessage(false);
110108
}
@@ -145,8 +143,8 @@ const Wheel = () => {
145143
if (bets.find((bet) => bet.side === side && bet.player === address)) {
146144
shootConfetti();
147145
}
148-
await queryClient.invalidateQueries({ queryKey: ['stones', 'round', round] });
149146
setShowWinnerMessage(true);
147+
await queryClient.invalidateQueries({ queryKey: ['stones', 'round', round] });
150148
});
151149
},
152150
});
@@ -220,8 +218,6 @@ const Wheel = () => {
220218
};
221219
}, []);
222220

223-
const { t } = useTranslation('stones', { keyPrefix: 'roulette' });
224-
225221
return (
226222
<div
227223
key={'container'}
@@ -362,25 +358,6 @@ const Wheel = () => {
362358
/>
363359
</motion.div>
364360
{showWinnerMessage && <WinnerInfo round={currentRound} scale={scale} />}
365-
<div
366-
key={'round-over'}
367-
className={cx('flex flex-col')}
368-
style={{
369-
fontSize: `${17 * scale * 2}px`,
370-
lineHeight: `${17 * scale * 2}px`,
371-
}}
372-
>
373-
<span>{t('roundIsOver')}</span>
374-
<span
375-
style={{
376-
fontSize: `${10 * scale * 2}px`,
377-
lineHeight: `${14 * scale * 2}px`,
378-
}}
379-
className={'font-light text-tertiary-foreground'}
380-
>
381-
{t('waitingForSpin')}
382-
</span>
383-
</div>
384361
</AnimatePresence>
385362
</div>
386363
</div>

0 commit comments

Comments
 (0)