5180 fichiers 38.5 Mo 0 téléchargements 144 vues mis à jour il y a 4 heures ui
nitro-v36-with-renderer-v36 / src / state / earningsIndicatorStore.ts
earningsIndicatorStore.ts 1.1 Ko Télécharger le fichier
import { createOctaneStore } from './createOctaneStore';

/**
 * AIR `EarningsController.showingIndicator`: the purse's `earnings_unseen_indicator` on the earnings button. It lights
 * when a new reward arrives (IncomeRewardNotification while the earnings window is closed) or when the first status
 * of the session already holds a claimable reward, and goes out when the earnings window opens.
 */
interface EarningsIndicatorState {
    showing: boolean;
    setShowing: (showing: boolean) => void;
}

export const useEarningsIndicatorStore = createOctaneStore<EarningsIndicatorState>()((set) => ({
    showing: false,
    setShowing: (showing: boolean) => set((state) => (state.showing === showing ? state : { showing }))
}));

/** AIR `EarningsController.onIncomeRewardStatus` (first status only): any reward waiting to be claimed. */
export const hasClaimableEarnings = (entries: ReadonlyArray<{ enabled: boolean; claimable: boolean; rewards?: ReadonlyArray<{ amount: number }> }>): boolean =>
    entries.some((entry) => entry.enabled && entry.claimable && (entry.rewards ?? []).some((reward) => reward.amount > 0));
15Sujets
1Dépôts
20Membres
7En ligne
Profile
Inscrit
Dernière visite
Messages
0
Votes positifs
0
Votes négatifs
0

Nous utilisons des cookies pour assurer le bon fonctionnement du site et améliorer votre expérience. en savoir plus

Autoriser