103 lines
5.1 KiB
TypeScript
103 lines
5.1 KiB
TypeScript
// Metro module 9929 (f9930).
|
|
import { View } from "react-native";
|
|
import ChannelStore from "../../../stores/ChannelStore";
|
|
import GuildStore from "../../../stores/GuildStore";
|
|
import PresenceStore from "../../../stores/PresenceStore";
|
|
import RelationshipStore from "../../../stores/RelationshipStore";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { StatusTypes } from "../../../_bundle/Module505";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import useChannelName from "../../channel/useChannelName";
|
|
import GroupDMAvatar from "../../group_dm/native/GroupDMAvatar";
|
|
import { AvatarSizes, Avatar } from "../../../design/void/native";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { useStateFromStores, useStateFromStoresObject } from "../../../_bundle/Module589";
|
|
import UserUtils from "../../../utils/UserUtils";
|
|
import { GuildIconWithChannelType, GuildIconWithChannelTypeSizes } from "../../guild/native/GuildIconWithChannelType";
|
|
import { AlertModal, AlertActionButton } from "../../../design/components/AlertModal/native/AlertModal.native";
|
|
import { AlertActions } from "../../../design/components/AlertModal/native/AlertModal.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
let useStyles, FailedUserRow, FailedChannelRow, FailedDestinationRow;
|
|
const FailedGroupDMRow = function FailedGroupDMRow(props) {
|
|
const channel2 = props.channel;
|
|
const styles = useStyles();
|
|
return <View style={styles.row}>
|
|
<GroupDMAvatar size={AvatarSizes.REFRESH_MEDIUM_32} channel={channel2} />
|
|
<Text style={styles.label} variant="text-md/medium" lineClamp={1} ellipsizeMode="tail">
|
|
{useChannelName(channel2)}
|
|
</Text>
|
|
</View>;
|
|
};
|
|
FailedUserRow = function FailedUserRow(props) {
|
|
const user = props.user;
|
|
const styles = useStyles();
|
|
let r11 = useStateFromStores([RelationshipStore], () => RelationshipStore.getNickname(user.id));
|
|
const stateFromStoresObject = useStateFromStoresObject([PresenceStore], () => ({
|
|
isMobileOnline: PresenceStore.isMobileOnline(user.id),
|
|
status: PresenceStore.getStatus(user.id),
|
|
isVROnline: PresenceStore.isVROnline(user.id)
|
|
}));
|
|
const { isMobileOnline, isVROnline, status } = stateFromStoresObject;
|
|
const r2 = user != null;
|
|
let r32 = null;
|
|
if (r2) {
|
|
const r47 = [<Avatar user={user} guildId={void 0} status={StatusTypes.OFFLINE !== status ? status : null} isMobileOnline={isMobileOnline} isVROnline={isVROnline} size={AvatarSizes.XSMALL} avatarDecoration={user.avatarDecoration} autoStatusCutout />, ,];
|
|
if (r11 == null) {
|
|
r11 = UserUtils.getName(user);
|
|
}
|
|
r47[1] = <Text style={styles.label} variant="text-md/medium" lineClamp={1} ellipsizeMode="tail">{r11}</Text>;
|
|
r32 = <View style={styles.row}>{r47}</View>;
|
|
}
|
|
return r32;
|
|
};
|
|
FailedChannelRow = function FailedChannelRow(props) {
|
|
const channel = props.channel;
|
|
const styles = useStyles();
|
|
return <View style={styles.row}>
|
|
<GuildIconWithChannelType aria-label="" guild={useStateFromStores([GuildStore], () => GuildStore.getGuild(channel?.guild_id))} channel={channel} size={GuildIconWithChannelTypeSizes.SMALL_32} />
|
|
<Text style={styles.label} variant="text-md/medium" lineClamp={1} ellipsizeMode="tail">
|
|
{useChannelName(channel)}
|
|
</Text>
|
|
</View>;
|
|
};
|
|
FailedDestinationRow = function FailedDestinationRow(props) {
|
|
const destination = props.destination;
|
|
const stateFromStoresObject = useStateFromStoresObject([ChannelStore, UserStore], () => ({
|
|
channel: destination.type === "channel" ? ChannelStore.getChannel(destination.id) : null,
|
|
user: destination.type === "user" ? UserStore.getUser(destination.id) : null
|
|
}));
|
|
const { channel: channel2, user: user2 } = stateFromStoresObject;
|
|
return (channel2 == null ? void 0 : channel2.isGroupDM()) ? <FailedGroupDMRow channel={channel2} /> : user2 != null ? <FailedUserRow user={user2} /> : channel2 != null ? <FailedChannelRow channel={channel2} /> : null;
|
|
};
|
|
useStyles = createStyles({
|
|
container: {
|
|
borderWidth: 1,
|
|
borderColor: Module712.colors.BORDER_STRONG,
|
|
borderRadius: Module712.radii.lg,
|
|
paddingVertical: Module712.space.PX_8
|
|
},
|
|
row: {
|
|
display: "flex",
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
gap: Module712.space.PX_12,
|
|
height: 40,
|
|
marginHorizontal: Module712.space.PX_16
|
|
},
|
|
label: {
|
|
flexShrink: 1
|
|
}
|
|
});
|
|
export default function DestinationFailedAlertModal(props) {
|
|
const { title, content, failedDestinations, onRetry } = props;
|
|
return <AlertModal title={title} content={content} extraContent={<View style={useStyles().container}>
|
|
{failedDestinations.map((failedDestination, index) => <FailedDestinationRow key={index} destination={failedDestination} />)}
|
|
</View>} actions={<AlertActions>
|
|
{onRetry != null ? <>
|
|
<AlertActionButton key="confirm" variant="primary" onPress={onRetry} text={intl.string(t["5911Lb"])} />
|
|
<AlertActionButton key="cancel" variant="secondary" text={intl.string(t.WAI6xu)} />
|
|
</> : <AlertActionButton key="confirm" variant="primary" text={intl.string(t.BddRzS)} />}
|
|
</AlertActions>} />;
|
|
};
|