This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,42 @@
// Metro module 8345 (f8346).
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { AlertModal, AlertActionButton } from "../../../../design/components/AlertModal/native/AlertModal.native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
contentText: {
textAlign: "center"
}
});
export default function DeleteEventAlert(props) {
let c16518_4;
const { eventId, guildId, recurrenceId, eventException } = props;
c16518_4 = void 0;
let _handleConfirmClick2 = function _handleConfirmClick() {
const r9 = async () => {
let c29950_0;
c29950_0 = void 0;
if (c16518_4) {
await GuildScheduledEventsActionCreators.deleteRecurrence(guildId, eventId, recurrenceId, eventException);
} else {
await GuildScheduledEventsActionCreators.deleteGuildEvent(eventId, guildId);
}
ActionSheetActionCreators.hideActionSheet();
};
_handleConfirmClick2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const r3 = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(eventId))?.recurrence_rule != null;
const r27 = recurrenceId != null;
c16518_4 = r27;
return <AlertModal title={r27 ? intl.string(t.tqClly) : r3 ? intl.string(t.wr33rW) : intl.string(t.B9sJLX)} content={intl.string(t.v2GWNQ)} extraContent={r3 ? r27 ? null : <Text variant="text-md/medium" color="text-default" style={styles.contentText}>
{intl.format(t.ZcpcyO, {})}
</Text> : null} actions={[<AlertActionButton key="delete" variant="destructive" onPress={function handleConfirmClick() {
return _handleConfirmClick2.apply(this, arguments);
}} text={r3 && !r27 ? intl.string(t["8ZsNv5"]) : intl.string(t.B9sJLX)} />, <AlertActionButton key="cancel" variant="secondary" text={intl.string(t.oEAioF)} />]} />;
};
@@ -0,0 +1,125 @@
// Metro module 8268 (f8269).
import { View } from "react-native";
import PermissionStore from "../../../../stores/PermissionStore";
import RelationshipStore from "../../../../stores/RelationshipStore";
import UserStore from "../../../../stores/UserStore";
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { ChannelTypes, Permissions } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useInputStyles } from "../../../../design/components/Input/native/InputFieldContainer.native";
import { useGetEventChannelsByType } from "../../useGetEventChannelsByType";
import { useChannelsUserCanStartStageIn } from "../../useGuildsUserCanStartStageIn";
import useChannelName, { computeChannelName } from "../../../channel/useChannelName";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { getChannelIcon, getChannelIconComponent } from "../../../../utils/native/ChannelUtils";
import Module8250 from "../../../../_bundle/Module8250";
import { LocationIcon } from "../../../../design/components/Icon/native/redesign/generated/LocationIcon";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import StageChannelUpsell from "./StageChannelUpsell";
import { openCreateOrEditGuildEventModal } from "../GuildScheduledEventModalActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { Icon } from "../../../../design/void/native";
import Module8247 from "../../../../_bundle/Module8247";
const useStyles = createStyles({
container: {
flexDirection: "column"
},
channelSelectorButton: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
backgroundColor: Module712.colors.REDESIGN_BUTTON_TERTIARY_BACKGROUND
},
channelIcon: {
marginRight: 8
},
channelTypeText: {
flex: 1,
marginBottom: 8
},
channelNameText: {
flex: 1
}
});
export default function EditGuildEventChannelSelection(props) {
let stateFromStores2;
const { guild, channelType, channel, guildEventId, recurrenceId, onChangeChannel, style } = props;
stateFromStores2 = void 0;
const styles = useStyles();
const styles2 = useInputStyles({
hasLeadingIcon: true
});
const r1 = channelType === ChannelTypes.GUILD_STAGE_VOICE;
let c16430_5 = r1;
const getEventChannelsByType = useGetEventChannelsByType(guild.id, channelType);
const channelsUserCanStartStageIn = useChannelsUserCanStartStageIn(guild);
const channelName = useChannelName(channel);
const stateFromStores = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_CHANNELS, guild));
stateFromStores2 = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(guildEventId), [guildEventId]);
const source = channel != null ? getChannelIcon(channel) : Module8250;
const Component = channel != null ? getChannelIconComponent(channel) : LocationIcon;
const accessibilityLabel = r1 ? intl.string(t.S7GjDz) : intl.string(t["7RYWCP"]);
const r87 = [<Text style={styles.channelTypeText} variant="text-sm/semibold" color="text-subtle">{accessibilityLabel}</Text>, ,];
const props2 = {
accessibilityLabel,
accessibilityHint: intl.string(t.AaXbMD),
accessibilityValue: null,
accessibilityRole: "button",
style: null,
onPress: null,
children: null
};
let text = channelName;
if (text == null) {
text = void 0;
}
props2.accessibilityValue = {
text
};
props2.style = [styles2.padding, styles2.radius, styles.channelSelectorButton];
props2.onPress = function onPress() {
dismissGlobalKeyboard();
const items = getEventChannelsByType.map((item) => ({
value: item.id,
label: computeChannelName(item, UserStore, RelationshipStore, true)
}));
const body = channelsUserCanStartStageIn.length === 0 ? stateFromStores ? <StageChannelUpsell guildId={guild.id} onCreate={(event) => {
let guildEvent = stateFromStores2;
if (stateFromStores2 == null) {
guildEvent = void 0;
}
openCreateOrEditGuildEventModal(guild, {
channel: event,
guildEvent,
recurrenceId
});
}} /> : null : null;
const r37 = import("../../../../components_native/common/ItemSelectorActionSheet");
const title = c16430_5 ? intl.string(t.S7GjDz) : intl.string(t["7RYWCP"]);
let selectedItem = channel?.id;
if (selectedItem == null) {
selectedItem = void 0;
}
ActionSheetActionCreators.openLazy(r37, "SelectUpdatesChannel", {
title,
items,
body,
onItemSelect: (c29930_0) => {
const r7 = getEventChannelsByType.find((item) => item.id === c29930_0);
if (r7 != null) {
onChangeChannel(r7);
}
ActionSheetActionCreators.hideActionSheet();
},
selectedItem,
hasIcons: false
});
};
props2.children = [Component != null ? <Component style={styles.channelIcon} /> : <Icon source={source} style={styles.channelIcon} />, <Text style={styles.channelNameText} variant="text-md/medium" color="interactive-text-active">{channelName}</Text>, <Icon source={Module8247} />];
r87[1] = <PressableOpacity {...props2} />;
return <View style={[styles.container, style]}>{r87}</View>;
};
@@ -0,0 +1,119 @@
// Metro module 8313 (f8314).
import { useMemo, useState, useRef } from "react";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../../intl/index.native";
import Module3771 from "../../../../_bundle/Module3771";
import { recurrenceRuleToOption, MAX_DAYS_AHEAD_AN_EVENT_CAN_START, MAX_DAYS_AHEAD_AN_EVENT_CAN_END, recurrenceOptionToRecurrenceRule } from "../../utils/ScheduleUtils";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import EditGuildEventStepContainer from "./EditGuildEventStepContainer";
import EditGuildEventStepHeader from "./EditGuildEventStepHeader";
import { GuildEventTopic, GuildEventDatetime, GuildEventRecurrence, GuildEventDescription } from "./GuildEventModalComponents";
const useStyles = createStyles({
error: {
paddingVertical: 8
}
});
export default function EditGuildEventDetails(props) {
let memo2, state, setState, ref, isGuildScheduledEventActive2, setState2, navigation;
const { guildEvent, initialGuildEvent, onChange: onChange2 } = props;
memo2 = void 0;
state = void 0;
setState = void 0;
ref = void 0;
isGuildScheduledEventActive2 = void 0;
setState2 = void 0;
navigation = void 0;
const styles = useStyles();
const name = guildEvent.name;
let description = guildEvent.description;
const { entityType, scheduledStartTime, scheduledEndTime, recurrenceRule } = guildEvent;
const memo = useMemo(() => Module3771(scheduledStartTime), [scheduledStartTime]);
memo2 = useMemo(() => scheduledEndTime != null ? Module3771(scheduledEndTime) : Module3771(scheduledStartTime).add(1, "hour"), [scheduledEndTime, scheduledStartTime]);
[state, setState] = useState(() => recurrenceRuleToOption(Module3771(scheduledStartTime), recurrenceRule));
const memo6 = useMemo(() => Module3771(), []);
const memo5 = useMemo(() => Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_START, "days"), []);
const memo4 = useMemo(() => Module3771(memo).add(15, "minutes"), [memo]);
const memo3 = useMemo(() => Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_END, "days"), []);
ref = useRef(null);
isGuildScheduledEventActive2 = isGuildScheduledEventActive(initialGuildEvent);
let state2;
[state2, setState2] = useState(null);
navigation = useNavigation();
const action = <>
{state2 != null ? <Text style={styles.error} variant="text-sm/normal" color="text-feedback-critical">{state2}</Text> : null}
<Button text={intl.string(t.PDTjLN)} variant="primary" onPress={function onPress() {
dismissGlobalKeyboard();
try {
setState2(null);
(function assertGuildEventDetailsValid(a0) {
if (a0.name.length === 0) {
throw new Error(intl.string(t.GoV0uR));
}
})(guildEvent);
navigation.navigate(EditGuildEventScreens.PREVIEW);
} catch (r24) {
setState2(r24.message);
AccessibilityAnnouncer.announce(r24.message);
}
}} disabled={state2 != null} />
</>;
const r120 = [<EditGuildEventStepHeader title={intl.string(t.GG6vbr)} subtitle={intl.string(t.q5lgwV)} />, <GuildEventTopic topic={name} onChange={(event) => {
const r3 = {
name: event
};
setState2(null);
onChange2(r3);
}} />, <GuildEventDatetime date={memo} onChange={function onChange(event) {
if (isGuildScheduledEventActive2) {
return setState2(intl.string(t.nKIaRG));
}
const r6 = {
scheduledStartTime: event.toISOString()
};
if (scheduledEndTime != null && memo2.isBefore(event)) {
r6.scheduledEndTime = Module3771(event).add(1, "hour").toISOString();
}
if (event != null && state != null) {
r6.recurrenceRule = recurrenceOptionToRecurrenceRule(state, event);
}
setState2(null);
onChange2(r6);
}} disabled={isGuildScheduledEventActive2} minimumDate={memo6} maximumDate={memo5} dateLabel={intl.string(t.kKOIwJ)} timeLabel={intl.string(t["6dGmCD"])} />, entityType === GuildScheduledEventEntityTypes.EXTERNAL && <GuildEventDatetime date={memo2} onChange={function onChange(event) {
const r3 = {
scheduledEndTime: event.toISOString()
};
setState2(null);
onChange2(r3);
}} minimumDate={memo4} maximumDate={memo3} dateLabel={intl.string(t.CTLgZJ)} timeLabel={intl.string(t.j2RuXF)} />, <GuildEventRecurrence startDate={memo} recurrenceRule={recurrenceRule} onRecurrenceChange={function onRecurrenceChange(event) {
if (memo != null) {
onChange2({
recurrenceRule: recurrenceOptionToRecurrenceRule(event, memo)
});
setState(event);
}
}} />, ,];
if (description == null) {
description = "";
}
r120[5] = <GuildEventDescription description={description} onChange={(event) => {
const r3 = {
description: event
};
setState2(null);
onChange2(r3);
}} onFocus={function onFocus() {
setTimeout(() => {
if (ref.current != null) {
ref.current.scrollToEnd();
}
}, 100);
}} />;
return <EditGuildEventStepContainer action={action} ref={ref}>{r120}</EditGuildEventStepContainer>;
};
@@ -0,0 +1,180 @@
// Metro module 8263 (f8264).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { memo, useState } from "react";
import { GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { getInitialGuildEventData, isEditingEvent, EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import LazyAPIPromise from "../../../../utils/LazyAPIPromise";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import { intl, t } from "../../../../intl/index.native";
import { getChannelTypeFromEntity } from "../../utils/EntityUtils";
import { getEventChannelsByType } from "../../useGetEventChannelsByType";
import EditGuildEventWhere from "./EditGuildEventWhere";
import EditGuildEventDetails from "./EditGuildEventDetails";
import EditGuildEventPreview from "./EditGuildEventPreview";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
function $mk105770($env) {
return () => {
const r1 = $env.$parent.$parent;
return (0, r1[8])((0, r1[1])(r1[3][15]), {
screen: $env[0],
onClose: $env.$parent[1]
});
};
}
let env5260 = {};
const useStyles = createStyles({
cardStyle: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
const r37 = memo(function(a0) {
let env16420;
let env16421;
let env16422;
let env16423;
const r11 = env16420 = {
$parent: env5260
};
const guild = a0.guild;
env16420[0] = guild;
env16420[1] = a0.onCloseModal;
const initialGuildEvent = a0.initialGuildEvent;
env16420[2] = initialGuildEvent;
const targetChannel = a0.targetChannel;
env16420[3] = void 0;
env16420[4] = void 0;
env16420[5] = void 0;
env16420[6] = void 0;
env16420[8] = void 0;
env16420[7] = function _handleSave() {
const r9 = async () => {
let r45;
let c29929_0 = env16420;
if (await (0, env16420[6])() != null) {
if (env16420[5]) {
if (env16420[2]?.id != null) {
AccessibilityAnnouncer.announce(intl.string(t["F9On+q"]));
} else {
r45 = c29929_0.$parent;
AccessibilityAnnouncer.announce(intl.string(t["5HzXO5"]));
}
} else {
r45 = c29929_0.$parent;
AccessibilityAnnouncer.announce(intl.string(t["5HzXO5"]));
}
(0, env16420[1])();
}
};
env16420[7] = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
const r25 = _slicedToArray(useState(getInitialGuildEventData(initialGuildEvent, targetChannel)), 2);
const guildEvent = r25[0];
env16420[3] = guildEvent;
env16420[4] = r25[1];
const [isEdit] = useState(isEditingEvent(initialGuildEvent));
env16420[5] = isEdit;
const [initialRouteStack] = useState(() => {
const r6 = env16420[5];
const r3 = {
name: EditGuildEventScreens.CHANNEL_SELECTOR
};
return r6 ? [r3, {
name: EditGuildEventScreens.DETAILS
}] : [r3];
});
const r44 = _slicedToArray(LazyAPIPromise(() => {
let r21;
dismissGlobalKeyboard();
if (env16420[5]) {
const r15 = env16420[2];
r21 = r15?.id != null ? GuildScheduledEventsActionCreators.saveEvent(r15.id, env16420[3], env16420[0].id) : GuildScheduledEventsActionCreators.createGuildEvent(env16420[3], env16420[0].id);
} else {
r21 = GuildScheduledEventsActionCreators.createGuildEvent(env16420[3], env16420[0].id);
}
return r21;
}), 2);
env16420[6] = r44[0];
const r46 = r44[1];
env16420[8] = {
guild,
guildEvent,
initialGuildEvent,
isEdit,
error: r46.error,
loading: r46.loading,
onSave: function handleSave() {
return env16420[7].apply(this, arguments);
},
onChange: function handleChange(a0) {
let c26162_0 = a0;
if (a0.entityType != null) {
let channelId = _slicedToArray(getEventChannelsByType(env16420[0].id, getChannelTypeFromEntity(a0.entityType)), 1)[0]?.id;
if (channelId == null) {
channelId = null;
}
a0.channelId = channelId;
if (a0.entityType !== GuildScheduledEventEntityTypes.EXTERNAL && env16420[3].entityType === GuildScheduledEventEntityTypes.EXTERNAL) {
a0.entityMetadata = null;
}
}
(0, env16420[4])((a0) => ({
...a0,
...c26162_0
}));
}
};
const screens = {};
const CHANNEL_SELECTOR = EditGuildEventScreens.CHANNEL_SELECTOR;
const CHANNEL_SELECTOR2 = EditGuildEventScreens.CHANNEL_SELECTOR;
const r61 = env16421 = {
$parent: r11
};
env16421[0] = CHANNEL_SELECTOR2;
screens[CHANNEL_SELECTOR] = {
title: "",
customNavbar: $mk105770(r61),
headerLeft: () => null,
render: () => <EditGuildEventWhere {...env16420[8]} guildEventId={env16420[2]?.id} />,
fullscreen: true
};
const DETAILS = EditGuildEventScreens.DETAILS;
const DETAILS2 = EditGuildEventScreens.DETAILS;
const r74 = env16422 = {
$parent: r11
};
env16422[0] = DETAILS2;
screens[DETAILS] = {
title: "",
customNavbar: $mk105770(r74),
render: () => <EditGuildEventDetails {...env16420[8]} />,
fullscreen: true
};
const PREVIEW = EditGuildEventScreens.PREVIEW;
const PREVIEW2 = EditGuildEventScreens.PREVIEW;
const r86 = env16423 = {
$parent: r11
};
env16423[0] = PREVIEW2;
screens[PREVIEW] = {
title: "",
customNavbar: $mk105770(r86),
render: () => <EditGuildEventPreview {...env16420[8]} />,
fullscreen: true
};
return (0, jsx)(Navigator, {
screens,
initialRouteName: EditGuildEventScreens.CHANNEL_SELECTOR,
initialRouteStack,
cardShadowEnabled: false,
cardOverlayEnabled: false,
cardStyle: styles.cardStyle
});
});
export default r37;
@@ -0,0 +1,58 @@
// Metro module 8232 (f8233).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import { assertNever } from "../../../../utils/GlobalUtils";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { HeaderActionButton } from "../../../../design/components/Navigator/native/HeaderActionButton.native";
import Module7699 from "../../../../_bundle/Module7699";
const useStyles = createStyles({
header: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: 4,
paddingVertical: 8
},
headerTitle: {
lineHeight: 28,
textTransform: "uppercase"
},
buttonContainer: {
width: 60
},
rightButton: {
marginLeft: 12
}
});
export default function EditGuildEventModalNavbar(props) {
let r37;
const { screen, onClose } = props;
const styles = useStyles();
if (EditGuildEventScreens.CHANNEL_SELECTOR === screen) {
r37 = [1, 3];
} else if (EditGuildEventScreens.DETAILS === screen) {
r37 = [2, 3];
} else if (EditGuildEventScreens.PREVIEW === screen) {
r37 = [3, 3];
} else {
assertNever(screen);
r37 = void 0;
}
const r39 = _slicedToArray(r37, 2);
return <SafeAreaPaddingView top style={styles.header}>
<View style={styles.buttonContainer} />
<Text style={styles.headerTitle} variant="text-xs/bold" color="text-default">
{intl.format(t["42HaFY"], {
step: r39[0],
total: r39[1]
})}
</Text>
<View style={styles.buttonContainer}>
<HeaderActionButton accessibilityLabel={intl.string(t.cpT0Cq)} onPress={onClose} source={Module7699} style={styles.rightButton} />
</View>
</SafeAreaPaddingView>;
};
@@ -0,0 +1,180 @@
// Metro module 8314 (f8315).
import { Fragment, useMemo } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { isAndroid } from "../../../../utils/PlatformUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useChannelName from "../../../channel/useChannelName";
import { getLocationFromEvent } from "../../utils/EntityUtils";
import { getEventLocationIconSource } from "./GuildEventUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import getChannelA11yLabel from "../../../channel/getChannelA11yLabel";
import { Icon, LegacyText } from "../../../../design/void/native";
import { guildEventDetailsParser } from "../../guildEventDetailsParser.native";
import { convertToFakeGuildEvent } from "../../utils/EditGuildEventUtils";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import { GuildEventCardImageHeader, GuildEventCardHeader, GuildEventCardMetaInfo, GuildEventSimpleLocation } from "./GuildEventCardComponents";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { hasScheduleChanges } from "../../utils/ScheduleUtils";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
let useStyles;
const PreviewBody = function PreviewBody(props) {
let locationFromEvent, eventLocationIconSource;
const event = props.event;
locationFromEvent = void 0;
eventLocationIconSource = void 0;
const styles = useStyles();
const channel_id = event.channel_id;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id), [channel_id]);
let r16 = useChannelName(stateFromStores);
const locationFromEvent2 = getLocationFromEvent(event);
if (r16 == null) {
r16 = locationFromEvent2;
}
locationFromEvent = r16;
eventLocationIconSource = getEventLocationIconSource(event, stateFromStores, true);
return <View style={styles.header}>
<Text style={styles.headerTitle} variant="heading-xl/bold" color="mobile-text-heading-primary">
{intl.string(t.yBsFE3)}
</Text>
<Text style={styles.headerSubtitle} accessibilityLabel={stateFromStores != null ? intl.formatToPlainString(t.sxcQPE, {
channelName: getChannelA11yLabel({
channel: stateFromStores
})
}) : void 0} variant="text-sm/medium" color="text-default">
{stateFromStores != null ? intl.format(t.f55NX0, {
channelName: locationFromEvent,
channelHook: function channelHook() {
const children = [<View style={styles.channelContainer}>
{eventLocationIconSource != null && <Icon source={eventLocationIconSource} size={Icon.Sizes.EXTRA_SMALL} style={styles.channelIcon} />}
</View>, ,];
let key = locationFromEvent;
children[1] = <Text accessibilityElementsHidden importantForAccessibility="no" variant="text-sm/medium" color="text-default">
{locationFromEvent != null ? guildEventDetailsParser(locationFromEvent, true) : null}
</Text>;
const props = {
children
};
if (locationFromEvent == null) {
key = "preview-body";
}
return <Fragment key={key} {...props} />;
}
}) : intl.string(t.KDPFi9)}
</Text>
</View>;
};
useStyles = createStyles({
container: {
flex: 1,
padding: 16,
paddingBottom: 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flexDirection: "column",
height: "100%",
overflow: "visible"
},
centered: {
flexDirection: "column",
alignItems: "center",
justifyContent: "center"
},
centerContainer: {
flexGrow: 0,
width: "100%"
},
flex: {
flex: 1,
overflow: "visible"
},
header: {
alignItems: "center",
paddingBottom: 24
},
headerTitle: {
marginTop: 16,
marginBottom: 8
},
headerSubtitle: {
textAlign: "center"
},
eventContainer: {
padding: 16,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
marginBottom: 24,
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 1,
borderRadius: Module712.radii.sm,
shadowOpacity: 0.2,
elevation: 2,
shadowRadius: 16,
shadowOffset: {
height: 8,
width: 0
},
overflow: "visible"
},
channelContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
height: 14
},
channelIcon: {
tintColor: Module712.colors.TEXT_SUBTLE,
marginRight: 4,
height: 14,
transform: [{
translateY: isAndroid() ? 2 : 0
}]
},
buttonContainer: {
position: "absolute",
bottom: 16,
left: 0,
right: 0
},
error: {
paddingBottom: 8,
fontSize: 14,
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.unsafe_rawColors.RED_400
}
});
export default function EditGuildEventPreview(props) {
const { guild, initialGuildEvent, guildEvent, isEdit, loading, error, onSave } = props;
const styles2 = useStyles();
const text = isEdit ? intl.string(t.e5VEcE) : intl.string(t["60lJ0C"]);
const memo = useMemo(() => convertToFakeGuildEvent(guildEvent, guild.id), [guildEvent, guild.id]);
return <SafeAreaPaddingView bottom style={styles2.container}>
<View style={[styles2.flex, styles2.centered]}>
<View style={styles2.centerContainer}>
<View style={styles2.eventContainer}>
<GuildEventCardImageHeader event={memo} />
<GuildEventCardHeader event={memo} isPreview />
<GuildEventCardMetaInfo event={memo} />
<GuildEventSimpleLocation event={memo} />
</View>
<PreviewBody event={memo} />
</View>
<View style={styles2.buttonContainer}>
{error != null ? <LegacyText style={styles2.error}>
{error.getAnyErrorMessage()}
</LegacyText> : null}
<Button text={text} variant="primary" onPress={function onPress() {
if (guildEvent.recurrenceRule != null && (isEdit && hasScheduleChanges(initialGuildEvent, guildEvent))) {
AlertActionCreators.openLazy({
importer: () => import("./EditGuildScheduledEventResetWarningAlert").then(({ default: Component }) => (a0) => <Component {...a0} onConfirm={onSave} />)
});
} else {
onSave();
}
}} disabled={loading} loading={loading} />
</View>
</View>
</SafeAreaPaddingView>;
};
@@ -0,0 +1,98 @@
// Metro module 8230 (f8231).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import { useState, useEffect } from "react";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useEventException from "../../useEventException";
import { areSchedulesIdentical, getScheduleForRecurrenceWithException, getBaseScheduleForRecurrence } from "../../utils/ScheduleUtils";
import LazyAPIPromise from "../../../../utils/LazyAPIPromise";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import saveGuildEventRecurrence from "../../saveGuildEventRecurrence";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
import EditGuildEventModalNavbar from "./EditGuildEventModalNavbar";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import EditGuildEventStepContainer from "./EditGuildEventStepContainer";
import GuildEventSchedule from "./GuildEventSchedule";
import { Text } from "../../../../design/components/Text/native/Text";
import { Navigator } from "../../../../design/components/Navigator/native/Navigator.native";
const useStyles = createStyles({
cardStyle: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
let c5234_10 = {
TIME: "TIME"
};
export default function EditGuildEventRecurrenceModal(props) {
let c16401_3, scheduleForRecurrenceWithException, state, setState, state2, setState2, c16401_9, error, handleScheduleChange2, action;
const { guildEvent, onCloseModal, recurrenceId } = props;
c16401_3 = void 0;
scheduleForRecurrenceWithException = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
c16401_9 = void 0;
error = void 0;
action = void 0;
let _handleSave2 = function _handleSave() {
const r9 = async () => {
let c29928_0;
L15: {
c29928_0 = void 0;
if (areSchedulesIdentical(state, scheduleForRecurrenceWithException)) {
onCloseModal();
break L15;
}
if (await c16401_9() != null) {
(0, onCloseModal)();
}
return void 0;
}
};
_handleSave2 = r9;
return r9.apply(this, arguments);
};
handleScheduleChange2 = function handleScheduleChange({ startDate, endDate }) {
setState({
startDate,
endDate: startDate != null && endDate != null && endDate.isBefore(startDate) ? startDate.clone().add(1, "hour") : endDate
});
setState2(null);
};
const styles = useStyles();
const eventException = useEventException(recurrenceId, guildEvent.id);
c16401_3 = eventException;
scheduleForRecurrenceWithException = getScheduleForRecurrenceWithException(getBaseScheduleForRecurrence(recurrenceId, guildEvent), eventException);
[state, setState] = useState(scheduleForRecurrenceWithException);
[state2, setState2] = useState(null);
const r45 = _slicedToArray(LazyAPIPromise(() => {
dismissGlobalKeyboard();
return saveGuildEventRecurrence(guildEvent, recurrenceId, state, c16401_3);
}), 2);
c16401_9 = r45[0];
error = r45[1].error;
useEffect(() => {
let r7 = error == null ? void 0 : error.getAnyErrorMessage();
if (r7 == null) {
r7 = null;
}
setState2(r7);
}, [error]);
action = <Button size="md" text={intl.string(t["R3BPH+"])} onPress={function handleSave() {
return _handleSave2.apply(this, arguments);
}} disabled={state2 != null} />;
const screens = {};
screens[c5234_10.TIME] = {
title: "",
customNavbar: () => <EditGuildEventModalNavbar screen={EditGuildEventScreens.DETAILS} onClose={onCloseModal} />,
headerLeft: () => null,
render: () => <EditGuildEventStepContainer action={action}>
<GuildEventSchedule guildEvent={guildEvent} recurrenceId={recurrenceId} schedule={state} onChange={handleScheduleChange2} />
{state2 != null ? <Text variant="text-md/normal" color="text-feedback-critical">{state2}</Text> : null}
</EditGuildEventStepContainer>,
fullscreen: true
};
return <Navigator screens={screens} initialRouteName={c5234_10.TIME} cardShadowEnabled={false} cardOverlayEnabled={false} cardStyle={styles.cardStyle} />;
};
@@ -0,0 +1,47 @@
// Metro module 8233 (f8234).
import { forwardRef, useState, useCallback } from "react";
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
const useStyles = createStyles({
container: {
flex: 1,
paddingHorizontal: 0,
paddingVertical: 0,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
flexDirection: "column",
height: "100%"
},
flex: {
flex: 1
},
scroller: {
paddingHorizontal: 16
},
buttonContainer: {
position: "absolute",
bottom: 0,
left: 0,
right: 0,
paddingHorizontal: 16,
paddingVertical: 16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
}
});
const r44 = forwardRef(function({ children, action }, a1) {
const styles = useStyles();
const [state, setState] = useState(32);
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
return <View style={styles.container}>
<ScrollView ref={a1} automaticallyAdjustContentInsets={false} keyboardShouldPersistTaps="handled" style={[styles.flex, {
marginBottom: state + insets.bottom
}]} contentContainerStyle={styles.scroller}>{children}</ScrollView>
<View style={[styles.buttonContainer, {
paddingBottom: insets.bottom
}]} onLayout={useCallback((a0) => {
setState(a0.nativeEvent.layout.height);
}, [])}>{action}</View>
</View>;
});
export default r44;
@@ -0,0 +1,25 @@
// Metro module 8302 (f8303).
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { Text } from "../../../../design/components/Text/native/Text";
const useStyles = createStyles({
header: {
alignItems: "center",
paddingBottom: 24
},
headerTitle: {
marginTop: 8,
marginBottom: 8
},
headerSubtitle: {
textAlign: "center"
}
});
export default function EditGuildEventStepHeader(props) {
const { title, subtitle } = props;
const styles = useStyles();
return <View style={styles.header}>
<Text style={styles.headerTitle} accessibilityRole="header" variant="heading-xl/semibold" color="mobile-text-heading-primary">{title}</Text>
{subtitle != null ? subtitle !== "" ? <Text style={styles.headerSubtitle} variant="text-sm/medium" color="text-default">{subtitle}</Text> : null : null}
</View>;
};
@@ -0,0 +1,129 @@
// Metro module 8267 (f8268).
import { useRef, useState } from "react";
import ChannelStore from "../../../../stores/ChannelStore";
import PermissionStore from "../../../../stores/PermissionStore";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES, GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { GuildSettingsSections, Permissions } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { intl, t } from "../../../../intl/index.native";
import { getChannelTypeFromEntity, getLocationFromEventData } from "../../utils/EntityUtils";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
import EditGuildEventChannelSelection from "./EditGuildEventChannelSelection";
import { GuildEventLocation, GuildEventEntityTypeSelection } from "./GuildEventModalComponents";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import { EditGuildEventScreens } from "../../utils/EditGuildEventUtils";
import { AccessibilityAnnouncer } from "../../../../_bundle/Module3902";
import EditGuildEventStepContainer from "./EditGuildEventStepContainer";
import EditGuildEventStepHeader from "./EditGuildEventStepHeader";
import Module3771 from "../../../../_bundle/Module3771";
import StageChannelAgeVerificationNoticeForEvent from "../../../stage_channels/native/StageChannelAgeVerificationNoticeForEvent";
import GuildSettingsActionCreators from "../../../guild_settings/GuildSettingsActionCreators";
const useStyles = createStyles({
channelSelection: {
marginTop: 16
},
error: {
paddingVertical: 8
},
text: {
marginTop: 24
}
});
export default function EditGuildEventWhere(props) {
let r68;
let setState, navigation;
const { guild, guildEvent, guildEventId, initialGuildEvent, onChange: onChange2 } = props;
setState = void 0;
navigation = void 0;
const styles = useStyles();
const ref = useRef(null);
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(guildEvent.channelId), [guildEvent.channelId]);
let r41 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_ROLES, guild), [guild]);
let state;
[state, setState] = useState(null);
navigation = useNavigation();
const isGuildScheduledEventActive2 = isGuildScheduledEventActive(initialGuildEvent);
const r64 = <EditGuildEventChannelSelection guild={guild} channel={stateFromStores} guildEventId={guildEventId} channelType={getChannelTypeFromEntity(guildEvent.entityType)} onChangeChannel={function onChangeChannel(event) {
setState(null);
onChange2({
channelId: event.id
});
}} style={styles.channelSelection} />;
if (guildEvent.entityType === GuildScheduledEventEntityTypes.EXTERNAL) {
let location2 = getLocationFromEventData(guildEvent);
if (location2 == null) {
location2 = "";
}
r68 = <GuildEventLocation location={location2} onChange={function handleChangeEventLocation(event) {
setState(null);
onChange2({
entityMetadata: {
location: event
}
});
}} onFocus={function onFocus() {
setTimeout(() => {
if (ref.current != null) {
ref.current.scrollToEnd();
}
}, 100);
}} />;
} else {
r68 = stateFromStores == null ? null : r64;
}
const action = <>
{state != null ? <Text style={styles.error} variant="text-sm/normal" color="text-feedback-critical">{state}</Text> : null}
<Button text={intl.string(t.PDTjLN)} variant="primary" onPress={function onPress() {
dismissGlobalKeyboard();
try {
setState(null);
(function assertGuildEventWhereIsValid(a0) {
const { entityType, channelId } = a0;
if (entityType === GuildScheduledEventEntityTypes.NONE) {
throw new Error(intl.string(t.C4KzmQ));
}
if (entityType === GuildScheduledEventEntityTypes.EXTERNAL && getLocationFromEventData(a0) == null) {
throw new Error(intl.string(t.q91szp));
}
if (channelId == null && entityType !== GuildScheduledEventEntityTypes.EXTERNAL) {
throw new Error(intl.string(t["4LQwnw"]));
}
})(guildEvent);
navigation.push(EditGuildEventScreens.DETAILS);
} catch (r24) {
setState(r24.message);
AccessibilityAnnouncer.announce(r24.message);
}
}} disabled={state != null} />
</>;
const r127 = [<EditGuildEventStepHeader title={intl.string(t["DC+Qm8"])} subtitle={intl.string(t.IwmXLP)} />, <GuildEventEntityTypeSelection guild={guild} entityType={guildEvent.entityType} onChange={function onChange(event) {
setState(null);
const r10 = {
entityType: event,
scheduledEndTime: void 0
};
if (event === GuildScheduledEventEntityTypes.EXTERNAL) {
let r17 = Module3771(guildEvent.scheduledStartTime);
if (r17 == null) {
r17 = Module3771();
}
r10.scheduledEndTime = r17.add(1, "hour").toISOString();
}
onChange2(r10);
}} disabled={isGuildScheduledEventActive2} />, r68, AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(guildEvent.entityType) && <StageChannelAgeVerificationNoticeForEvent />, ,];
if (r41) {
r41 = <Text style={styles.text} variant="text-sm/normal" color="text-default">
{intl.format(t["K+DH2o"], {
onClick: () => {
GuildSettingsActionCreators.open(guild.id, GuildSettingsSections.ROLES);
}
})}
</Text>;
}
r127[4] = r41;
return <EditGuildEventStepContainer action={action} ref={ref}>{r127}</EditGuildEventStepContainer>;
};
@@ -0,0 +1,6 @@
// Metro module 8318 (f8319).
import Alert from "../../../../components_native/common/Alert";
import { intl, t } from "../../../../intl/index.native";
export default function EditGuildScheduledEventResetWarningAlert(props) {
return <Alert onClose={props.onClose} onConfirm={props.onConfirm} title={intl.string(t.aNCYas)} body={intl.format(t.RWBa5X, {})} confirmText={intl.string(t["cY+Oob"])} confirmColor={Alert.Colors.GREEN} cancelText={intl.string(t["ETE/oC"])} />;
};
@@ -0,0 +1,73 @@
// Metro module 12279 (f12280).
import { View } from "react-native";
import { EXPLICIT_END_EVENT_SHEET_KEY } from "../../GuildScheduledEventsConstants";
import { Fonts } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useActiveEvent } from "../../useGuildScheduledEvents";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { handleDisconnect } from "../../../voice_calls/native/CallsUtils";
import ScrollHandlingActionSheet from "../../../stage_channels/native/components/ScrollHandlingActionSheet";
import { LegacyText } from "../../../../design/void/native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { Button } from "../../../../design/components/Button/native/Button.native";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
const useStyles = createStyles({
container: {
paddingVertical: 24,
paddingHorizontal: 16,
alignItems: "center"
},
title: {
fontSize: 24,
fontFamily: Fonts.PRIMARY_BOLD,
textAlign: "center",
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY
},
subtitle: {
marginTop: 8,
textAlign: "center"
},
cancelButtonContainer: {
marginTop: 24,
alignSelf: "stretch"
},
confirmButtonContainer: {
marginTop: 8,
alignSelf: "stretch"
}
});
export default function EndEventActionSheet(props) {
const channel = props.channel;
const styles = useStyles();
const activeEvent = useActiveEvent(channel.id);
if (activeEvent == null) {
return null;
}
return <ScrollHandlingActionSheet>
<View style={styles.container}>
<LegacyText style={styles.title} accessibilityRole="header">
{intl.string(t["4Ao8LC"])}
</LegacyText>
<Text style={styles.subtitle} variant="text-md/medium" color="text-default">
{intl.string(t["0I0B8f"])}
</Text>
<View style={styles.cancelButtonContainer}>
<Button text={intl.string(t.P60OAX)} grow onPress={function handleClose() {
ActionSheetActionCreators.hideActionSheet(EXPLICIT_END_EVENT_SHEET_KEY);
handleDisconnect(channel);
}} />
</View>
<View style={styles.confirmButtonContainer}>
<Button text={intl.string(t.mjB9pd)} variant="destructive" grow onPress={function onPress() {
if (activeEvent != null) {
GuildScheduledEventsActionCreators.endEvent(activeEvent.id, activeEvent.guild_id);
ActionSheetActionCreators.hideActionSheet(EXPLICIT_END_EVENT_SHEET_KEY);
handleDisconnect(channel);
}
}} />
</View>
</View>
</ScrollHandlingActionSheet>;
};
@@ -0,0 +1,52 @@
// Metro module 8329 (f8330).
import { memo } from "react";
import { View } from "react-native";
import RTCConnectionStore from "../../../../stores/RTCConnectionStore";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES } from "../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { GuildEventCardPrimaryAction, usePrimaryActionButtonType, PrimaryActionType, GuildEventCardRSVPAction, GuildEventShareAction, GuildEventCardHeader, GuildEventCardMetaInfo, GuildEventSimpleLocation } from "./GuildEventCardComponents";
import { ButtonGroup } from "../../../../design/components/ButtonGroup/native/ButtonGroup.native";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { recurrenceRuleFromServer } from "../../utils/EditGuildEventUtils";
import { Card } from "../../../../design/components/Card/native/Card.native";
import StageChannelAgeVerificationNotice from "../../../stage_channels/native/StageChannelAgeVerificationNotice";
import GuildEventRecurrences from "./GuildEventRecurrences";
let useStyles;
const GuildEventCardControls = function GuildEventCardControls(props) {
const { event: event2, isConnected, onCloseAction } = props;
return <ButtonGroup direction="horizontal" style={useStyles().actionContainer}>
<GuildEventCardPrimaryAction event={event2} onCloseAction={onCloseAction} isConnected={isConnected} />
{usePrimaryActionButtonType(event2, isConnected) === PrimaryActionType.START && <GuildEventCardRSVPAction event={event2} />}
<GuildEventShareAction event={event2} />
</ButtonGroup>;
};
useStyles = createStyles({
actionContainer: {
paddingTop: Module712.space.PX_16,
paddingBottom: 0
}
});
const r43 = memo(function({ event, onPress, onCloseAction, hideControls = false, hideAgeVerificationNotice = false, isNew = false }) {
const channel_id = event.channel_id;
const isConnected = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.isConnected() && RTCConnectionStore.getChannelId() === channel_id, [channel_id]) && isGuildScheduledEventActive(event);
const handlePress = function handlePress() {
if (onPress != null) {
onPress(event);
}
};
const recurrenceRule = recurrenceRuleFromServer(event.recurrence_rule);
return <Card accessible={false} onPress={handlePress}>
<View>
<GuildEventCardHeader event={event} isNew={isNew} />
<GuildEventCardMetaInfo event={event} onTitlePress={handlePress} />
{(hideAgeVerificationNotice ? !hideAgeVerificationNotice : AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(event.entity_type)) && <StageChannelAgeVerificationNotice noBackground onConfirmPress={onCloseAction} channelId={channel_id} />}
<GuildEventSimpleLocation event={event} />
{hideControls ? null : <GuildEventCardControls event={event} onCloseAction={onCloseAction} isConnected={isConnected} />}
{recurrenceRule != null && <GuildEventRecurrences guildId={event.guild_id} recurrenceRule={recurrenceRule} guildEventId={event.id} onRecurrencePress={(a0) => onPress == null ? void 0 : onPress(event, a0)} />}
</View>
</Card>;
});
export default r43;
export { useStyles as useGuildEventCardStyles };
@@ -0,0 +1,678 @@
// Metro module 8225 (f8226).
import _slicedToArray from "../../../../_bundle/_slicedToArray";
import * as Module19 from "react";
import { useMemo, useState, useCallback } from "react";
import { Pressable, View, Image } from "react-native";
import AuthenticationStore from "../../../../stores/AuthenticationStore";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildMemberStore from "../../../../stores/GuildMemberStore";
import GuildStore from "../../../../stores/GuildStore";
import PermissionStore from "../../../../stores/PermissionStore";
import UserStore from "../../../../stores/UserStore";
import GuildScheduledEventStore, { isGuildEventEnded, isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { JoinGuildSources, Permissions } from "../../../../Constants";
import { Fonts, NOOP } from "../../../../_bundle/Module505";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useCanInviteForGuildEvent from "../../useCanInviteForGuildEvent";
import { SHARE_EVENT_DETAILS_LINK } from "../../utils/ShareEventUtils";
import { IconButton } from "../../../../design/components/Button/native/IconButton.native";
import { intl, t } from "../../../../intl/index.native";
import { openStartGuildEventModal, openShareEvent, showGuildEventModeratorActionSheet } from "../GuildScheduledEventModalActionCreators";
import { copy } from "../../../../utils/ClipboardUtils.native";
import { presentLinkCopied } from "../../../toast/native/ToastUtils";
import Module12238 from "../../../../_bundle/Module12238";
import Module4134 from "../../../../_bundle/Module4134";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import Module8964 from "../../../../_bundle/Module8964";
import { CheckmarkLargeIcon } from "../../../../design/components/Icon/native/redesign/generated/CheckmarkLargeIcon";
import { BellIcon } from "../../../../design/components/Icon/native/redesign/generated/BellIcon";
import ThrottledButton from "./ThrottledButton";
import { getEventTimeData } from "../../utils/ScheduleUtils";
import GuildActionCreators from "../../../../actions/GuildActionCreators";
import { transitionToGuild } from "../../../routing/transitionToGuild.native";
import useSelectStage from "../../useSelectStage";
import AlertActionCreators from "../../../../actions/native/AlertActionCreators";
import GuildScheduledEventsActionCreators from "../../GuildScheduledEventsActionCreators";
import Alert from "../../../../components_native/common/Alert";
import { openGuildVoiceModal } from "../../../../utils/native/PrivateChannelCallUtils";
import { assertNever } from "../../../../utils/GlobalUtils";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import { makeSource } from "../../../../utils/AvatarUtils";
import getGuildEventImage from "../../utils/getGuildEventImage";
import useGuildScheduledEventUserCount from "../../useGuildScheduledEventUserCount";
import { IconPill, NewTag, Avatar, AvatarSizes, Icon } from "../../../../design/void/native";
import { GroupIcon } from "../../../../design/components/Icon/native/redesign/generated/GroupIcon";
import useTheme from "../../../../hooks/useTheme";
import useEventException from "../../useEventException";
import useEventSchedule from "../../useEventSchedule";
import { getGuildScheduledEventHeaderProps } from "../GuildScheduledEventHeaderUtils";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Text } from "../../../../design/components/Text/native/Text";
import { CalendarIcon } from "../../../../design/components/Icon/native/redesign/generated/CalendarIcon";
import { guildEventDetailsParser } from "../../guildEventDetailsParser.native";
import useChannelName from "../../../channel/useChannelName";
import { getLocationFromEvent } from "../../utils/EntityUtils";
import { getEventLocationIconComponent, getEventLocationIconSource } from "./GuildEventUtils";
import getChannelA11yLabel from "../../../channel/getChannelA11yLabel";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
function $mk80145($env) {
return () => {
const r0 = $env;
return $env.$parent[17].isInterestedInEventRecurrence(r0[0].id, r0[1]);
};
}
function $mk80146($env) {
return function() {
const r2 = $env;
const r1 = $env.$parent;
const r5 = (0, r1[0])(r1[2][21]);
const r8 = r2[0];
r5.handleGuildScheduledEventRsvp(r8.id, r2[1], r8.guild_id);
};
}
let GuildEventCardRSVPAction, GuildEventJoinAndRSVPAction, UserCountIconPill, GuildEventCardTitle, GuildEventCardDescription, useStyles, c5230_26;
let env5230 = {};
export function usePrimaryActionButtonType(a0, a1) {
let r45, r57, ENDED;
const { guild_id, channel_id, scheduled_start_time, entity_type } = a0;
const withinStartWindow = useMemo(() => getEventTimeData(scheduled_start_time), [scheduled_start_time]).withinStartWindow;
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id));
let r31 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id), [channel_id]);
if (r31 == null) {
r31 = stateFromStores4;
}
const r37 = (0, useManageResourcePermissions(r31).canManageGuildEvent)(a0);
if (useStateFromStores([GuildStore], () => GuildStore.getGuild(a0.guild_id) != null)) {
L26: {
if ((0, isGuildEventEnded)(a0)) {
ENDED = c5230_26.ENDED;
} else if ((0, isGuildScheduledEventActive)(a0)) {
if (entity_type === GuildScheduledEventEntityTypes.EXTERNAL) {
r57 = r37 ? c5230_26.END : c5230_26.STARTED;
} else {
r57 = a1 ? r37 ? c5230_26.END : c5230_26.CONNECTED : c5230_26.JOIN;
}
ENDED = r57;
} else {
if (withinStartWindow && r37) {
ENDED = c5230_26.START;
break L26;
}
ENDED = c5230_26.RSVP;
}
}
r45 = ENDED;
} else {
r45 = c5230_26.JOIN_GUILD;
}
return r45;
}
GuildEventCardRSVPAction = function GuildEventCardRSVPAction(props) {
let env16384;
const { event: event6, recurrenceId: recurrenceId3 } = props;
const r15 = env16384 = {
$parent: env5230
};
env16384[0] = event6;
env16384[1] = recurrenceId3;
const r7 = [GuildScheduledEventStore];
const r17 = [event6.id, recurrenceId3];
const [checked, onPress2] = [useStateFromStores(r7, $mk80145(r15), r17), $mk80146(r15)];
const variant = checked ? "tertiary" : "secondary";
const Component = checked ? CheckmarkLargeIcon : BellIcon;
return <ThrottledButton accessibilityRole="togglebutton" accessibilityState={{
checked
}} accessibilityLabel={`${intl.string(t.DlcqlU)}, ${event6.name}`} variant={variant} icon={<Component size="sm" />} text={intl.string(t.DlcqlU)} onPress={onPress2} grow />;
};
GuildEventJoinAndRSVPAction = function GuildEventJoinAndRSVPAction(props) {
let c16385_1, c16385_2, setState;
let env16386;
const { event, recurrenceId: recurrenceId3 } = props;
c16385_1 = void 0;
c16385_2 = void 0;
setState = void 0;
let _handleJoinGuild2 = function _handleJoinGuild() {
const r9 = async () => {
let c29926_2;
let c29926_3 = 0;
try {
setState(true);
c29926_3 = 1;
await GuildActionCreators.joinGuild(event.guild_id, {
source: JoinGuildSources.DIRECTORY_EVENTS
});
transitionToGuild(event.guild_id);
if (!(c16385_1 || (0, isGuildScheduledEventActive)(event))) {
(0, c16385_2)();
}
c29926_3 = 0;
(0, setState)(false);
} catch ($e) {
const r27 = $e;
let r7 = r27;
c29926_2 = r27;
if (c29926_3 !== 0) {
while (true) {
try {
const r84 = c29926_2;
c29926_3 = 0;
(0, setState)(false);
throw r84;
} catch (r81) {
r7 = r81;
c29926_2 = r81;
if (c29926_3 === 0) {
break;
}
}
}
}
throw r7;
}
};
_handleJoinGuild2 = r9;
return r9.apply(this, arguments);
};
const r16 = env16386 = {
$parent: env5230
};
env16386[0] = event;
env16386[1] = recurrenceId3;
const r10 = [GuildScheduledEventStore];
const r18 = [event.id, recurrenceId3];
[c16385_1, c16385_2] = [useStateFromStores(r10, $mk80145(r16), r18), $mk80146(r16)];
let loading;
[loading, setState] = useState(false);
return <ThrottledButton loading={loading} variant="active" text={intl.string(t.VJlc0S)} accessibilityLabel={`${intl.string(t.VJlc0S)}, ${event.name}`} onPress={function handleJoinGuild() {
return _handleJoinGuild2.apply(this, arguments);
}} grow />;
};
UserCountIconPill = function UserCountIconPill(props) {
const event6 = props.event;
const guildScheduledEventUserCount = useGuildScheduledEventUserCount(event6?.guild_id, event6?.id, props.recurrenceId);
return <IconPill accessibilityLabel={`${intl.formatToPlainString(t["+DLsD8"], {
count: guildScheduledEventUserCount
})}, ${event6.name}`} IconComponent={GroupIcon} text={guildScheduledEventUserCount.toLocaleString()} />;
};
GuildEventCardTitle = function GuildEventCardTitle(props) {
const { event: event6, style, textStyle, condensed, onPress: onPress2 } = props;
const styles = useStyles();
return <Pressable accessibilityRole="button" accessibilityHint={intl.string(t.epxpiy)} accessibilityLabel={event6.name} onPress={onPress2} style={[styles.topicContainer, style]}>
<Text variant="text-md/bold" color="mobile-text-heading-primary" style={textStyle} lineClamp={condensed ? 1 : void 0}>{event6.name}</Text>
</Pressable>;
};
GuildEventCardDescription = function GuildEventCardDescription(props) {
const event6 = props.event;
const { description, guild_id: guild_id5 } = event6;
const { style, textStyle, numberOfLines, condensed } = props;
const styles = useStyles();
return description != null ? description.length > 0 ? condensed ? null : description != null ? <View style={[styles.detailsContainer, style]}>
<Text variant="text-md/medium" color="text-subtle" style={textStyle} lineClamp={numberOfLines}>
{guildEventDetailsParser(description, true, {
guildId: guild_id5,
allowLinks: true,
allowHeading: true,
allowList: true
})}
</Text>
</View> : null : null : null;
};
const useStyles2 = createStyles({
imageHeaderContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
},
imageHeaderBanner: {
width: "100%",
aspectRatio: 2.5
},
headerContainer: {
flexDirection: "row",
alignItems: "center"
},
dateContainer: {
flexDirection: "row",
alignItems: "center",
flex: 1
},
dateIcon: {
marginRight: Module712.space.PX_8
},
newBadge: {
paddingHorizontal: 4,
paddingVertical: 2,
marginEnd: 8,
backgroundColor: Module712.colors.BACKGROUND_BRAND
},
topicContainer: {
paddingTop: Module712.space.PX_8
},
detailsContainer: {
paddingTop: Module712.space.PX_8
},
channelContainer: {
flexDirection: "row",
alignItems: "center",
paddingTop: Module712.space.PX_8
},
channelIcon: {
marginRight: Module712.space.PX_8
},
channelText: {
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.colors.TEXT_SUBTLE,
fontSize: 14,
lineHeight: 18,
flexShrink: 1
},
guildInfoContainer: {
flexDirection: "row",
alignItems: "center",
paddingTop: Module712.space.PX_8
},
guildIcon: {
marginRight: Module712.space.PX_8,
borderRadius: Module712.radii.sm
},
guildInfo: {
flexDirection: "column"
},
guildInfoChannelContainer: {
flexDirection: "row",
alignItems: "center"
},
guildInfoChannelText: {
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.colors.TEXT_SUBTLE,
fontSize: 12,
lineHeight: 16
},
creatorAvatar: {
marginRight: Module712.space.PX_8
}
});
useStyles = useStyles2;
c5230_26 = {
RSVP: 0,
0: "RSVP",
JOIN: 1,
1: "JOIN",
START: 2,
2: "START",
STARTED: 3,
3: "STARTED",
CONNECTED: 4,
4: "CONNECTED",
END: 5,
5: "END",
ENDED: 6,
6: "ENDED",
JOIN_GUILD: 7,
7: "JOIN_GUILD"
};
const r159 = Module19.memo(function GuildEventCardPrimaryAction(props) {
let c16387_6;
const { event: event2, isConnected, onCloseAction, recurrenceId } = props;
c16387_6 = void 0;
const { guild_id: guild_id2, channel_id: channel_id2 } = event2;
const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id2), [channel_id2]);
c16387_6 = _slicedToArray(useSelectStage(), 2)[1];
const primaryActionButtonType = usePrimaryActionButtonType(event2, isConnected);
const stateFromStores4 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.CONNECT, stateFromStores));
if (c5230_26.ENDED === primaryActionButtonType) {
return <ThrottledButton variant="secondary" text={intl.string(t.Pj7Xrv)} accessibilityLabel={`${intl.string(t.Pj7Xrv)}, ${event2.name}`} grow disabled onPress={NOOP} />;
}
const handleListenIn = function handleListenIn() {
if (stateFromStores != null) {
if (event2.entity_type === GuildScheduledEventEntityTypes.STAGE_INSTANCE) {
c16387_6(guild_id2, stateFromStores.id);
}
openGuildVoiceModal(stateFromStores);
if (onCloseAction != null) {
onCloseAction();
}
}
};
if (c5230_26.JOIN === primaryActionButtonType) {
const text = stateFromStores4 ? intl.string(t.ZYO5OK) : intl.string(t.TVBCKZ);
return <ThrottledButton variant="active" text={text} accessibilityLabel={`${text}, ${event2.name}`} onPress={handleListenIn} disabled={!stateFromStores4} grow />;
}
if (c5230_26.CONNECTED === primaryActionButtonType) {
return <ThrottledButton variant="active" text={intl.string(t.aW2YlJ)} accessibilityLabel={`${intl.string(t.aW2YlJ)}, ${event2.name}`} onPress={handleListenIn} grow />;
}
if (c5230_26.RSVP === primaryActionButtonType) {
return (0, jsx)(GuildEventCardRSVPAction, {
event: event2,
recurrenceId
});
}
if (c5230_26.START === primaryActionButtonType) {
return <ThrottledButton variant="active" text={intl.string(t.cK1GGY)} accessibilityLabel={`${intl.string(t.cK1GGY)}, ${event2.name}`} onPress={function handleStartEvent() {
if (onCloseAction != null) {
onCloseAction();
}
openStartGuildEventModal(event2, recurrenceId);
}} grow />;
}
if (c5230_26.STARTED === primaryActionButtonType) {
return <ThrottledButton variant="secondary" text={intl.string(t.Yz0V6O)} accessibilityLabel={`${intl.string(t.Yz0V6O)}, ${event2.name}`} grow disabled onPress={NOOP} />;
}
if (c5230_26.END === primaryActionButtonType) {
return <ThrottledButton variant="secondary" text={intl.string(t.qaYzPA)} accessibilityLabel={`${intl.string(t.qaYzPA)}, ${event2.name}`} onPress={function handleEndEvent() {
AlertActionCreators.show({
title: intl.string(t.qaYzPA),
body: intl.string(t.bnDQ7E),
cancelText: intl.string(t.gm1Vej),
confirmText: intl.string(t.p89ACt),
onConfirm: () => GuildScheduledEventsActionCreators.endEvent(event2.id, event2.guild_id),
confirmColor: Alert.Colors.RED
});
}} grow />;
}
if (c5230_26.JOIN_GUILD === primaryActionButtonType) {
return (0, jsx)(GuildEventJoinAndRSVPAction, {
event: event2,
recurrenceId
});
}
assertNever(primaryActionButtonType);
});
export { useStyles2 as useGuildEventCardStyles };
export function GuildEventShareAction(props) {
const event3 = props.event;
const canInviteForGuildEvent = useCanInviteForGuildEvent(event3);
let c16388_1 = canInviteForGuildEvent;
let c16388_2 = SHARE_EVENT_DETAILS_LINK({
guildId: event3.guild_id,
guildEventId: event3.id
});
return <IconButton accessibilityLabel={`${intl.string(t.RDE0Sc)}, ${event3.name}`} onPress={function onPress() {
if (c16388_1) {
openShareEvent(event3);
} else {
copy(c16388_2);
presentLinkCopied();
}
}} icon={canInviteForGuildEvent ? Module12238 : Module4134} variant="secondary" />;
}
export function GuildEventModeratorAction(props) {
let canManageGuildEvent;
const { event: event4, recurrenceId: recurrenceId2 } = props;
canManageGuildEvent = void 0;
const channel_id3 = event4.channel_id;
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(event4.guild_id));
let r24 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id3), [channel_id3]);
if (r24 == null) {
r24 = stateFromStores4;
}
canManageGuildEvent = (0, useManageResourcePermissions(r24).canManageGuildEvent)(event4);
return <IconButton accessibilityLabel={`${intl.string(t.HIgA5a)}, ${event4.name}`} onPress={() => showGuildEventModeratorActionSheet(event4, canManageGuildEvent, recurrenceId2)} icon={Module8964} variant="secondary" />;
}
export function useEventRsvpState(a0, a1) {
let env16382;
const r2 = env16382 = {
$parent: env5230
};
env16382[0] = a0;
env16382[1] = a1;
const r11 = [GuildScheduledEventStore];
const r13 = [a0.id, a1];
return [useStateFromStores(r11, $mk80145(r2), r13), $mk80146(r2)];
}
export function GuildEventIndicateInterestAction(props) {
let env16390;
const event6 = props.event;
const r16 = env16390 = {
$parent: env5230
};
env16390[0] = event6;
env16390[1] = null;
const r8 = [GuildScheduledEventStore];
const r6 = [event6.id, null];
const [checked, onPress2] = [useStateFromStores(r8, $mk80145(r16), r6), $mk80146(r16)];
const variant = checked ? "tertiary" : "secondary";
const Component = checked ? CheckmarkLargeIcon : BellIcon;
return <ThrottledButton accessibilityRole="togglebutton" accessibilityState={{
checked
}} accessibilityLabel={`${intl.string(t.DlcqlU)}, ${event6.name}`} variant={variant} icon={<Component size="sm" />} text={intl.string(t.DlcqlU)} onPress={onPress2} grow />;
}
export { c5230_26 as PrimaryActionType };
export { GuildEventCardRSVPAction };
export { GuildEventJoinAndRSVPAction };
export { r159 as GuildEventCardPrimaryAction };
export function GuildEventCardImageHeader(props) {
const event6 = props.event;
const styles = useStyles();
let width2 = useWindowDimensions_native().width;
const [state, setState2] = useState(0);
const callback = useCallback(({ nativeEvent }) => {
const width = nativeEvent.layout.width;
if (width > 0) {
setState2((prevState2) => {
const r5 = Math;
let r7 = width;
if (r5.abs(prevState2 - width) < 1) {
r7 = prevState2;
}
return r7;
});
}
}, []);
if (event6.image == null) {
return null;
}
if (state > 0) {
width2 = state;
}
return <View style={styles.imageHeaderContainer} onLayout={callback}>
<Image style={styles.imageHeaderBanner} source={makeSource(getGuildEventImage(event6, width2))} resizeMode="cover" />
</View>;
}
export { UserCountIconPill };
export function GuildEventCardHeader(props) {
let r104, r118, jsx2;
let color, shouldChangeTextColor;
const { event: event5, recurrenceId: recurrenceId3, showUserCount = true, showEndDate = false, isPreview = false } = props;
let showCreator = props.showCreator;
if (showCreator === void 0) {
showCreator = true;
}
const { isNew = false, isActive = false, style } = props;
color = void 0;
shouldChangeTextColor = void 0;
const styles = useStyles();
const theme = useTheme();
let r30 = useEventException(recurrenceId3, event5?.id);
const entity_type = event5.entity_type;
if (r30 == null) {
r30 = {};
}
const is_canceled = r30.is_canceled;
const isCanceled = is_canceled !== void 0 && is_canceled;
const eventSchedule = useEventSchedule(event5, recurrenceId3);
const r19 = eventSchedule == null ? void 0 : eventSchedule.startTime.toISOString();
let c16392_1 = r19;
let r38 = void 0;
if (showEndDate) {
const r39 = eventSchedule == null;
let r40 = void 0;
if (!r39) {
const endTime = eventSchedule.endTime;
r40 = endTime == null ? void 0 : endTime.toISOString();
}
r38 = r40;
}
let c16392_2 = r38;
const memo = useMemo(() => getEventTimeData(c16392_1, c16392_2), [r19, r38]);
const guildScheduledEventHeaderProps = getGuildScheduledEventHeaderProps({
eventTimeData: memo,
isStage: entity_type === GuildScheduledEventEntityTypes.STAGE_INSTANCE,
theme,
event: event5,
isCanceled,
recurrenceId: recurrenceId3
});
color = guildScheduledEventHeaderProps.color;
const text = guildScheduledEventHeaderProps.text;
let shouldChangeTextColor2 = guildScheduledEventHeaderProps.shouldChangeTextColor;
shouldChangeTextColor = shouldChangeTextColor2;
const endDateTimeString = memo.endDateTimeString;
let r61 = null;
if (showUserCount) {
const r65 = <UserCountIconPill event={event5} recurrenceId={recurrenceId3} />;
r61 = isPreview ? r65 : <PressableOpacity accessibilityRole="button" onPress={function handleOpenRSVPList() {}}>{r65}</PressableOpacity>;
}
const stateFromStores4 = useStateFromStores([UserStore], () => UserStore.getUser(event5.creator_id), [event5]);
const r80 = endDateTimeString != null && endDateTimeString !== "";
const children = r80 ? intl.format(t.vHYgJW, {
start: text,
startHook: function startHook(a0) {
let style = shouldChangeTextColor;
if (shouldChangeTextColor) {
style = {
color
};
}
return <Text variant="text-sm/semibold" color="text-subtle" style={style}>
{a0}
</Text>;
},
end: endDateTimeString
}) : text;
if (isNew) {
r104 = <NewTag containerStyle={styles.newBadge} variant="text-xs/bold" />;
jsx2 = jsx;
} else {
r104 = <CalendarIcon size="sm" color={color} style={styles.dateIcon} />;
jsx2 = jsx;
}
const r111 = [r104, , , ,];
if (r80) {
r118 = {
variant: "text-sm/semibold",
color: "text-default",
children
};
} else {
const color2 = isActive ? "text-strong" : "text-subtle";
if (shouldChangeTextColor) {
shouldChangeTextColor2 = {
color
};
}
r118 = {
variant: "text-sm/semibold",
color: color2,
style: shouldChangeTextColor2,
children
};
}
r111[1] = jsx2(View, {
style: styles.dateContainer,
children: jsx2(Text, r118)
});
if (showCreator) {
showCreator = stateFromStores4 != null;
}
if (showCreator) {
showCreator = jsx2(Avatar, {
accessible: true,
accessibilityLabel: `${intl.formatToPlainString(t["+3iypQ"], {
username: stateFromStores4.username
})}, ${event5.name}`,
user: stateFromStores4,
guildId: event5.guild_id,
size: AvatarSizes.XSMALL_20,
style: styles.creatorAvatar
});
}
r111[2] = showCreator;
r111[3] = r61;
return <View style={[styles.headerContainer, style]}>{r111}</View>;
}
export { GuildEventCardTitle };
export { GuildEventCardDescription };
export function GuildEventCardMetaInfo(props) {
const { event: event6, titleStyle, titleContainerStyle, onTitlePress, descriptionStyle, descriptionContainerStyle, condensed } = props;
return <>
<GuildEventCardTitle event={event6} textStyle={titleStyle} style={titleContainerStyle} condensed={condensed} onPress={onTitlePress} />
<GuildEventCardDescription event={event6} textStyle={descriptionStyle} style={descriptionContainerStyle} condensed={condensed} numberOfLines={3} />
</>;
}
export function GuildEventSimpleLocation(props) {
const event6 = props.event;
const styles = useStyles();
const { channel_id: channel_id4, guild_id: guild_id5 } = event6;
const stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id4), [channel_id4]);
const stateFromStores4 = useStateFromStores([GuildMemberStore, AuthenticationStore], () => GuildMemberStore.isMember(stateFromStores2?.guild_id, AuthenticationStore.getId()), [stateFromStores2]);
const channelName = useChannelName(stateFromStores2);
const locationFromEvent = getLocationFromEvent(event6);
if (stateFromStores2 == null && locationFromEvent == null) {
return null;
}
let r14 = channelName;
if (r14 == null) {
r14 = locationFromEvent;
}
const eventLocationIconComponent = getEventLocationIconComponent(event6, stateFromStores2, stateFromStores4);
return <View style={styles.channelContainer}>
{eventLocationIconComponent != null && (0, jsx)(eventLocationIconComponent, {
size: "sm",
style: styles.channelIcon
})}
<Text style={styles.channelText} accessibilityLabel={stateFromStores2 != null ? getChannelA11yLabel({
channel: stateFromStores2
}) : locationFromEvent != null ? `${intl.string(t.gwSn4I)}, ${locationFromEvent}` : void 0} variant="text-sm/medium" color="text-default">
{r14 != null ? guildEventDetailsParser(r14, true, {
guildId: guild_id5
}) : null}
</Text>
</View>;
}
export function GuildEventCardSimpleGuildInfo(props) {
const { event: event6, style, textStyle } = props;
const styles = useStyles();
const guild_id3 = event6.guild_id;
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id3), [guild_id3]);
return stateFromStores4 != null ? <View style={[styles.guildInfoContainer, style]}>
<GuildIcon guild={stateFromStores4} size={GuildIconSizes.XSMALL_20} style={styles.guildIcon} />
<View style={styles.guildInfo}>
<Text variant="text-sm/semibold" style={textStyle}>{stateFromStores4.name}</Text>
</View>
</View> : null;
}
export function GuildEventCardGuildInfo(props) {
const event6 = props.event;
const styles = useStyles();
const { channel_id: channel_id5, guild_id: guild_id4 } = event6;
const stateFromStores3 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channel_id5), [channel_id5]);
const stateFromStores4 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id4), [guild_id4]);
const stateFromStores5 = useStateFromStores([GuildMemberStore, AuthenticationStore], () => GuildMemberStore.isMember(stateFromStores3?.guild_id, AuthenticationStore.getId()), [stateFromStores3]);
const channelName = useChannelName(stateFromStores3);
if (stateFromStores4 == null) {
return null;
}
const locationFromEvent = getLocationFromEvent(event6);
let r53 = stateFromStores3 != null || locationFromEvent != null;
let r15 = channelName;
if (r15 == null) {
r15 = locationFromEvent;
}
const eventLocationIconSource = getEventLocationIconSource(event6, stateFromStores3, stateFromStores5);
const r70 = [<GuildIcon guild={stateFromStores4} size={GuildIconSizes.SMALL} style={styles.guildIcon} />, ,];
const r79 = [<Text variant="text-sm/medium" color="mobile-text-heading-primary">{stateFromStores4.name}</Text>, ,];
if (r53) {
r53 = <View style={styles.guildInfoChannelContainer} accessible accessibilityLabel={stateFromStores3 != null ? getChannelA11yLabel({
channel: stateFromStores3
}) : locationFromEvent != null ? `${intl.string(t.gwSn4I)}, ${locationFromEvent}` : void 0}>
{eventLocationIconSource != null && <Icon source={eventLocationIconSource} size={Icon.Sizes.EXTRA_SMALL} style={styles.channelIcon} disableColor />}
<Text style={styles.guildInfoChannelText} variant="text-xs/medium" color="text-default">{r15}</Text>
</View>;
}
r79[1] = r53;
r70[1] = <View style={styles.guildInfo}>{r79}</View>;
return <View style={styles.guildInfoContainer}>{r70}</View>;
}
@@ -0,0 +1,259 @@
// Metro module 8235 (f8236).
import { useMemo, useRef } from "react";
import { View } from "react-native";
import { GUILD_EVENT_MAX_NAME_LENGTH, MAX_EVENT_LOCATION_LENGTH, GuildScheduledEventEntityTypes, GUILD_EVENT_MAX_DESCRIPTION_LENGTH } from "../../GuildScheduledEventsConstants";
import { GuildFeatures } from "../../../../Constants";
import { jsx } from "react/jsx-runtime";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { TextInput } from "../../../../design/components/TextInput/native/TextInput.native";
import { intl, t } from "../../../../intl/index.native";
import { recurrenceRuleToOption, getRecurrenceOptions } from "../../utils/ScheduleUtils";
import { Text } from "../../../../design/components/Text/native/Text";
import { InputButton } from "../../../../design/components/experimental/native";
import { dismissGlobalKeyboard } from "../../../../utils/native/KeyboardManagerUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import Module8247 from "../../../../_bundle/Module8247";
import { useChannelsUserCanStartStageIn } from "../../useGuildsUserCanStartStageIn";
import Module8249 from "../../../../_bundle/Module8249";
import { VoiceNormalIcon } from "../../../../design/components/Icon/native/redesign/generated/VoiceNormalIcon";
import Module8250 from "../../../../_bundle/Module8250";
import { LocationIcon } from "../../../../design/components/Icon/native/redesign/generated/LocationIcon";
import Module7683 from "../../../../_bundle/Module7683";
import { StageIcon } from "../../../../design/components/Icon/native/redesign/generated/StageIcon";
import { TableRadioGroup } from "../../../../design/components/TableRow/native/TableRadioGroup.native";
import { TableRadioRow } from "../../../../design/components/TableRow/native/TableRadioRow.native";
import { TextArea } from "../../../../design/components/TextInput/native/TextArea.native";
import Module3771 from "../../../../_bundle/Module3771";
import { Stack } from "../../../../design/components/Stack/native/Stack.native";
function $mk105764($env) {
return () => {
const r6 = $env.$parent;
if (!r6[5]) {
const r8 = $env;
const r3 = $env.$parent.$parent;
const r4 = r3[2];
const r2 = r3[3];
r4(r2[11]).dismissGlobalKeyboard();
const mode = r8[0];
const title = mode === "date" ? r6[0] : r6[1];
const r17 = (0, r3[1])(r2[12]);
const r23 = (0, r3[0])(r2[14])(r2[27], r2.paths);
const r25 = {
onSubmit: $mk115273(r8),
title,
startDate: null,
minimumDate: null,
maximumDate: null,
requireDateChanged: true,
mode: null
};
const r26 = r6[2];
r25.startDate = r26.toDate();
const r29 = r6[3];
r25.minimumDate = r29 != null ? r29.toDate() : r26.toDate();
r25.maximumDate = r6[4].toDate();
r25.mode = mode;
r17.openLazy(r23, "DatePicker", r25);
}
};
}
function $mk115273($env) {
return (a0) => {
if ($env[0] !== "date") {
(0, $env.$parent[6])(a0);
} else {
const set = a0.set;
const r9 = $env.$parent;
const r7 = r9[2];
(0, r9[6])(set.call(a0, {
hour: r7.get("hour"),
minute: r7.get("minute"),
second: 0,
millisecond: 0
}));
}
};
}
let env5239 = {};
const useStyles = createStyles({
formGroup: {
paddingVertical: 8
},
formGroupSmall: {
paddingVertical: 4
},
formGroupLarge: {
paddingTop: 16,
paddingBottom: 4
},
dateInput: {
flexGrow: 1,
flexShrink: 1,
flexBasis: "60%"
},
timeInput: {
flexGrow: 1,
flexShrink: 1,
flexBasis: "30%"
},
formHeader: {
marginBottom: 8
},
header: {
display: "flex",
flexDirection: "row",
alignItems: "center",
marginBottom: 8
}
});
export function GuildEventTopic(props) {
const { topic, onChange } = props;
return <View style={useStyles().formGroupSmall}>
<TextInput label={intl.string(t["0HbEQ6"])} accessibilityLabel={intl.string(t["0HbEQ6"])} placeholder={intl.string(t["6/yars"])} onChange={onChange} value={topic} maxLength={GUILD_EVENT_MAX_NAME_LENGTH} autoFocus isClearable />
</View>;
}
export function GuildEventLocation(props) {
const { location: location2, onChange, onFocus: onFocus3 } = props;
return <View style={useStyles().formGroupLarge}>
<TextInput label={intl.string(t.yx785A)} placeholder={intl.string(t.mkCMia)} value={location2} maxLength={MAX_EVENT_LOCATION_LENGTH} onChange={onChange} onFocus={onFocus3} isClearable />
</View>;
}
export function GuildEventRecurrence(props) {
let recurrenceOptions;
const { startDate, recurrenceRule, onRecurrenceChange } = props;
recurrenceOptions = void 0;
const styles = useStyles();
const memo = useMemo(() => recurrenceRuleToOption(startDate, recurrenceRule), [recurrenceRule, startDate]);
recurrenceOptions = getRecurrenceOptions(startDate);
const label = recurrenceOptions.find((recurrenceOption) => recurrenceOption.value === memo)?.label;
return <View style={styles.formGroup}>
<View style={styles.header}>
<Text variant="text-sm/semibold" color="text-subtle">
{intl.string(t["59TVxL"])}
</Text>
</View>
<InputButton onPress={function onPress() {
dismissGlobalKeyboard();
ActionSheetActionCreators.openLazy(import("../../../../components_native/common/ItemSelectorActionSheet"), "SelectRecurrenceOption", {
title: intl.string(t["59TVxL"]),
items: recurrenceOptions,
onItemSelect: (a0) => {
onRecurrenceChange(a0);
ActionSheetActionCreators.hideActionSheet();
},
selectedItem: memo,
hasIcons: false
});
}} text={intl.string(t["59TVxL"])} value={label} icon={Module8247} iconPosition="end" accessibilityLabel={intl.string(t["59TVxL"])} accessibilityHint={label} />
</View>;
}
export function GuildEventEntityTypeSelection({ guild, entityType, disabled, onChange }) {
const channelsUserCanStartStageIn = useChannelsUserCanStartStageIn(guild);
const r43 = [{
name: intl.string(t.BVZqJl),
value: GuildScheduledEventEntityTypes.VOICE,
description: intl.string(t["EV//4f"]),
icon: Module8249,
IconComponent: VoiceNormalIcon,
disabled
}, {
name: intl.string(t.w7ipbz),
value: GuildScheduledEventEntityTypes.EXTERNAL,
description: intl.string(t.DYxrHm),
icon: Module8250,
IconComponent: LocationIcon,
disabled
}];
if (guild.features.has(GuildFeatures.COMMUNITY)) {
r43.unshift({
name: intl.string(t.EErMzA),
value: GuildScheduledEventEntityTypes.STAGE_INSTANCE,
description: intl.string(t.LgALpp),
icon: Module7683,
IconComponent: StageIcon,
disabled: channelsUserCanStartStageIn.length === 0 || disabled
});
}
return (0, jsx)(TableRadioGroup, {
defaultValue: entityType,
onChange,
hasIcons: true,
children: r43.map(({ name, value, description, IconComponent, disabled }) => <TableRadioRow key={name} label={name} subLabel={description} value={value} icon={<IconComponent />} disabled={disabled} />)
});
}
export function GuildEventDescription(props) {
const { description, onChange, onFocus: onFocus2 } = props;
const styles = useStyles();
const ref = useRef(null);
return <View style={styles.formGroupSmall} ref={ref}>
<TextArea label={intl.string(t["+gRCC7"])} maxLength={GUILD_EVENT_MAX_DESCRIPTION_LENGTH} placeholder={intl.string(t["kWO/E8"])} onChange={onChange} onFocus={function onFocus() {
if (onFocus2 != null) {
onFocus2(ref);
}
}} value={description} />
</View>;
}
export function GuildEventDatetime(props) {
let env16406;
const r14 = env16406 = {
$parent: env5239
};
const dateLabel = props.dateLabel;
env16406[0] = dateLabel;
const timeLabel = props.timeLabel;
env16406[1] = timeLabel;
let date = props.date;
if (date === void 0) {
date = Module3771();
}
env16406[2] = date;
env16406[3] = props.minimumDate;
let maximumDate = props.maximumDate;
if (maximumDate === void 0) {
maximumDate = Module3771().add(30, "days").endOf("month");
}
env16406[4] = maximumDate;
const disabled = props.disabled;
env16406[5] = disabled;
let onChange = props.onChange;
if (onChange === void 0) {
onChange = () => {};
}
let env16407;
let env16408;
env16406[6] = onChange;
const styles = useStyles();
const r47 = [<Text style={styles.formHeader} variant="text-sm/semibold" color="text-subtle">{dateLabel}</Text>, ,];
const props2 = {
text: dateLabel,
value: date.format("MMM Do YYYY"),
onPress: null,
disabled: null
};
const r54 = env16407 = {
$parent: r14
};
env16407[0] = "date";
props2.onPress = $mk105764(r54);
props2.disabled = disabled;
r47[1] = <InputButton {...props2} />;
const r59 = [<View style={styles.dateInput}>{r47}</View>, ,];
const r68 = [<Text style={styles.formHeader} variant="text-sm/semibold" color="text-subtle">{timeLabel}</Text>, ,];
const props3 = {
text: timeLabel,
value: date.format("LT"),
onPress: null,
disabled: null
};
const r76 = env16408 = {
$parent: r14
};
env16408[0] = "time";
props3.onPress = $mk105764(r76);
props3.disabled = disabled;
r68[1] = <InputButton {...props3} />;
r59[1] = <View style={styles.timeInput}>{r68}</View>;
return <View style={styles.formGroup}>
<Stack direction="horizontal" spacing={16}>{r59}</Stack>
</View>;
}
@@ -0,0 +1,112 @@
// Metro module 8333 (f8334).
import { useMemo } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useEventException from "../../useEventException";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import { useEventScheduleById } from "../../useEventSchedule";
import { getEventTimeData } from "../../utils/ScheduleUtils";
import { intl, t } from "../../../../intl/index.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { GuildEventCardHeader } from "./GuildEventCardComponents";
import { Text } from "../../../../design/components/Text/native/Text";
import { showGuildEventModeratorActionSheet } from "../GuildScheduledEventModalActionCreators";
import { Icon } from "../../../../design/void/native";
import Module8334 from "../../../../_bundle/Module8334";
const useStyles = createStyles({
container: {
alignSelf: "stretch",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center"
},
eventHeader: {
marginStart: 8,
flexShrink: 0,
flexGrow: 1
},
active: {
backgroundColor: Module712.colors.INTERACTIVE_BACKGROUND_SELECTED,
borderRadius: Module712.radii.xs
},
actions: {
alignItems: "center",
flexDirection: "row",
flexShrink: 0
},
secondarySmallButton: {
flexShrink: 0,
alignItems: "center",
flexDirection: "row",
padding: 8,
marginLeft: 8,
borderRadius: Module712.radii.xs
},
secondarySmallIcon: {
tintColor: Module712.colors.TEXT_STRONG
}
});
export default function GuildEventRecurrence(props) {
let stateFromStores2, canManageGuildEvent, c16509_6, is_canceled;
const { recurrenceId, guildEventId, onPress: onPress2, isActive } = props;
stateFromStores2 = void 0;
canManageGuildEvent = void 0;
c16509_6 = void 0;
is_canceled = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([GuildScheduledEventStore], () => GuildScheduledEventStore.getGuildScheduledEvent(guildEventId));
let r30 = useEventException(recurrenceId, stateFromStores?.id);
stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(stateFromStores?.guild_id));
let r42 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(stateFromStores?.channel_id));
if (r42 == null) {
r42 = stateFromStores2;
}
canManageGuildEvent = (0, useManageResourcePermissions(r42).canManageGuildEvent)(stateFromStores);
const eventScheduleById = useEventScheduleById(guildEventId, recurrenceId);
const r54 = eventScheduleById == null ? void 0 : eventScheduleById.startTime.toISOString();
c16509_6 = r54;
const memo = useMemo(() => c16509_6 != null ? getEventTimeData(c16509_6) : null, [r54]);
if (stateFromStores == null) {
return null;
}
if (r30 == null) {
r30 = {};
}
const is_canceled2 = r30.is_canceled;
let r63 = is_canceled2 !== void 0 && is_canceled2;
is_canceled = r63;
const accessibilityLabel = (is_canceled ? `${intl.string(t.fyBVRm)}, ` : "") + stateFromStores.name + (memo != null ? `, ${memo.startDateTimeString}` : "");
const style = [styles.container, isActive ? styles.active : void 0];
const r105 = [<PressableOpacity accessible accessibilityRole="button" accessibilityLabel={accessibilityLabel} onPress={function onPress(event) {
event.stopPropagation();
if (!is_canceled && onPress2 != null) {
onPress2(recurrenceId);
}
}} style={styles.eventHeader}>
<GuildEventCardHeader isActive={isActive} event={stateFromStores} showUserCount={false} showCreator={false} recurrenceId={recurrenceId} />
</PressableOpacity>, ,];
if (is_canceled) {
r63 = <Text variant="text-sm/semibold" color="text-feedback-critical">
{intl.string(t.fyBVRm)}
</Text>;
}
r105[1] = <View style={styles.actions}>
{r63}
<PressableOpacity accessible accessibilityRole="button" accessibilityLabel={`${intl.string(t.HIgA5a)}, ${accessibilityLabel}`} onPress={function onPress(event) {
if (stateFromStores != null) {
event.stopPropagation();
if (stateFromStores2 != null) {
showGuildEventModeratorActionSheet(stateFromStores, canManageGuildEvent, recurrenceId);
}
}
}} style={styles.secondarySmallButton}>
<Icon source={Module8334} size={Icon.Sizes.REFRESH_SMALL_16} style={styles.secondarySmallIcon} />
</PressableOpacity>
</View>;
return <View style={style}>{r105}</View>;
};
@@ -0,0 +1,54 @@
// Metro module 8330 (f8331).
import { useRef } from "react";
import { ScrollView, View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useGuildEventRecurrences from "../../useGuildEventRecurrences";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
import GuildEventRecurrence from "./GuildEventRecurrence";
import { Button } from "../../../../design/components/Button/native/Button.native";
const useStyles = createStyles({
container: {
marginTop: 16
},
scrollView: {
marginTop: 8,
marginBottom: 8,
borderRadius: Module712.radii.sm,
maxHeight: 140
}
});
export default function GuildEventRecurrences(props) {
const { guildId, recurrenceRule, guildEventId, onRecurrencePress, activeRecurrenceId, hideViewMoreButton } = props;
const ref = useRef(null);
const styles = useStyles();
const guildEventRecurrences = useGuildEventRecurrences(guildEventId, guildId, recurrenceRule);
const recurrenceStartTimes = guildEventRecurrences.recurrenceStartTimes;
let canViewMoreRecurrences = guildEventRecurrences.canViewMoreRecurrences;
const updateRecurrenceStartTimes = guildEventRecurrences.updateRecurrenceStartTimes;
const r44 = [<Text variant="heading-md/semibold">
{intl.string(t["D/jjoa"])}
</Text>, <ScrollView style={styles.scrollView} ref={ref}>
{recurrenceStartTimes.map((recurrenceStartTime) => {
const key = SnowflakeUtils.fromTimestamp(recurrenceStartTime.getTime());
return <GuildEventRecurrence key={key} recurrenceId={key} guildEventId={guildEventId} onPress={onRecurrencePress} isActive={key === activeRecurrenceId} />;
})}
</ScrollView>, ,];
if (canViewMoreRecurrences) {
canViewMoreRecurrences = !hideViewMoreButton;
}
if (canViewMoreRecurrences) {
canViewMoreRecurrences = <Button text={intl.string(t["8O7Hpy"])} onPress={function onPress(event) {
event.stopPropagation();
updateRecurrenceStartTimes();
const current = ref.current;
if (current != null) {
current.scrollToEnd();
}
}} size="sm" />;
}
r44[2] = canViewMoreRecurrences;
return <View style={styles.container}>{r44}</View>;
};
@@ -0,0 +1,31 @@
// Metro module 8234 (f8235).
import { useMemo } from "react";
import Module3771 from "../../../../_bundle/Module3771";
import { MAX_DAYS_AHEAD_AN_EVENT_CAN_START, MAX_DAYS_AHEAD_AN_EVENT_CAN_END, MAX_YEARS_AHEAD_RECURRING_EVENT } from "../../utils/ScheduleUtils";
import { GuildEventDatetime } from "./GuildEventModalComponents";
import { intl, t } from "../../../../intl/index.native";
export default function GuildEventSchedule(props) {
const { guildEvent, recurrenceId, schedule, onChange: onChange2 } = props;
const minimumDate = Module3771();
const maximumDate = Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_START, "days");
const memo = useMemo(() => Module3771(schedule.startDate).add(15, "minutes"), [schedule.startDate]);
const maximumDate2 = Module3771().add(MAX_DAYS_AHEAD_AN_EVENT_CAN_END, "days");
if (recurrenceId != null) {
maximumDate.add(MAX_YEARS_AHEAD_RECURRING_EVENT, "years");
maximumDate2.add(MAX_YEARS_AHEAD_RECURRING_EVENT, "years");
}
return <>
<GuildEventDatetime date={schedule.startDate} onChange={function onChange(event) {
onChange2({
...schedule,
startDate: event
});
}} minimumDate={minimumDate} maximumDate={maximumDate} dateLabel={intl.string(t.kKOIwJ)} timeLabel={intl.string(t["6dGmCD"])} />
{guildEvent.scheduled_end_time != null && <GuildEventDatetime date={schedule.endDate} onChange={function onChange(event) {
onChange2({
...schedule,
endDate: event
});
}} minimumDate={memo} maximumDate={maximumDate2} dateLabel={intl.string(t.CTLgZJ)} timeLabel={intl.string(t.j2RuXF)} />}
</>;
};
@@ -0,0 +1,25 @@
// Metro module 8315 (f8316).
import { getLocationFromEvent } from "../../utils/EntityUtils";
import Module8250 from "../../../../_bundle/Module8250";
import { getChannelIcon, getSimpleChannelIcon, getChannelIconComponent, getSimpleChannelIconComponent } from "../../../../utils/native/ChannelUtils";
import { LocationIcon } from "../../../../design/components/Icon/native/redesign/generated/LocationIcon";
export function getEventLocationIconSource(a0, a1, a2) {
return getLocationFromEvent(a0) != null ? Module8250 : a1 != null ? a2 ? getChannelIcon(a1) : getSimpleChannelIcon(a1) : null;
}
export function getEventLocationIconComponent(a0, a1, a2) {
let LocationIcon2;
if (getLocationFromEvent(a0) != null) {
LocationIcon2 = LocationIcon;
} else {
const r2 = a1 != null;
LocationIcon2 = null;
if (r2) {
let r17 = a2 ? getChannelIconComponent(a1) : getSimpleChannelIconComponent(a1);
if (r17 == null) {
r17 = null;
}
LocationIcon2 = r17;
}
}
return LocationIcon2;
}
@@ -0,0 +1,89 @@
// Metro module 12837 (f12838).
import { memo, useCallback } from "react";
import { View } from "react-native";
import SelectedChannelStore from "../../../../stores/SelectedChannelStore";
import { isGuildScheduledEventActive } from "../../GuildScheduledEventStore";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useActiveEvent, useImminentUpcomingGuildEvents } from "../../useGuildScheduledEvents";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import { getNextRecurrenceIdInEvent } from "../../utils/ScheduleUtils";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { openStartGuildEventModal } from "../GuildScheduledEventModalActionCreators";
import { openVoiceChannelActionSheet } from "../../../../utils/native/PrivateChannelCallUtils";
import { openGuildEventDetails } from "../../GuildScheduledEventModalActionCreators.native";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { GuildEventCardHeader, GuildEventCardMetaInfo } from "./GuildEventCardComponents";
import { Button } from "../../../../design/components/Button/native/Button.native";
import { intl, t } from "../../../../intl/index.native";
const useStyles = createStyles({
header: {
margin: 12,
padding: 12,
borderRadius: Module712.radii.sm,
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 1,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
},
descriptionContainerStyle: {
paddingTop: 4
},
buttonContainer: {
marginTop: 12
}
});
const r49 = memo(function({ channel }) {
let event, c20240_3;
event = void 0;
c20240_3 = void 0;
const styles = useStyles();
const activeEvent = useActiveEvent(channel.id);
const imminentUpcomingGuildEvents = useImminentUpcomingGuildEvents(channel.id);
const stateFromStores = useStateFromStores([SelectedChannelStore], () => SelectedChannelStore.getVoiceChannelId());
const id = channel.id;
event = activeEvent == null ? imminentUpcomingGuildEvents == null ? void 0 : imminentUpcomingGuildEvents[0] : activeEvent;
const r12 = (0, useManageResourcePermissions(channel).canManageGuildEvent)(event);
let r43 = getNextRecurrenceIdInEvent(event);
if (r43 == null) {
r43 = void 0;
}
c20240_3 = r43;
const callback = useCallback(() => {
if (activeEvent == null && event != null) {
ActionSheetActionCreators.hideActionSheet();
openStartGuildEventModal(event, c20240_3, () => {
openVoiceChannelActionSheet(channel);
});
}
}, [event, channel, activeEvent, r43]);
const callback2 = useCallback(() => {
if (event != null) {
ActionSheetActionCreators.hideActionSheet();
openGuildEventDetails({
eventId: event.id,
event
});
}
}, [event]);
if (event == null) {
return null;
}
let condensed = stateFromStores === id;
const isGuildScheduledEventActive2 = isGuildScheduledEventActive(event);
const r67 = [<GuildEventCardHeader event={event} showUserCount={false} />, <GuildEventCardMetaInfo event={event} descriptionContainerStyle={styles.descriptionContainerStyle} condensed={condensed} />, ,];
if (condensed) {
condensed = r12;
}
if (condensed) {
condensed = !isGuildScheduledEventActive2;
}
if (condensed) {
condensed = <View style={styles.buttonContainer}>
<Button text={intl.string(t.cK1GGY)} onPress={callback} variant="active" size="sm" grow />
</View>;
}
r67[2] = condensed;
return <PressableOpacity accessibilityRole="button" onPress={callback2} style={styles.header}>{r67}</PressableOpacity>;
});
export default r49;
@@ -0,0 +1,90 @@
// Metro module 8319 (f8320).
import { useRef, useEffect, useCallback } from "react";
import { View } from "react-native";
import ReadStateStore from "../../../../stores/ReadStateStore";
import { ANALYTICS_GUILD_EVENTS_MODAL_NAME } from "../../GuildScheduledEventsConstants";
import { AnalyticEvents } from "../../../../Constants";
import { ReadStateTypes } from "../../../read_states/ReadStateConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import useCanCreateAnEvent from "../../useCanCreateAnEvent";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { intl, t } from "../../../../intl/index.native";
import { ActionSheetHeaderPressableText } from "../../../../design/components/Sheet/native/ActionSheetHeaderPressableText.native";
import { closeGuildEventListActionSheet, openCreateOrEditGuildEventModal, openGuildEventListActionSheet } from "../GuildScheduledEventModalActionCreators";
import useGuildScheduledEvents from "../../useGuildScheduledEvents";
import GuildScheduledEventManager from "../../GuildScheduledEventManager";
import { openGuildEventDetails } from "../../GuildScheduledEventModalActionCreators.native";
import useMountEffect from "../../../../hooks/useMountEffect";
import AnalyticsUtils from "../../../../utils/AnalyticsUtils";
import { ackGuildFeature } from "../../../../actions/ReadStateActionCreators";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import GuildEventsListView from "./GuildEventsListView";
import useRefValue from "../../../../hooks/useRefValue";
let useStyles;
const GuildEventsListHeader = function GuildEventsListHeader(props) {
const { eventCount, guild } = props;
let trailing = useCanCreateAnEvent(guild.id);
let c16491_1 = trailing;
const title = eventCount > 0 ? intl.formatToPlainString(t.p1zLAf, {
count: eventCount
}) : intl.string(t.tlopTM);
if (trailing) {
trailing = <ActionSheetHeaderPressableText accessibilityLabel={intl.string(t["60lJ0C"])} label={intl.string(t.NzROFF)} onPress={function onPress() {
if (c16491_1) {
closeGuildEventListActionSheet();
openCreateOrEditGuildEventModal(guild, {
onClose: () => {
openGuildEventListActionSheet(guild);
}
});
}
}} />;
}
return <BottomSheetTitleHeader title={title} trailing={trailing} />;
};
useStyles = createStyles({
container: {
flex: 1
}
});
export default function GuildEventsListActionSheet(props) {
const guild2 = props.guild;
const guildScheduledEvents = useGuildScheduledEvents(guild2.id);
let c16492_1 = guildScheduledEvents;
const styles = useStyles();
const ref = useRef(ReadStateStore.ackMessageId(guild2.id, ReadStateTypes.GUILD_EVENT));
useEffect(() => {
c16492_1.forEach((item) => GuildScheduledEventManager.getGuildEventUserCounts(guild2.id, item.id, []));
GuildScheduledEventManager.getGuildEventsForCurrentUser(guild2.id);
}, [guildScheduledEvents, guild2.id]);
const callback2 = useCallback(() => {
closeGuildEventListActionSheet();
}, []);
const callback = useCallback((a0, a1) => {
openGuildEventDetails({
eventId: a0.id,
event: a0,
recurrenceId: a1,
onClose: () => {
openGuildEventListActionSheet(guild2);
}
});
}, [guild2]);
useMountEffect(() => {
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: ANALYTICS_GUILD_EVENTS_MODAL_NAME,
guild_id: guild2.id,
guild_events_count: c16492_1.length
});
});
useEffect(() => {
if (guild2.id != null) {
ackGuildFeature(guild2.id, ReadStateTypes.GUILD_EVENT);
}
}, [guild2.id]);
return <BottomSheet showGradient scrollable={guildScheduledEvents.length > 0} startExpanded dismissAccessibilityLabel={intl.string(t.VSlyAn)} header={<GuildEventsListHeader eventCount={guildScheduledEvents.length} guild={guild2} />}>
<View style={styles.container}>
<GuildEventsListView inActionSheet events={guildScheduledEvents} onPressEvent={callback} onCloseAction={callback2} guild={guild2} lastAckedId={useRefValue(ref)} />
</View>
</BottomSheet>;
};
@@ -0,0 +1,40 @@
// Metro module 8324 (f8325).
import { FlatList, View } from "react-native";
import Module712 from "../../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { BottomSheetView, BottomSheetFlatList } from "../../../../_bundle/Module5245";
import GuildEventsNoContent from "./GuildEventsNoContent";
import GuildEventCard from "./GuildEventCard";
import SnowflakeUtils from "../../../../utils/SnowflakeUtils";
let c5310_6;
const FormSeparator = function FormSeparator() {
return <View style={c5310_6.spacer} />;
};
c5310_6 = {
spacer: {
height: Module712.space.PX_16,
width: "100%"
},
container: {
paddingHorizontal: Module712.space.PX_16
}
};
export default function GuildEventsListView(props) {
const { events, guild, onPressEvent, onCloseAction, lastAckedId, inActionSheet } = props;
const bottom = useSafeAreaInsets_native().bottom;
if (events.length === 0) {
return <BottomSheetView>
<GuildEventsNoContent onClose={onCloseAction} guild={guild} />
</BottomSheetView>;
}
return inActionSheet ? <BottomSheetFlatList data={events} style={c5310_6.container} keyExtractor={function keyExtractor(item) {
return item.id;
}} renderItem={({ item }) => <GuildEventCard event={item} onCloseAction={onCloseAction} onPress={onPressEvent} isNew={lastAckedId != null && SnowflakeUtils.compare(item.id, lastAckedId) > 0} />} ItemSeparatorComponent={FormSeparator} initialNumToRender={5} ListEmptyComponent={() => <GuildEventsNoContent onClose={onCloseAction} guild={guild} />} contentContainerStyle={{
paddingBottom: Module712.space.PX_16 + bottom
}} /> : <FlatList data={events} style={c5310_6.container} keyExtractor={function keyExtractor(item) {
return item.id;
}} renderItem={({ item }) => <GuildEventCard event={item} onCloseAction={onCloseAction} onPress={onPressEvent} isNew={lastAckedId != null && SnowflakeUtils.compare(item.id, lastAckedId) > 0} />} ItemSeparatorComponent={FormSeparator} initialNumToRender={5} ListEmptyComponent={() => <GuildEventsNoContent onClose={onCloseAction} guild={guild} />} contentContainerStyle={{
paddingBottom: Module712.space.PX_16 + bottom
}} />;
};
export { c5310_6 as styles };
@@ -0,0 +1,57 @@
// Metro module 8325 (f8326).
import { View } from "react-native";
import PermissionStore from "../../../../stores/PermissionStore";
import { GuildSettingsSections } from "../../../../Constants";
import { Permissions, Fonts } from "../../../../_bundle/Module505";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import TextStyles from "../../../rebrand/native/TextStyles";
import Module712 from "../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../_bundle/Module589";
import StageSparkle from "../../../stage_channels/native/components/StageSparkle";
import Module8326 from "../../../../_bundle/Module8326";
import { CalendarIcon } from "../../../../design/components/Icon/native/redesign/generated/CalendarIcon";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import GuildSettingsActionCreators from "../../../guild_settings/GuildSettingsActionCreators";
const useStyles = createStyles({
container: {
display: "flex",
flexDirection: "column",
justifyContent: "center",
alignItems: "center",
marginBottom: 88,
padding: 16
},
title: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 24, {
marginBottom: 8
}),
textAlign: "center"
},
subtitle: {
paddingBottom: 2,
textAlign: "center"
}
});
export default function GuildEventsNoContent(props) {
const { guild, onClose } = props;
const styles = useStyles();
let r22 = useStateFromStores([PermissionStore], () => PermissionStore.can(Permissions.MANAGE_ROLES, guild), [guild]);
const r35 = [<StageSparkle icon={Module8326} IconComponent={CalendarIcon} />, <Text style={styles.title} accessibilityRole="header" variant="heading-xl/extrabold" color="mobile-text-heading-primary">
{intl.string(t["WgZ+3D"])}
</Text>, <Text style={styles.subtitle} variant="text-sm/normal" color="text-default">
{intl.string(t["v/S/PG"])}
</Text>, ,];
if (r22) {
r22 = <Text style={styles.subtitle} variant="text-sm/normal" color="text-default">
{intl.format(t["K+DH2o"], {
onClick: () => {
onClose();
GuildSettingsActionCreators.open(guild.id, GuildSettingsSections.ROLES);
}
})}
</Text>;
}
r35[3] = r22;
return <View style={styles.container}>{r35}</View>;
};
@@ -0,0 +1,116 @@
// Metro module 8219 (f8220).
import { useState, useMemo, useCallback } from "react";
import { View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import GuildScheduledEventStore from "../../GuildScheduledEventStore";
import { EventDetailSections, MAX_RSVP_USER_DISPLAY_COUNT } from "../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { intl, t } from "../../../../intl/index.native";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import { useStateFromStores } from "../../../../_bundle/Module589";
import useGuildScheduledEventUserCount from "../../useGuildScheduledEventUserCount";
import useInterestedEventUsers from "../../useInterestedEventUsers";
import LazyAPIPromise from "../../../../utils/LazyAPIPromise";
import GuildScheduledEventManager from "../../GuildScheduledEventManager";
import useSafeAreaInsets_native from "../../../safe_area/useSafeAreaInsets.native";
import { useSegmentedControlState } from "../../../../design/components/SegmentedControl/native/SegmentedControlState.native";
import { GuildEventCardImageHeader } from "./GuildEventCardComponents";
import { SegmentedControl } from "../../../../design/components/SegmentedControl/native/SegmentedControl.native";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetScrollView } from "../../../../_bundle/Module5245";
import EventDetailInfoSheet from "./event_detail/EventDetailInfoSheet";
import EventDetailRsvpSheet from "./event_detail/EventDetailRsvpSheet";
const useStyles = createStyles({
segmentedControl: {
paddingHorizontal: Module712.space.PX_12
},
header: {
flexDirection: "column"
}
});
export default function GuildScheduledEventDetailsActionSheet(props) {
let userCount, c16373_4, c16373_5, setState, setState2, c16373_8;
const { eventId, event, recurrenceId, onCloseActionSheet } = props;
userCount = void 0;
c16373_4 = void 0;
c16373_5 = void 0;
setState = void 0;
setState2 = void 0;
c16373_8 = void 0;
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.GUILD_EVENT_MODAL).analyticsLocations;
const [recurrenceId2, onRecurrencePress] = useState(recurrenceId);
const stateFromStores = useStateFromStores([GuildScheduledEventStore], () => {
let r6 = GuildScheduledEventStore.getGuildScheduledEvent(eventId);
if (r6 == null) {
r6 = event;
}
return r6;
}, [eventId, event]);
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(stateFromStores?.guild_id) != null);
const id = stateFromStores?.id;
userCount = useGuildScheduledEventUserCount(stateFromStores?.guild_id, id, recurrenceId2);
const interestedEventUsers = useInterestedEventUsers(id, recurrenceId2);
c16373_4 = interestedEventUsers;
const memo = useMemo(() => {
const length = c16373_4.length;
const count = length >= MAX_RSVP_USER_DISPLAY_COUNT && userCount > MAX_RSVP_USER_DISPLAY_COUNT ? Math.max(userCount - length, 0) : 0;
return count > 0 ? c16373_4.length > 0 ? [...c16373_4, {
count
}] : c16373_4 : c16373_4;
}, [interestedEventUsers, userCount]);
let r72;
[c16373_5, r72] = LazyAPIPromise(() => GuildScheduledEventManager.getGuildEventUsers(stateFromStores?.id, null, stateFromStores?.guild_id));
const { loading, error } = r72;
let defaultIndex;
[defaultIndex, setState] = useState(0);
let state;
[state, setState2] = useState(0);
const bottom = useSafeAreaInsets_native().bottom;
const callback2 = useCallback((a0) => {
setState2(a0.nativeEvent.layout.height);
}, []);
const callback = useCallback(() => {}, []);
const r95 = [EventDetailSections.EVENT_INFO];
c16373_8 = r95;
if (stateFromStores2) {
r95.push(EventDetailSections.RSVP_LIST);
}
const segmentedControlState = useSegmentedControlState({
pageWidth: 0,
defaultIndex,
onSetActiveIndex: (a0) => {
if (a0 < c16373_8.length && c16373_8[a0] === EventDetailSections.RSVP_LIST) {
c16373_5();
}
setState(a0);
},
items: r95.map((item) => {
const id = EventDetailSections.EVENT_INFO === item ? intl.string(t.iW6Xuo) : EventDetailSections.RSVP_LIST === item ? intl.formatToPlainString(t["ZrTT/N"], {
userCount
}) : intl.string(t.iW6Xuo);
return {
id,
label: id,
page: null
};
})
});
if (stateFromStores == null) {
return null;
}
return <AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet scrollable startExpanded onDismiss={onCloseActionSheet} header={<View style={styles.header} onLayout={callback}>
<GuildEventCardImageHeader event={stateFromStores} />
{r95.length > 1 ? <View style={styles.segmentedControl}>
<SegmentedControl state={segmentedControlState} />
</View> : null}
</View>}>
{(defaultIndex < r95.length ? r95[defaultIndex] : EventDetailSections.EVENT_INFO) === EventDetailSections.EVENT_INFO ? <BottomSheetScrollView>
<EventDetailInfoSheet guildEvent={stateFromStores} safeBottomPadding={bottom} onCloseActionSheet={onCloseActionSheet} onLayout={callback2} recurrenceId={recurrenceId2} onRecurrencePress={onRecurrencePress} />
</BottomSheetScrollView> : <EventDetailRsvpSheet userListItems={memo} guildId={stateFromStores.guild_id} loading={loading} error={error} contentHeight={state - bottom} safeBottomPadding={bottom} />}
</BottomSheet>
</AnalyticsLocationProvider>;
};
@@ -0,0 +1,49 @@
// Metro module 10700 (f10701).
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import { FormCTA } from "../../../../design/void/Form/native/index";
import { openCreateOrEditGuildEventModal, openStartGuildEventModal } from "../GuildScheduledEventModalActionCreators";
import Module8326 from "../../../../_bundle/Module8326";
import { intl, t } from "../../../../intl/index.native";
import { calendarFormat } from "../../../../utils/DateUtils";
import Module3771 from "../../../../_bundle/Module3771";
const useStyles = createStyles({
actionBarCTAContainer: {
marginVertical: 4
},
iconStyle: {
tintColor: Module712.colors.WHITE,
width: 20,
height: 20
},
iconContainerStyle: {
backgroundColor: Module712.colors.BACKGROUND_BRAND,
borderRadius: Module712.radii.lg,
padding: 4
},
greenIcon: {
backgroundColor: Module712.unsafe_rawColors.GREEN_360
}
});
export function ScheduleEventPrompt(props) {
const { guild, channel, isLive } = props;
const styles = useStyles();
return useManageResourcePermissions(channel).canCreateGuildEvent ? <FormCTA style={styles.actionBarCTAContainer} onPress={function onPress() {
openCreateOrEditGuildEventModal(guild, {
channel
});
}} iconSource={Module8326} iconStyle={styles.iconStyle} iconContainerStyle={styles.iconContainerStyle} completed={isLive} title={intl.string(t["60lJ0C"])} subtitle={intl.string(t["EYn7/y"])} /> : null;
}
export function StartEventPrompt(props) {
const { event, recurrenceId, channel: channel2, isLive } = props;
const styles = useStyles();
const { name, scheduled_start_time } = event;
return (0, useManageResourcePermissions(channel2).canManageGuildEvent)(event) ? <FormCTA style={styles.actionBarCTAContainer} onPress={function onPress() {
openStartGuildEventModal(event, recurrenceId);
}} iconSource={Module8326} iconStyle={styles.iconStyle} iconContainerStyle={[styles.iconContainerStyle, styles.greenIcon]} completed={isLive} title={intl.formatToPlainString(t["1vGXqM"], {
eventName: name
})} subtitle={intl.formatToPlainString(t.PTebCR, {
startTime: calendarFormat(Module3771(scheduled_start_time))
})} /> : null;
}
@@ -0,0 +1,98 @@
// Metro module 8269 (f8270).
import { Image as Image2, View } from "react-native";
import { createChannelRecord } from "../../../../records/ChannelRecord";
import { useStageChannelUpsellCardStore } from "../../StageChannelUpsellCardStore";
import { CREATE_GUILD_EVENT_MODAL_KEY } from "../GuildEventModalConstants";
import { ChannelTypes } from "../../../../Constants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { Icon } from "../../../../design/void/native";
import Module7699 from "../../../../_bundle/Module7699";
import Module8271 from "../../../../_bundle/Module8271";
import { Text } from "../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../intl/index.native";
import { Button } from "../../../../design/components/Button/native/Button.native";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
let c5265_12 = "CREATE_CHANNEL_MODAL_KEY";
const useStyles = createStyles({
container: {
flexDirection: "column",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
padding: 16,
margin: 16,
borderRadius: Module712.radii.sm
},
image: {
marginBottom: 16
},
closeContainer: {
position: "absolute",
top: 14,
right: 14
},
header: {
lineHeight: 20,
marginBottom: 4
},
description: {
textAlign: "center",
marginBottom: 4
},
button: {
marginTop: 12,
alignSelf: "stretch"
}
});
export default function StageChannelUpsell(props) {
const { guildId, onCreate } = props;
const styles = useStyles();
const [r25, onPress2] = useStageChannelUpsellCardStore();
let c16431_2 = onPress2;
return r25 ? null : <View style={styles.container}>
<PressableOpacity onPress={onPress2} accessibilityRole="button" style={styles.closeContainer}>
<Icon source={Module7699} />
</PressableOpacity>
<Image2 source={Module8271} style={styles.image} />
<Text style={styles.header} variant="text-md/bold" color="mobile-text-heading-primary">
{intl.string(t.Sx8Ezi)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.string(t.JUzPhm)}
</Text>
<Text style={styles.description} variant="text-sm/medium" color="text-default">
{intl.format(t.Vh7rP7, {
suggestionsHook: function suggestionsHook(a0, a1) {
return <Text key={a1} variant="text-sm/semibold" color="mobile-text-heading-primary">
{a0}
</Text>;
}
})}
</Text>
<View style={styles.button}>
<Button variant="secondary" size="md" text={intl.string(t["X/3SyA"])} onPress={function onPress() {
ModalActionCreators.popWithKey(CREATE_GUILD_EVENT_MODAL_KEY);
ModalActionCreators.pushLazy(import("../../../../components_native/CreateChannelModal"), {
guildId,
channelType: ChannelTypes.GUILD_STAGE_VOICE,
onChannelCreated: (a0) => {
const channelRecord = createChannelRecord({
id: a0,
type: ChannelTypes.GUILD_STAGE_VOICE
});
if (channelRecord != null) {
onCreate(channelRecord);
}
},
onClose: () => {
ModalActionCreators.popWithKey(c5265_12);
}
}, c5265_12);
c16431_2();
ActionSheetActionCreators.hideActionSheet();
}} />
</View>
</View>;
};
@@ -0,0 +1,169 @@
// Metro module 8335 (f8336).
import { useState } from "react";
import { View } from "react-native";
import ChannelStore from "../../../../stores/ChannelStore";
import GuildStore from "../../../../stores/GuildStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES, GuildScheduledEventEntityTypes } from "../../GuildScheduledEventsConstants";
import { START_EVENT_MODAL_KEY } from "../GuildEventModalConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import ModalActionCreators from "../../../../actions/ModalActionCreators";
import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables";
import { intl, t } from "../../../../intl/index.native";
import { Icon } from "../../../../design/void/native";
import Module7734 from "../../../../_bundle/Module7734";
import { Text } from "../../../../design/components/Text/native/Text";
import GuildEventCard from "./GuildEventCard";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { useManageResourcePermissions } from "../../../permissions/useManageResourcePermissions";
import useStartEvent from "../../useStartEvent";
import { SafeAreaPaddingView } from "../../../../components_native/common/SafeAreaView";
import StageChannelAgeVerificationNotice from "../../../stage_channels/native/StageChannelAgeVerificationNotice";
import { NotificationToggle } from "../../../stage_channels/native/modals/StartStageChannelModal";
import { Button } from "../../../../design/components/Button/native/Button.native";
let useStyles, StartEventHeader, PreviewEventCard;
const NavigationBar = function NavigationBar(props) {
const onClose = props.onClose;
return <View>
<PressableOpacity accessibilityRole="button" accessibilityLabel={intl.string(t.cpT0Cq)} onPress={() => onClose()}>
<Icon source={Module7734} />
</PressableOpacity>
</View>;
};
StartEventHeader = function StartEventHeader(props) {
const event2 = props.event;
const styles = useStyles();
return <View style={styles.header}>
<Text style={styles.headerPrivacyLevel} variant="heading-lg/bold" color="mobile-text-heading-primary">
{intl.string(t["q+fFJv"])}
</Text>
<Text style={styles.headerTitle} variant="text-md/medium" color="text-default">{event2.name}</Text>
</View>;
};
PreviewEventCard = function PreviewEventCard(props) {
return <GuildEventCard event={props.event} hideControls style={useStyles().previewCard} hideAgeVerificationNotice />;
};
useStyles = createStyles({
mainContainer: {
flex: 1,
padding: Module712.space.PX_16,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
container: {
flex: 1,
flexDirection: "column",
justifyContent: "space-between",
alignContent: "center"
},
headerContainer: {
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_24
},
footerContainer: {
display: "flex",
flexDirection: "column"
},
header: {
alignItems: "center",
paddingTop: Module712.space.PX_24
},
headerTitle: {
lineHeight: 24,
textAlign: "center"
},
buttonContainer: {
display: "flex",
flexDirection: "column",
gap: Module712.space.PX_8,
marginTop: Module712.space.PX_16
},
previewCard: {
borderColor: Module712.colors.BORDER_SUBTLE,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
shadowColor: "#000",
shadowOpacity: 0.2,
shadowRadius: 16,
shadowOffset: {
height: 8,
width: 0
}
},
headerPrivacyLevel: {
textAlign: "center",
lineHeight: 18
}
});
export default function StartEventModal(props) {
let guild_id, canManageGuildEvent, state, setState, c16511_6, _handleStart2;
const { event, onCloseActionSheet } = props;
guild_id = void 0;
canManageGuildEvent = void 0;
state = void 0;
setState = void 0;
c16511_6 = void 0;
const onCloseModal2 = function onCloseModal(r3 = false) {
ModalActionCreators.popWithKey(START_EVENT_MODAL_KEY);
if (onCloseActionSheet != null) {
onCloseActionSheet(r3);
}
};
_handleStart2 = function _handleStart() {
const r9 = async () => {
L12: {
if (canManageGuildEvent) {
await c16511_6(event, state, {
onSuccess: () => {
ModalActionCreators.popWithKey(START_EVENT_MODAL_KEY);
if (onCloseActionSheet != null) {
onCloseActionSheet(true);
}
}
});
break L12;
}
onCloseModal2(false);
return void 0;
}
};
_handleStart2 = r9;
return r9.apply(this, arguments);
};
const styles = useStyles();
guild_id = event.guild_id;
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(guild_id));
let r38 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(event.channel_id), [event]);
if (r38 == null) {
r38 = stateFromStores;
}
canManageGuildEvent = (0, useManageResourcePermissions(r38).canManageGuildEvent)(event);
const r2 = event.entity_type === GuildScheduledEventEntityTypes.STAGE_INSTANCE;
[state, setState] = useState(r2);
let r59;
[c16511_6, r59] = useStartEvent();
const { loading, error } = r59;
return <SafeAreaPaddingView top bottom style={styles.mainContainer}>
<NavigationBar onClose={onCloseModal2} />
<View style={styles.container}>
<View style={styles.headerContainer}>
<StartEventHeader event={event} />
<PreviewEventCard event={event} />
</View>
<View style={styles.footerContainer}>
{AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(event.entity_type) && <StageChannelAgeVerificationNotice channelId={event.channel_id} />}
{r2 ? <NotificationToggle sendStartNotification={state} onToggle={function handleToggleNotifyMembers() {
setState((prevState) => !prevState);
}} /> : null}
<View style={styles.buttonContainer}>
{error != null ? <Text variant="text-sm/medium" color="text-feedback-critical">
{error.getAnyErrorMessage()}
</Text> : null}
<Button variant="active" text={intl.string(t.cK1GGY)} onPress={function handleStart() {
return _handleStart2.apply(this, arguments);
}} disabled={loading} loading={loading} />
</View>
</View>
</View>
</SafeAreaPaddingView>;
};
export { PreviewEventCard };
@@ -0,0 +1,83 @@
// Metro module 12271 (f12272).
import { useRef, useEffect } from "react";
import { Button } from "../../../../design/components/Button/native/Button.native";
function $mk89559($env) {
return () => $mk108777($env);
}
function $mk108777($env) {
return () => clearTimeout($env[1].current);
}
function $mk108778($env) {
return (a0) => {
const r3 = $env[0];
if (r3 != null && $env.$parent[1].current === null) {
r3(a0);
const r12 = $env.$parent;
const r13 = r12[1];
const r5 = setTimeout;
const r14 = r12[0];
r13.current = r5($mk116389(r12), r14);
}
};
}
function $mk116389($env) {
return () => {
$env[1].current = null;
};
}
export default function ThrottledButton(props) {
const { onPress, onPressIn, onPressOut } = props;
let throttleMs = props.throttleMs;
if (throttleMs === void 0) {
throttleMs = 500;
}
const { onPress: _onPress, onPressIn: _onPressIn, onPressOut: _onPressOut, throttleMs: _throttleMs, ...rest } = props;
let env19759;
const r16 = env19759 = {};
env19759[0] = void 0;
if (throttleMs === void 0) {
throttleMs = 500;
}
let env19760;
let env19761;
let env19762;
env19759[0] = throttleMs;
env19759[1] = void 0;
env19759[1] = useRef(null);
useEffect($mk89559(r16), []);
const r31 = env19760 = {
$parent: r16
};
env19760[0] = onPress;
const props2 = {
...rest,
onPress: $mk108778(r31)
};
const r33 = env19761 = {
$parent: r16
};
env19761[0] = onPressIn;
props2.onPressIn = $mk108778(r33);
const r35 = env19762 = {
$parent: r16
};
env19762[0] = onPressOut;
props2.onPressOut = $mk108778(r35);
return <Button {...props2} />;
};
export function useThrottledActionHandler(r4 = 500) {
let env19758;
const r2 = env19758 = {};
env19758[0] = r4;
env19758[1] = void 0;
env19758[1] = useRef(null);
useEffect($mk89559(r2), []);
return function(a0) {
let env27279;
const r0 = env27279 = {
$parent: env19758
};
env27279[0] = a0;
return $mk108778(r0);
};
}
@@ -0,0 +1,47 @@
// Metro module 11474 (f11475).
import { View } from "react-native";
import GuildStore from "../../../../stores/GuildStore";
import UserGuildSettingsStore from "../../../../stores/UserGuildSettingsStore";
import { ReadStateTypes } from "../../../read_states/ReadStateConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import { useStateFromStores } from "../../../../_bundle/Module589";
import { ActionSheet } from "../../../../design/components/Sheet/native/ActionSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import GuildIcon, { GuildIconSizes } from "../../../guild/native/GuildIcon";
import { intl, t } from "../../../../intl/index.native";
import { FormRow, FormLabel } from "../../../../design/void/Form/native/index";
import { Icon } from "../../../../design/void/native";
import Module11475 from "../../../../_bundle/Module11475";
import { ackGuildFeature } from "../../../../actions/ReadStateActionCreators";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import Module11476 from "../../../../_bundle/Module11476";
import Module11477 from "../../../../_bundle/Module11477";
import NotificationSettingsModalActionCreators from "../../../../actions/NotificationSettingsModalActionCreators";
import { NotificationLabel } from "../../../../utils/NotificationSettingsUtils";
const useStyles = createStyles({
headerIcon: {
marginRight: 16
}
});
export default function UpcomingEventsLongPressActionSheet(props) {
let stateFromStores;
const guildId = props.guildId;
stateFromStores = void 0;
const styles = useStyles();
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildId));
stateFromStores = useStateFromStores([UserGuildSettingsStore], () => UserGuildSettingsStore.isMuteScheduledEventsEnabled(guildId));
return <ActionSheet>
<BottomSheetTitleHeader leading={<View style={styles.headerIcon}>
<GuildIcon guild={stateFromStores2} size={GuildIconSizes.LARGE} />
</View>} title={intl.string(t.tlopTM)} />
<FormRow leading={<Icon source={Module11475} />} label={<FormLabel text={intl.string(t.e6RscS)} />} onPress={() => {
ackGuildFeature(guildId, ReadStateTypes.GUILD_EVENT);
ActionSheetActionCreators.hideActionSheet();
}} />
<FormRow leading={<Icon source={stateFromStores ? Module11476 : Module11477} />} label={<FormLabel text={stateFromStores ? intl.string(t.COiLo0) : intl.string(t.ONG3Yz)} />} onPress={() => {
NotificationSettingsModalActionCreators.updateGuildNotificationSettings(guildId, {
mute_scheduled_events: !stateFromStores
}, NotificationLabel.mutedEvents(!stateFromStores));
}} />
</ActionSheet>;
};
@@ -0,0 +1,46 @@
// Metro module 8347 (f8348).
import { useState } from "react";
import { View } from "react-native";
import { GuildScheduledEventUserResponses } from "../../../GuildScheduledEventsConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { ResponseOptions, getExistingRsvp, getResponseOptions } from "../../../utils/GuildEventRsvpUtils";
import { intl, t } from "../../../../../intl/index.native";
import { BottomSheet } from "../../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { SafeAreaPaddingView } from "../../../../../components_native/common/SafeAreaView";
import { TableRadioGroup } from "../../../../../design/components/TableRow/native/TableRadioGroup.native";
import { TableRadioRow } from "../../../../../design/components/TableRow/native/TableRadioRow.native";
import { Button } from "../../../../../design/components/Button/native/Button.native";
import { updateRsvp } from "../../GuildScheduledEventModalActionCreators";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
const useStyles = createStyles({
container: {
paddingHorizontal: Module712.space.PX_16
},
buttonWrapper: {
marginTop: Module712.space.PX_24
}
});
export default function GuildEventRsvpPickerActionSheet(props) {
const { event, recurrenceId, guildId, onRsvp } = props;
const styles = useStyles();
const [state, onChange] = useState(ResponseOptions.SERIES);
const UNINTERESTED = getExistingRsvp(event.id, null)?.response === GuildScheduledEventUserResponses.INTERESTED ? GuildScheduledEventUserResponses.UNINTERESTED : GuildScheduledEventUserResponses.INTERESTED;
return <BottomSheet header={<BottomSheetTitleHeader title={UNINTERESTED === GuildScheduledEventUserResponses.INTERESTED ? intl.string(t.WtORed) : intl.string(t["8MPCVr"])} />}>
<SafeAreaPaddingView bottom style={styles.container}>
<TableRadioGroup defaultValue={state} onChange={onChange} hasIcons={false}>
{getResponseOptions().map((item) => <TableRadioRow key={item.value} value={item.value} label={item.name} />)}
</TableRadioGroup>
<View style={styles.buttonWrapper}>
<Button onPress={function onPress() {
updateRsvp(event.id, state !== ResponseOptions.SERIES ? recurrenceId : null, guildId, UNINTERESTED);
if (onRsvp != null) {
onRsvp();
}
ActionSheetActionCreators.hideActionSheet();
}} text={intl.string(t.TyCVIq)} />
</View>
</SafeAreaPaddingView>
</BottomSheet>;
};
@@ -0,0 +1,139 @@
// Metro module 12275 (f12276).
import { useEffect } from "react";
import { View } from "react-native";
import AccessibilityStore from "../../../../a11y/AccessibilityStore";
import GuildMemberStore from "../../../../../stores/GuildMemberStore";
import GuildStore from "../../../../../stores/GuildStore";
import RTCConnectionStore from "../../../../../stores/RTCConnectionStore";
import UserStore from "../../../../../stores/UserStore";
import { AGE_VERIFICATION_STAGE_CHANNEL_TYPES } from "../../../GuildScheduledEventsConstants";
import { GUILD_EVENT_INFO_ACTION_SHEET_KEY } from "../../GuildEventModalConstants";
import { Fonts } from "../../../../../_bundle/Module505";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import TextStyles from "../../../../rebrand/native/TextStyles";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { useStateFromStores, useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { recurrenceRuleFromServer } from "../../../utils/EditGuildEventUtils";
import GuildScheduledEventManager from "../../../GuildScheduledEventManager";
import useGuildScheduledEventUserCount from "../../../useGuildScheduledEventUserCount";
import { GuildEventCardHeader, GuildEventCardTitle, GuildEventCardSimpleGuildInfo, GuildEventSimpleLocation, GuildEventCardDescription, GuildEventCardPrimaryAction, GuildEventShareAction, GuildEventModeratorAction } from "../GuildEventCardComponents";
import { BellIcon } from "../../../../../design/components/Icon/native/redesign/generated/BellIcon";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
import { Avatar, AvatarSizes, RoleDot, LegacyText } from "../../../../../design/void/native";
import UserUtils from "../../../../../utils/UserUtils";
import StageChannelAgeVerificationNotice, { DividerPosition } from "../../../../stage_channels/native/StageChannelAgeVerificationNotice";
import { ButtonGroup } from "../../../../../design/components/ButtonGroup/native/ButtonGroup.native";
import GuildEventRecurrences from "../GuildEventRecurrences";
const useStyles = createStyles({
eventContainer: {
paddingHorizontal: Module712.space.PX_16
},
eventHeader: {
paddingTop: 19
},
eventTitle: {
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 20)
},
controlsContainer: {
paddingTop: Module712.space.PX_16
},
eventTitleContainer: {
paddingTop: Module712.space.PX_16,
paddingBottom: Module712.space.PX_8
},
eventDescriptionContainer: {
paddingTop: Module712.space.PX_16,
paddingBottom: Module712.space.PX_4
},
guildTextStyle: {
...TextStyles(Fonts.PRIMARY_MEDIUM, Module712.colors.TEXT_SUBTLE, 14)
},
interestedContainer: {
paddingTop: Module712.space.PX_8,
flexDirection: "row"
},
interestedIcon: {
marginRight: Module712.space.PX_8
},
ageVerificationContainer: {
marginTop: 16
}
});
export default function EventDetailInfoSheet(props) {
let creator, creatorMember;
const { guildEvent, safeBottomPadding, onLayout, onCloseActionSheet, recurrenceId, onRecurrencePress: onRecurrencePress2 } = props;
creator = void 0;
creatorMember = void 0;
const styles = useStyles();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.roleStyle);
const stateFromStores3 = useStateFromStores([RTCConnectionStore], () => RTCConnectionStore.isConnected() && RTCConnectionStore.getChannelId() === guildEvent.channel_id, [guildEvent.channel_id]);
const recurrenceRule = recurrenceRuleFromServer(guildEvent.recurrence_rule);
useEffect(() => {
GuildScheduledEventManager.getGuildEventUserCounts(guildEvent.guild_id, guildEvent.id, []);
GuildScheduledEventManager.getGuildEventsForCurrentUser(guildEvent.guild_id);
}, [guildEvent.guild_id, guildEvent.id]);
const guildScheduledEventUserCount = useGuildScheduledEventUserCount(guildEvent.guild_id, guildEvent.id, recurrenceId);
const stateFromStores2 = useStateFromStores([GuildStore], () => GuildStore.getGuild(guildEvent.guild_id) != null);
const stateFromStoresObject = useStateFromStoresObject([UserStore, GuildMemberStore], () => guildEvent.creator_id != null ? {
creator: UserStore.getUser(guildEvent.creator_id),
creatorMember: GuildMemberStore.getMember(guildEvent.guild_id, guildEvent.creator_id)
} : {
creator: null,
creatorMember: null
}, [guildEvent]);
creator = stateFromStoresObject.creator;
creatorMember = stateFromStoresObject.creatorMember;
return <View style={[styles.eventContainer, {
paddingBottom: safeBottomPadding + 16
}]} onLayout={onLayout}>
<GuildEventCardHeader event={guildEvent} style={styles.eventHeader} showUserCount={false} showEndDate showCreator={false} recurrenceId={recurrenceId} />
<GuildEventCardTitle event={guildEvent} textStyle={styles.eventTitle} style={styles.eventTitleContainer} />
<GuildEventCardSimpleGuildInfo event={guildEvent} textStyle={styles.guildTextStyle} />
<GuildEventSimpleLocation event={guildEvent} />
<View style={styles.interestedContainer}>
<BellIcon size="sm" style={styles.interestedIcon} />
<Text variant="text-sm/medium" color="text-default">
{intl.format(t["+DLsD8"], {
count: guildScheduledEventUserCount
})}
</Text>
</View>
{creator != null && stateFromStores2 && <View style={styles.interestedContainer}>
<Avatar user={creator} guildId={guildEvent.guild_id} size={AvatarSizes.XSMALL_20} style={styles.interestedIcon} />
<Text variant="text-sm/medium" color="text-default">
{intl.format(t["66DLFs"], {
usernameHook: function usernameHook() {
const r24 = [stateFromStores === "dot" && creatorMember?.colorString != null && <RoleDot size="small" color={creatorMember.colorString} colors={creatorMember.colorStrings} />, ,];
const style = creatorMember != null ? stateFromStores === "username" ? creatorMember.colorString != null ? {
color: creatorMember.colorString
} : void 0 : void 0 : void 0;
let r41 = creatorMember?.nick;
if (r41 == null) {
r41 = UserUtils.getName(creator);
}
r24[1] = <LegacyText style={style}>{r41}</LegacyText>;
return <>{r24}</>;
}
})}
</Text>
</View>}
<GuildEventCardDescription event={guildEvent} style={styles.eventDescriptionContainer} />
{AGE_VERIFICATION_STAGE_CHANNEL_TYPES.has(guildEvent.entity_type) && <StageChannelAgeVerificationNotice noBackground divider={[DividerPosition.TOP, DividerPosition.BOTTOM]} onConfirmPress={() => ActionSheetActionCreators.hideAllActionSheets()} channelId={guildEvent.channel_id} style={styles.ageVerificationContainer} />}
<ButtonGroup direction="horizontal" style={styles.controlsContainer}>
<GuildEventCardPrimaryAction event={guildEvent} onCloseAction={function onCloseAction() {
ActionSheetActionCreators.hideActionSheet(GUILD_EVENT_INFO_ACTION_SHEET_KEY);
if (onCloseActionSheet != null) {
onCloseActionSheet();
}
}} isConnected={stateFromStores3} recurrenceId={recurrenceId} />
{stateFromStores2 ? <GuildEventShareAction event={guildEvent} /> : null}
<GuildEventModeratorAction event={guildEvent} recurrenceId={recurrenceId} />
</ButtonGroup>
{recurrenceRule != null && <GuildEventRecurrences guildId={guildEvent.guild_id} recurrenceRule={recurrenceRule} guildEventId={guildEvent.id} onRecurrencePress={(event) => onRecurrencePress2(event)} activeRecurrenceId={recurrenceId} />}
</View>;
};
export function closeGuildEventInfoActionSheet() {
ActionSheetActionCreators.hideActionSheet(GUILD_EVENT_INFO_ACTION_SHEET_KEY);
}
@@ -0,0 +1,154 @@
// Metro module 12276 (f12277).
import { useCallback, memo } from "react";
import { View } from "react-native";
import PresenceStore from "../../../../../stores/PresenceStore";
import UserStore from "../../../../../stores/UserStore";
import { Fonts } from "../../../../../_bundle/Module505";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import TextStyles from "../../../../rebrand/native/TextStyles";
import StageSparkle from "../../../../stage_channels/native/components/StageSparkle";
import Module12277 from "../../../../../_bundle/Module12277";
import { Text } from "../../../../../design/components/Text/native/Text";
import { intl, t } from "../../../../../intl/index.native";
import { FormRow, FormDivider } from "../../../../../design/void/Form/native/index";
import FastImage from "../../../../../components_native/common/FastImage";
import useAnalyticsLocations from "../../../../app_analytics/useAnalyticsLocations";
import { useStateFromStores, useStateFromStoresObject } from "../../../../../_bundle/Module589";
import { Avatar, AvatarSizes } from "../../../../../design/void/native";
import DiscordTag from "../../../../user_profile/native/DiscordTag";
import UserUtils from "../../../../../utils/UserUtils";
import showUserProfileActionSheet from "../../../../user_profile/native/showUserProfileActionSheet";
import { isRemainingUsersGroup } from "./EventDetailTypes";
import { BottomSheetScrollView, BottomSheetFlatList } from "../../../../../_bundle/Module5245";
import { ActivityIndicator } from "../../../../../design/components/ActivityIndicator/native/ActivityIndicator.native";
let useStyles, FetchErrorDisplay, NoUsersDisplay, RemainingUsersRow, Component, keyExtractor;
const EmptyDisplay = function EmptyDisplay(props) {
const { children, style } = props;
return <View style={[useStyles().emptyDisplayContainer, style]}>
<StageSparkle icon={Module12277} />
{children}
</View>;
};
FetchErrorDisplay = function FetchErrorDisplay(props) {
return <EmptyDisplay style={props.style}>
<Text style={useStyles().emptyDisplayTitle} variant="heading-lg/extrabold" color="mobile-text-heading-primary">
{intl.string(t.obChXk)}
</Text>
</EmptyDisplay>;
};
NoUsersDisplay = function NoUsersDisplay(props) {
return <EmptyDisplay style={props.style}>
<Text style={useStyles().emptyDisplayTitle} variant="heading-lg/extrabold" color="mobile-text-heading-primary">
{intl.string(t.hW0mBR)}
</Text>
</EmptyDisplay>;
};
RemainingUsersRow = function RemainingUsersRow(props) {
const remainingUsersGroup = props.remainingUsersGroup;
const styles = useStyles();
return <FormRow key="userRemaining" DEPRECATED_style={styles.userListRow} leading={<View style={styles.remainingUsersIconContainer}>
<FastImage source={Module12277} style={styles.remainingUsersIcon} />
</View>} label={intl.formatToPlainString(t.BdQTfR, {
userRemainCount: remainingUsersGroup.count
})} />;
};
keyExtractor = function keyExtractor(a0) {
return isRemainingUsersGroup(a0) ? `RemainingUsersGroup-${a0.count}` : a0.user_id;
};
const EventDetailRsvpSheet = function EventDetailRsvpSheet(props) {
const { userListItems, guildId, loading, error, contentHeight, safeBottomPadding } = props;
const StaticMessageContainer = function StaticMessageContainer(props) {
const children = props.children;
const styles = useStyles();
return <BottomSheetScrollView style={styles.staticMessageContentContainer} scrollEnabled={false}>
<View style={[styles.staticMessageContentContainer, {
minHeight: contentHeight
}]}>{children}</View>
</BottomSheetScrollView>;
};
const styles = useStyles();
const r10 = {
paddingBottom: safeBottomPadding
};
const callback = useCallback(({ item }) => isRemainingUsersGroup(item) ? <RemainingUsersRow remainingUsersGroup={item} /> : <Component eventUser={item} guildId={guildId} />, [guildId]);
return loading && userListItems.length === 0 ? <StaticMessageContainer>
<ActivityIndicator style={[styles.staticMessageContent, r10]} />
</StaticMessageContainer> : error != null ? <StaticMessageContainer>
<FetchErrorDisplay style={[styles.staticMessageContent, r10]} />
</StaticMessageContainer> : userListItems.length === 0 ? <StaticMessageContainer>
<NoUsersDisplay style={[styles.staticMessageContent, r10]} />
</StaticMessageContainer> : <BottomSheetFlatList contentContainerStyle={[styles.userList, {
paddingBottom: safeBottomPadding
}]} data={userListItems} renderItem={callback} ItemSeparatorComponent={FormDivider} keyExtractor={keyExtractor} />;
};
useStyles = createStyles({
staticMessageContentContainer: {
flex: 1,
padding: 16
},
userList: {
paddingTop: 16
},
userListRow: {
paddingVertical: 8
},
userName: {
color: Module712.colors.TEXT_DEFAULT,
fontFamily: Fonts.PRIMARY_SEMIBOLD,
fontSize: 16
},
emptyDisplayContainer: {
alignItems: "center",
justifyContent: "center",
minHeight: 200
},
staticMessageContent: {
height: "100%"
},
emptyDisplayTitle: {
paddingTop: 24,
...TextStyles(Fonts.DISPLAY_EXTRABOLD, Module712.colors.MOBILE_TEXT_HEADING_PRIMARY, 20, {
marginBottom: 8
}),
textAlign: "center"
},
remainingUsersIcon: {
tintColor: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
height: 18,
width: 18
},
remainingUsersIconContainer: {
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
borderRadius: 16,
height: 32,
width: 32,
alignItems: "center",
justifyContent: "center"
}
});
Component = memo(function({ eventUser, guildId: guildId2 }) {
const styles = useStyles();
const analyticsLocations = useAnalyticsLocations().analyticsLocations;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(eventUser.user_id));
const stateFromStoresObject = useStateFromStoresObject([PresenceStore], () => ({
isMobileOnline: PresenceStore.isMobileOnline(eventUser.user_id),
isVROnline: PresenceStore.isVROnline(eventUser.user_id),
status: PresenceStore.getStatus(eventUser.user_id)
}), [eventUser.user_id]);
const { isMobileOnline, isVROnline, status } = stateFromStoresObject;
const leading = stateFromStores != null ? <Avatar user={stateFromStores} guildId={guildId2} isMobileOnline={isMobileOnline} isVROnline={isVROnline} status={status} size={AvatarSizes.REFRESH_MEDIUM_32} autoStatusCutout /> : null;
let nick = eventUser.member?.nick;
if (nick == null) {
nick = UserUtils.getName(eventUser.user);
}
return <FormRow key={eventUser.user_id} DEPRECATED_style={styles.userListRow} leading={leading} label={<DiscordTag user={stateFromStores} nick={nick} usernameStyle={styles.userName} nicknameStyle={styles.userName} />} onPress={() => {
showUserProfileActionSheet({
userId: eventUser.user_id,
sourceAnalyticsLocations: analyticsLocations
});
}} />;
});
EventDetailRsvpSheet.displayName = "EventDetailRsvpSheet";
export default EventDetailRsvpSheet;
export { Component as UserRow };
@@ -0,0 +1,4 @@
// Metro module 12278 (f12279).
export function isRemainingUsersGroup(a0) {
return a0.count !== void 0;
}