Files
discord-decomp/modules/guild_scheduled_events/LiveChannelNoticesStore.tsx
T
2026-11-01 12:12:55 +02:00

56 lines
2.4 KiB
TypeScript

// Metro module 15155 (f15156).
import { GuildScheduledEventStatus } from "./GuildScheduledEventsConstants";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c10751_1 = {
hiddenEventsAndStages: []
};
class LiveChannelNoticesStore extends Module589.PersistedStore {
static displayName = "LiveChannelNoticesStore";
static persistKey = "liveChannelNotices_v2";
initialize(a0) {
if (a0 != null && a0.hiddenEventsAndStages != null) {
c10751_1 = a0;
}
}
isLiveChannelNoticeHidden({ eventId, stageId }) {
const r0 = stageId == null || !c10751_1.hiddenEventsAndStages.includes(`stage-${stageId}`);
return r0 ? eventId != null && c10751_1.hiddenEventsAndStages.includes(`event-${eventId}`) : !r0;
}
getState() {
return c10751_1;
}
}
const liveChannelNoticesStore = new LiveChannelNoticesStore(Dispatcher, {
LIVE_CHANNEL_NOTICE_HIDE: function handleHideNotice({ eventId, stageId }) {
if (eventId != null) {
c10751_1.hiddenEventsAndStages.push(`event-${eventId}`);
} else if (stageId != null) {
c10751_1.hiddenEventsAndStages.push(`stage-${stageId}`);
}
},
GUILD_SCHEDULED_EVENT_UPDATE: function handleEventUpdate({ guildScheduledEvent }) {
const r13 = `event-${guildScheduledEvent.id}`;
let c21713_0 = r13;
const r17 = c10751_1.hiddenEventsAndStages.includes(r13);
if (!(r17 ? guildScheduledEvent.status !== GuildScheduledEventStatus.CANCELED && guildScheduledEvent.status !== GuildScheduledEventStatus.COMPLETED : !r17)) {
c10751_1.hiddenEventsAndStages = c10751_1.hiddenEventsAndStages.filter((hiddenEventsAndStage) => hiddenEventsAndStage !== c21713_0);
}
},
GUILD_SCHEDULED_EVENT_DELETE: function handleEventDelete({ guildScheduledEvent }) {
const r10 = `event-${guildScheduledEvent.id}`;
let c21714_0 = r10;
if (c10751_1.hiddenEventsAndStages.includes(r10)) {
c10751_1.hiddenEventsAndStages = c10751_1.hiddenEventsAndStages.filter((hiddenEventsAndStage) => hiddenEventsAndStage !== c21714_0);
}
},
STAGE_INSTANCE_DELETE: function handleStageUpdate({ instance }) {
const r10 = `stage-${instance.id}`;
let c21715_0 = r10;
if (c10751_1.hiddenEventsAndStages.includes(r10)) {
c10751_1.hiddenEventsAndStages = c10751_1.hiddenEventsAndStages.filter((hiddenEventsAndStage) => hiddenEventsAndStage !== c21715_0);
}
}
});
export default liveChannelNoticesStore;