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

206 lines
9.0 KiB
TypeScript

// Metro module 10450 (f10451).
import { memo, useState, useEffect } from "react";
import { View } from "react-native";
import ChannelStore from "../../../stores/ChannelStore";
import UserStore from "../../../stores/UserStore";
import { UserRemediationAction } from "../RelationshipConstants";
import { BLOCK_CONFIRMATION_ACTION_SHEET_KEY, RESTRICTION_CONFIRMATION_ACTION_SHEET_HEIGHT } from "./RestrictionConfirmationConstants";
import { AnalyticEvents, HelpdeskArticles } from "../../../Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import Module8361 from "../../../_bundle/Module8361";
import { intl, t } from "../../../intl/index.native";
import Module4147 from "../../../_bundle/Module4147";
import { TableRowGroup } from "../../../design/components/TableRow/native/TableRowGroup.native";
import { TableRow } from "../../../design/components/TableRow/native/TableRow.native";
import { Icon, Avatar, AvatarSizes } from "../../../design/void/native";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { useStateFromStores } from "../../../_bundle/Module589";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
import { getUser } from "../../../actions/UserActionCreators";
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetScrollView } from "../../../_bundle/Module5245";
import Module8364 from "../../../_bundle/Module8364";
import { Text } from "../../../design/components/Text/native/Text";
import NicknameUtils from "../../../utils/NicknameUtils";
import Module8363 from "../../../_bundle/Module8363";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { ImpressionNames } from "../../../_bundle/Module503";
import { Button } from "../../../design/components/Button/native/Button.native";
import RelationshipActionCreators from "../../../actions/RelationshipActionCreators";
import HelpdeskUtils from "../../../utils/HelpdeskUtils";
import Linking from "../../../lib/native/Linking";
let useStyles, c6998_16;
const IgnoredInformationTable = function IgnoredInformationTable() {
return <TableRowGroup hasIcons>
{c6998_16.map((item, index) => <TableRow key={index} start={index === 0} end={c6998_16.length - 1 === index} icon={<Icon size={Icon.Sizes.MEDIUM} source={item.icon} />} label={item.text()} subLabel={item.subtext()} accessible accessibilityLabel={item.a11yLabel()} />)}
</TableRowGroup>;
};
useStyles = createStyles({
button: {
alignContent: "center",
textAlign: "center"
},
tableContainer: {
marginBottom: Module712.space.PX_16
},
otherOptions: {
marginBottom: Module712.space.PX_24
},
subTitle: {
textAlign: "center"
},
title: {
textAlign: "center",
marginBottom: Module712.space.PX_4
},
container: {
flex: 1,
paddingHorizontal: Module712.space.PX_16,
paddingTop: Module712.space.PX_16
},
header: {
marginBottom: Module712.space.PX_16
},
avatarContainer: {
position: "relative",
alignSelf: "center",
marginBottom: Module712.space.PX_16
},
avatarIconContainer: {
position: "absolute",
bottom: -8,
right: -8,
padding: Module712.space.PX_4,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.round
},
avatar: {
alignSelf: "center"
},
destructiveIcon: {
color: Module712.colors.TEXT_FEEDBACK_CRITICAL
}
});
c6998_16 = [{
icon: Module8361,
text: () => intl.string(t.ruhGkg),
subtext: () => intl.string(t["/FWKKC"]),
a11yLabel: () => intl.string(t.QAzPrp)
}, {
icon: Module8361,
text: () => intl.string(t.N9v3eq),
subtext: () => intl.string(t.ddpuJg),
a11yLabel: () => intl.string(t.PYR8jT)
}, {
icon: Module4147,
text: () => intl.string(t["4ycGE0"]),
subtext: () => intl.string(t["5yfN+o"]),
a11yLabel: () => intl.string(t["/XoqE6"])
}];
const r121 = memo(function IgnoreConfirmationActionSheet(props) {
const { userId, channelId, onIgnore, onSuccess } = props;
const styles = useStyles();
const [disabled, setState] = useState(false);
const bottom = useSafeAreaInsets_native().bottom;
const analyticsLocations = useAnalyticsLocations([AnalyticsLocation.IGNORE_CONFIRMATION_ACTION_SHEET]).analyticsLocations;
const stateFromStores = useStateFromStores([UserStore], () => UserStore.getUser(userId), [userId]);
const stateFromStores2 = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(channelId)?.guild_id, [channelId]);
useEffect(() => {
if (stateFromStores == null) {
getUser(userId);
}
}, [stateFromStores, userId]);
const r3 = stateFromStores == null;
let r71 = null;
if (!r3) {
const handleClose = function handleClose() {
AnalyticsUtils.track(AnalyticEvents.USER_REMEDIATION_ACTION, {
action: UserRemediationAction.DISMISS_IGNORE,
location: "user-profile-context-menu"
});
};
let guildId = stateFromStores2;
if (guildId == null) {
guildId = void 0;
}
r71 = <AnalyticsLocationProvider value={analyticsLocations}>
<BottomSheet onDismiss={handleClose} scrollable startHeight={RESTRICTION_CONFIRMATION_ACTION_SHEET_HEIGHT + bottom + Module712.space.PX_24 + Module712.space.PX_24} bodyStyles={{
paddingBottom: Module712.space.PX_16 + bottom,
...styles.container
}}>
<BottomSheetScrollView>
<View style={styles.header}>
<View style={styles.avatarContainer}>
<Avatar guildId={guildId} user={stateFromStores} animate={false} size={AvatarSizes.XLARGE} style={styles.avatar} />
<View style={styles.avatarIconContainer}>
<Icon size={Icon.Sizes.MEDIUM} source={Module8364} />
</View>
</View>
<Text style={styles.title} variant="heading-xl/bold" color="mobile-text-heading-primary" accessibilityRole="header">
{intl.format(t["WrQD/Y"], {
username: NicknameUtils.getName(stateFromStores2, channelId, stateFromStores)
})}
</Text>
<Text style={styles.subTitle} variant="heading-md/medium" color="text-default" accessibilityRole="header">
{intl.string(t.JKL1u1)}
</Text>
</View>
<View style={styles.tableContainer}>
<IgnoredInformationTable />
</View>
<View style={styles.otherOptions}>
<TableRowGroup title={intl.string(t["1v01gh"])} hasIcons>
<TableRow icon={<Icon size={Icon.Sizes.MEDIUM} source={Module8363} color={styles.destructiveIcon.color} />} label={intl.string(t.bwxY30)} variant="danger" subLabel={<Text variant="text-xs/medium" color="text-feedback-critical">
{intl.string(t.NTnf1T)}
</Text>} accessibilityLabel={intl.string(t["fZ+p9C"])} onPress={() => {
AnalyticsUtils.track(AnalyticEvents.USER_REMEDIATION_ACTION, {
action: UserRemediationAction.GOTO_BLOCK,
location: "user-profile-context-menu"
});
ActionSheetActionCreators.openLazy(import("./BlockConfirmationActionSheet"), BLOCK_CONFIRMATION_ACTION_SHEET_KEY, {
userId,
channelId,
onSuccess,
impressionName: ImpressionNames.BLOCK_USER_CONFIRMATION
}, "replaceTopSheet");
}} arrow />
</TableRowGroup>
</View>
<View style={styles.button}>
<Button size="lg" text={intl.string(t.ytCpKs)} onPress={() => {
setState(true);
RelationshipActionCreators.ignoreUser(userId, AnalyticsLocation.IGNORE_CONFIRMATION_ACTION_SHEET, channelId).then(() => {
if (onSuccess != null) {
onSuccess();
}
ActionSheetActionCreators.hideActionSheet();
});
if (onIgnore != null) {
onIgnore();
}
AnalyticsUtils.track(AnalyticEvents.IGNORE_USER_CONFIRMED);
}} disabled={disabled} loading={disabled} />
<Text onPress={handleClose} style={{
textAlign: "center",
marginTop: Module712.space.PX_12,
paddingBottom: Module712.space.PX_4
}} variant="text-sm/normal" color="text-default">
{intl.format(t.iX9qtL, {
articleLink: function articleLink() {
ActionSheetActionCreators.hideActionSheet();
Linking.openURL(HelpdeskUtils.getArticleURL(HelpdeskArticles.STEALTH_REMEDIATION_FEATURE_GUIDE));
}
})}
</Text>
</View>
</BottomSheetScrollView>
</BottomSheet>
</AnalyticsLocationProvider>;
}
return r71;
});
export default r121;