feat(websocket): add global handler for subscription and balance notifications

- Extend WSMessage interface with balance, subscription, autopay, account, referral fields
- Create WebSocketNotifications component to handle all WS events
- Add component to Layout for global event listening
- Show toasts and invalidate queries on subscription/balance events
- Add translations for all notification types (ru, en, zh, fa)
This commit is contained in:
c0mrade
2026-01-30 19:04:45 +03:00
parent cb57c34b55
commit ca227f3975
7 changed files with 637 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import { useAuthStore } from '../../store/auth';
import LanguageSwitcher from '../LanguageSwitcher';
import PromoDiscountBadge from '../PromoDiscountBadge';
import TicketNotificationBell from '../TicketNotificationBell';
import WebSocketNotifications from '../WebSocketNotifications';
import AnimatedBackground from '../AnimatedBackground';
import { contestsApi } from '../../api/contests';
import { pollsApi } from '../../api/polls';
@@ -452,6 +453,9 @@ export default function Layout({ children }: LayoutProps) {
return (
<div className="flex min-h-screen flex-col">
{/* Global WebSocket notifications handler */}
<WebSocketNotifications />
{/* Animated Background */}
<AnimatedBackground />