mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
feat: add success notification modal for balance and subscription events
- Add zustand store for global success notifications - Create SuccessNotificationModal component with prominent UI - Update WebSocketNotifications to show modal for important events: - balance.topup shows balance topped up modal - subscription.activated shows activation modal - subscription.renewed shows renewal modal - Add translations for all locales (ru, en, zh, fa)
This commit is contained in:
39
src/store/successNotification.ts
Normal file
39
src/store/successNotification.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { create } from 'zustand';
|
||||
|
||||
export type SuccessNotificationType =
|
||||
| 'balance_topup'
|
||||
| 'subscription_activated'
|
||||
| 'subscription_renewed'
|
||||
| 'subscription_purchased';
|
||||
|
||||
export interface SuccessNotificationData {
|
||||
type: SuccessNotificationType;
|
||||
/** Amount in kopeks (for balance or subscription price) */
|
||||
amountKopeks?: number;
|
||||
/** New balance in kopeks */
|
||||
newBalanceKopeks?: number;
|
||||
/** Subscription expiry date ISO string */
|
||||
expiresAt?: string;
|
||||
/** Tariff name */
|
||||
tariffName?: string;
|
||||
/** Custom title override */
|
||||
title?: string;
|
||||
/** Custom message override */
|
||||
message?: string;
|
||||
}
|
||||
|
||||
interface SuccessNotificationState {
|
||||
isOpen: boolean;
|
||||
data: SuccessNotificationData | null;
|
||||
|
||||
show: (data: SuccessNotificationData) => void;
|
||||
hide: () => void;
|
||||
}
|
||||
|
||||
export const useSuccessNotification = create<SuccessNotificationState>((set) => ({
|
||||
isOpen: false,
|
||||
data: null,
|
||||
|
||||
show: (data) => set({ isOpen: true, data }),
|
||||
hide: () => set({ isOpen: false, data: null }),
|
||||
}));
|
||||
Reference in New Issue
Block a user