Skip to content

Commit 0359d65

Browse files
committed
Add toast notifications for wins and instant history update
1 parent c5bdb6c commit 0359d65

3 files changed

Lines changed: 40 additions & 1 deletion

File tree

web/package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"react": "^19.2.0",
2424
"react-dom": "^19.2.0",
2525
"react-qrcode-logo": "^4.0.0",
26+
"sonner": "^2.0.7",
2627
"vite-plugin-node-polyfills": "^0.24.0"
2728
},
2829
"devDependencies": {

web/src/App.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TonClient, WalletContractV4 } from '@ton/ton';
44
import { mnemonicNew, mnemonicToPrivateKey } from '@ton/crypto';
55
import { getHttpEndpoint } from '@orbs-network/ton-access';
66
import { QRCode } from 'react-qrcode-logo';
7+
import { Toaster, toast } from 'sonner';
78
import './App.css';
89

910
// Telegram WebApp
@@ -667,6 +668,21 @@ function App() {
667668
if (isWin) {
668669
seenTxHashesRef.current.add(txHash);
669670
addLog('success', `🎉 ${comment}: +${amount.toFixed(2)} TON @ ${timeStr}`);
671+
672+
// Show toast notification
673+
toast.success(`🎉 ${comment}!`, {
674+
description: `+${amount.toFixed(2)} TON`,
675+
duration: 5000,
676+
});
677+
678+
// Add to results immediately
679+
setWinResults(prev => [...prev, {
680+
id: txHash,
681+
amount,
682+
isWin: true,
683+
time: timeStr
684+
}]);
685+
670686
newWins.push({
671687
id: txHash,
672688
amount,
@@ -684,7 +700,7 @@ function App() {
684700

685701
if (newWins.length > 0) {
686702
addLog('success', `🎉 ${lang === 'ru' ? 'Новых выигрышей' : 'New wins'}: ${newWins.length}`);
687-
setWinResults(prev => [...prev, ...newWins]);
703+
// Wins already added immediately above
688704
} else {
689705
addLog('pending', lang === 'ru' ? 'Новых выигрышей не найдено' : 'No new wins found');
690706
}
@@ -844,6 +860,17 @@ function App() {
844860

845861
return (
846862
<div className={`app ${isTelegram ? 'telegram-app' : ''}`}>
863+
<Toaster
864+
position="top-center"
865+
richColors
866+
theme="dark"
867+
toastOptions={{
868+
style: {
869+
background: '#16213e',
870+
border: '1px solid rgba(0, 212, 170, 0.3)',
871+
},
872+
}}
873+
/>
847874
{/* Language Switcher */}
848875
<div className="lang-switcher">
849876
<button className={lang === 'en' ? 'active' : ''} onClick={() => setLang('en')}>EN</button>

0 commit comments

Comments
 (0)