// Metro module 11806 (f11807). import { memo } from "react"; import { View } from "react-native"; import ChannelStore from "../../../../stores/ChannelStore"; import CreateInviteModalStore from "../../../../stores/CreateInviteModalStore"; import GuildStore from "../../../../stores/GuildStore"; import InviteSuggestionsStore from "../../../../stores/InviteSuggestionsStore"; import UserStore from "../../../../stores/UserStore"; import { setSendState, useInstantInviteSendStates } from "../../InstantInviteSendStateStore"; import { InviteSendStates } from "../../Constants"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import { useStateFromStores } from "../../../../_bundle/Module589"; import useChannelName from "../../../channel/useChannelName"; import { RowTypes } from "../../../../utils/InstantInviteUtils"; import InviteQueue, { InvitePropertiesType } from "../../../../lib/InviteQueue"; import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables"; import { Avatar, AvatarSizes } from "../../../../design/void/native"; import DiscordTag from "../../../user_profile/native/DiscordTag"; import UserUtils from "../../../../utils/UserUtils"; import { intl, t } from "../../../../intl/index.native"; import AvatarUtils from "../../../../utils/AvatarUtils"; import { getAcronym } from "../../../../utils/StringUtils"; import { Text } from "../../../../design/components/Text/native/Text"; import { TableRow } from "../../../../design/components/TableRow/native/TableRow.native"; import InviteButton from "./InviteButton"; const useStyles = createStyles({ acronym: { width: 32, height: 32, borderRadius: Module712.radii.lg, backgroundColor: Module712.colors.BACKGROUND_BASE_LOW, alignItems: "center", justifyContent: "center", overflow: "hidden", marginTop: 0, marginRight: 10, borderColor: Module712.colors.BORDER_MUTED, borderStyle: "solid", borderWidth: 2 } }); const r58 = memo(function InstantInviteRow(props) { let accessibilityActions, icon, label, onAccessibilityAction; const { row, code, onPressAvatar, onInviteSent, start, end, source } = props; const styles = useStyles(); const id = row.item.id; const stateFromStores2 = useStateFromStores([CreateInviteModalStore], () => CreateInviteModalStore.isSubmitting()); const stateFromStores3 = useStateFromStores([CreateInviteModalStore], () => CreateInviteModalStore.getError()); const instantInviteSendStates = useInstantInviteSendStates((a0) => { const r1 = code != null; let r2 = null; if (r1) { const r6 = a0[code]; r2 = r6 == null ? void 0 : r6[id]; } return r2; }); const stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(id)); let r54 = useChannelName(stateFromStores); if (code == null) { return null; } L32: { const type = row.type; if (RowTypes.DM !== type && RowTypes.FRIEND !== type) { if (RowTypes.GROUP_DM === type) { const r117 = stateFromStores != null ? : null; if (r54 == null) { r54 = ""; } label = r54; onAccessibilityAction = void 0; accessibilityActions = void 0; icon = r117; break L32; } if (RowTypes.CHANNEL === type) { const r25 = stateFromStores?.guild_id != null ? GuildStore.getGuild(stateFromStores.guild_id) : void 0; if (r25 == null) { return null; } icon = r25.icon != null ? : {getAcronym(r25.name)} ; label = r54 == null ? "" : `#${r54}`; onAccessibilityAction = void 0; accessibilityActions = void 0; break L32; } return null; } const user = UserStore.getUser(id); let source2 = user == null ? void 0 : user.getAvatarSource(void 0); if (source2 == null) { source2 = null; } const r158 = { event.stopPropagation(); if (onPressAvatar != null) { onPressAvatar(id); } }} style={{ padding: 8, margin: -8 }}> ; const r166 = ; const r168 = onPressAvatar != null ? [{ name: "viewProfile", label: intl.formatToPlainString(t.uCenkh, { username: user?.tag }) }] : void 0; onAccessibilityAction = (a0) => { if (a0.nativeEvent.actionName === "viewProfile" && onPressAvatar !== null && onPressAvatar != null) { onPressAvatar(id); } }; accessibilityActions = r168; label = r166; icon = r158; } const handlePress = function handlePress() { L11: { if (code != null) { const handleSendState = function handleSendState(a0) { if (code != null) { setSendState(code, id, a0 ? InviteSendStates.SENT : InviteSendStates.ERROR); if (a0 && onInviteSent != null) { onInviteSent(); } } }; setSendState(code, id, InviteSendStates.SENDING); const type = row.type; if (RowTypes.FRIEND !== type && RowTypes.DM !== type) { if (RowTypes.GROUP_DM === type) { if (code == null) { break L11; } InviteQueue.enqueue({ inviteKey: code, type: InvitePropertiesType.GROUP_DM, channel: ChannelStore.getChannel(id), location: "Invite Action Sheet", inviteAnalyticsMetadata: { suggestionData: InviteSuggestionsStore.getSelectedInviteMetadata(row), source } }, handleSendState); break L11; } if (RowTypes.CHANNEL !== type) { break L11; } if (code == null) { break L11; } InviteQueue.enqueue({ inviteKey: code, type: InvitePropertiesType.CHANNEL, channel: ChannelStore.getChannel(id), location: "Invite Action Sheet", inviteAnalyticsMetadata: { suggestionData: InviteSuggestionsStore.getSelectedInviteMetadata(row), source } }, handleSendState); break L11; } if (code != null) { InviteQueue.enqueue({ inviteKey: code, type: InvitePropertiesType.USER, user: UserStore.getUser(id), location: "Invite Action Sheet", inviteAnalyticsMetadata: { suggestionData: InviteSuggestionsStore.getSelectedInviteMetadata(row), source } }, handleSendState); } } } }; return } onPress={handlePress} disabled={stateFromStores3 != null || stateFromStores2 || instantInviteSendStates === InviteSendStates.SENT} accessibilityActions={accessibilityActions} onAccessibilityAction={onAccessibilityAction} />; }); export default r58;