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

122 lines
4.8 KiB
TypeScript

// Metro module 11051 (f11052).
import { useState } from "react";
import { View } from "react-native";
import { AnalyticEvents } from "../../../Constants";
import { SafetyToastType } from "../../safety_common/Constants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { intl, t } from "../../../intl/index.native";
import { RaidResolutionType, RaidAlertType, getMostImportantRaidResolutionType } from "../../guild_automod/AutomodFeedback";
import ActionSheetActionCreators from "../../action_sheet/native/ActionSheetActionCreators";
import { ActionSheet } from "../../../design/components/Sheet/native/ActionSheet.native";
import KeyboardAwareView from "../../keyboard/native/KeyboardAwareView";
import { Text } from "../../../design/components/Text/native/Text";
import { FormRow } from "../../../design/void/Form/native/index";
import { Checkbox, TextInput } from "../../../design/void/native";
import { Button } from "../../../design/components/Button/native/Button.native";
import { trackWithMetadata } from "../../app_analytics/AppAnalyticsUtils";
import { handleResolveRaid } from "../GuildAntiRaidActionCreators";
import SafetyToastsActionCreators_native from "../../safety_common/SafetyToastsActionCreators.native";
const useStyles = createStyles({
container: {
paddingVertical: 24,
paddingHorizontal: 16,
display: "flex",
flexDirection: "column",
alignItems: "center"
},
title: {
marginBottom: 8,
textAlign: "center"
},
subtitle: {
marginBottom: 16,
textAlign: "center"
},
optionContainer: {
borderColor: Module712.colors.BORDER_SUBTLE,
borderWidth: 1,
borderRadius: Module712.radii.xs,
display: "flex",
flexDirection: "column",
marginBottom: 14,
width: "100%"
},
option: {
width: "100%"
},
textInputContainer: {
paddingLeft: 54,
paddingRight: 16,
paddingBottom: 16
},
textInput: {
backgroundColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
width: "100%",
padding: 8,
borderRadius: Module712.radii.xs
}
});
export default function GuildRaidResolveActionSheet(props) {
let styles, state, setState, state2, setState2;
const { guildId, messageId } = props;
styles = void 0;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
const handleTextInputChange2 = function handleTextInputChange(a0) {
setState2(a0);
};
styles = useStyles();
[state, setState] = useState([]);
[state2, setState2] = useState();
const r15 = [{
text: intl.string(t.yeaXw5),
value: RaidResolutionType.LEGITIMATE_ACTIVITY
}, {
text: intl.string(t["o++3B8"]),
value: RaidResolutionType.DM_SPAM
}, {
text: intl.string(t.UfHAwZ),
value: RaidResolutionType.JOIN_RAID
}, {
text: intl.string(t.K3UWeR),
value: RaidResolutionType.OTHER
}];
return <ActionSheet>
<KeyboardAwareView style={styles.container}>
<Text style={styles.title} variant="heading-xl/bold" color="mobile-text-heading-primary">
{intl.string(t["1zmw/H"])}
</Text>
<Text style={styles.subtitle} variant="text-sm/normal" color="text-default">
{intl.string(t.nF79oO)}
</Text>
{r15.map(({ text, value }) => <View key={value} style={styles.optionContainer}>
<FormRow style={styles.option} onPress={() => {
const value2 = value;
setState(state.includes(value) ? (a0) => a0.filter((item) => item !== value2) : (a0) => [...a0, value2]);
}} leading={<Checkbox selected={state.includes(value)} />} label={text} />
{value === RaidResolutionType.OTHER && state.includes(RaidResolutionType.OTHER) && <View style={styles.textInputContainer}>
<TextInput style={styles.textInput} autoComplete="off" value={state2} placeholder={intl.string(t["PAM+JR"])} onChangeText={handleTextInputChange2} />
</View>}
</View>)}
<Button onPress={function onPress() {
trackWithMetadata(AnalyticEvents.GUILD_RAID_FEEDBACK, {
raid_alert_type: RaidAlertType.JOIN_RAID,
raid_alert_id: messageId,
false_alarm_type: state.map((item) => item.toString()),
false_alarm_other_reason: state2,
guild_id: guildId
});
handleResolveRaid(guildId, messageId, getMostImportantRaidResolutionType(state));
ActionSheetActionCreators.hideActionSheet("GuildRaidResolveActionSheet");
SafetyToastsActionCreators_native.showSuccessToast(SafetyToastType.SAFETY_FEEDBACK_SUCCESS);
}} text={intl.string(t.Gh3A0O)} size="md" />
<Button onPress={function handleClose() {
ActionSheetActionCreators.hideActionSheet("GuildRaidResolveActionSheet");
}} text={intl.string(t["ETE/oC"])} variant="secondary" size="md" />
</KeyboardAwareView>
</ActionSheet>;
};