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

73 lines
2.6 KiB
TypeScript

// Metro module 12273 (f12274).
import { isGuildEventEnded, isGuildScheduledEventActive } from "../GuildScheduledEventStore";
import { GuildScheduledEventEntityTypes } from "../GuildScheduledEventsConstants";
import { getNextRecurrenceIdInEvent } from "../utils/ScheduleUtils";
import Module712 from "../../../_bundle/Module712";
import Module8326 from "../../../_bundle/Module8326";
import { intl, t } from "../../../intl/index.native";
import Module7683 from "../../../_bundle/Module7683";
import Module12274 from "../../../_bundle/Module12274";
export function getGuildScheduledEventHeaderProps(a0) {
let ICON_FEEDBACK_POSITIVE, icon, text;
const eventTimeData = a0.eventTimeData;
const { startDateTimeString, diffMinutes, currentOrPastEvent, upcomingEvent } = eventTimeData;
const { isStage, theme, event, isCanceled, recurrenceId } = a0;
const nextRecurrenceIdInEvent = getNextRecurrenceIdInEvent(event);
let r33 = recurrenceId != null ? nextRecurrenceIdInEvent === recurrenceId && isGuildScheduledEventActive(event) : isGuildScheduledEventActive(event);
const isGuildEventEnded2 = isGuildEventEnded(event);
const ICON_SUBTLE = Module712.colors.ICON_SUBTLE;
let r16 = Module8326;
if (r33) {
let r75 = intl.string(t["X2K3/4"]);
if (isStage) {
r16 = Module7683;
}
if (event?.entity_type === GuildScheduledEventEntityTypes.EXTERNAL) {
r75 = intl.string(t.TxqPQR);
}
ICON_FEEDBACK_POSITIVE = Module712.colors.ICON_FEEDBACK_POSITIVE;
text = r75;
icon = r16;
} else if (isGuildEventEnded2) {
icon = Module12274;
text = startDateTimeString;
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
} else if (currentOrPastEvent) {
icon = Module12274;
text = intl.string(t.WINqKV);
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
} else {
icon = r16;
text = startDateTimeString;
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
if (upcomingEvent) {
text = diffMinutes > 0 ? intl.formatToPlainString(t.PQlCWk, {
minutes: diffMinutes
}) : intl.string(t.WINqKV);
icon = Module12274;
ICON_FEEDBACK_POSITIVE = ICON_SUBTLE;
}
}
if (isCanceled) {
ICON_FEEDBACK_POSITIVE = Module712.colors.ICON_FEEDBACK_CRITICAL;
}
const r100 = {
icon,
text,
color: Module712.internal.resolveSemanticColor(theme, ICON_FEEDBACK_POSITIVE),
shouldChangeTextColor: null
};
let shouldChangeTextColor = !isGuildEventEnded2;
if (!isGuildEventEnded2) {
if (!r33) {
r33 = currentOrPastEvent;
}
if (!r33) {
r33 = upcomingEvent;
}
shouldChangeTextColor = r33;
}
r100.shouldChangeTextColor = shouldChangeTextColor;
return r100;
}