139 lines
5.3 KiB
TypeScript
139 lines
5.3 KiB
TypeScript
// Metro module 11057 (f11058).
|
|
import { Fragment, useState, useMemo } from "react";
|
|
import { View } from "react-native";
|
|
import { AnalyticEvents } from "../../../Constants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
|
|
import { HeaderActionButton } from "../../../design/components/Navigator/native/HeaderActionButton.native";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import Module7699 from "../../../_bundle/Module7699";
|
|
import { generateFeedbackOptions, Feedback } from "../AutomodFeedback";
|
|
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { FormRow, FormDivider } from "../../../design/void/Form/native/index";
|
|
import { RadioIndicator } from "../../../design/void/native";
|
|
import { Button } from "../../../design/components/Button/native/Button.native";
|
|
import { trackWithMetadata } from "../../app_analytics/AppAnalyticsUtils";
|
|
import { executeAlertAction } from "../GuildAutomodActionCreators";
|
|
import { AutomodAlertActionType } from "../AutomodAlert";
|
|
import { presentFeedbackSent } from "../../toast/native/ToastUtils";
|
|
import { Navigator } from "../../../design/components/Navigator/native/Navigator.native";
|
|
let initialRouteName, useStyles, SubmitFeedbackScreen;
|
|
const Navbar = function Navbar(props) {
|
|
const onClose = props.onClose;
|
|
const styles2 = useStyles();
|
|
return <SafeAreaPaddingView top style={styles2.header}>
|
|
<View style={styles2.closeButtonContainer}>
|
|
<HeaderActionButton accessibilityLabel={intl.string(t.cpT0Cq)} onPress={onClose} source={Module7699} />
|
|
</View>
|
|
</SafeAreaPaddingView>;
|
|
};
|
|
SubmitFeedbackScreen = function SubmitFeedbackScreen(props) {
|
|
const { feedback, onChange: onChange2, onSubmit: onSubmit3 } = props;
|
|
const styles = useStyles();
|
|
const r15 = generateFeedbackOptions();
|
|
let c18502_3 = r15;
|
|
const bottom = useSafeAreaInsets_native().bottom;
|
|
return <View style={styles.container}>
|
|
<Text style={styles.headerTitle} variant="heading-xl/bold" color="mobile-text-heading-primary">
|
|
{intl.string(t["7bdzNo"])}
|
|
</Text>
|
|
<Text style={styles.headerSubtitle} variant="text-sm/medium" color="text-default">
|
|
{intl.string(t.Lbpk6m)}
|
|
</Text>
|
|
<View style={styles.formBody}>
|
|
{r15.map(({ name, value }, index) => <Fragment key={value}>
|
|
<FormRow onPress={() => onChange2(value)} trailing={<RadioIndicator active={feedback === value} style={styles.radioIndicator} />} label={<Text style={styles.formRow} variant="text-md/semibold" color="interactive-text-active">{name}</Text>} />
|
|
{index < c18502_3.length - 1 && <FormDivider />}
|
|
</Fragment>)}
|
|
</View>
|
|
<View style={[styles.submitButtonContainer, {
|
|
paddingBottom: bottom + 16
|
|
}]}>
|
|
<Button size="md" text={intl.string(t.Z6DZZ6)} onPress={onSubmit3} />
|
|
</View>
|
|
</View>;
|
|
};
|
|
initialRouteName = "SUBMIT_FEEDBACK";
|
|
useStyles = createStyles({
|
|
container: {
|
|
flex: 1,
|
|
paddingHorizontal: 16,
|
|
paddingVertical: 0,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
|
|
flexDirection: "column",
|
|
height: "100%",
|
|
paddingTop: 8
|
|
},
|
|
header: {
|
|
flexDirection: "row",
|
|
justifyContent: "flex-end",
|
|
paddingVertical: 8,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
|
|
},
|
|
headerTitle: {
|
|
textAlign: "center"
|
|
},
|
|
headerSubtitle: {
|
|
textAlign: "center",
|
|
marginTop: 8
|
|
},
|
|
closeButtonContainer: {
|
|
marginVertical: 14
|
|
},
|
|
formBody: {
|
|
marginTop: 24,
|
|
borderRadius: Module712.radii.sm,
|
|
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
|
|
},
|
|
formRow: {
|
|
paddingVertical: 2
|
|
},
|
|
radioIndicator: {
|
|
marginRight: 0
|
|
},
|
|
submitButtonContainer: {
|
|
position: "absolute",
|
|
bottom: 0,
|
|
left: 0,
|
|
right: 0,
|
|
paddingHorizontal: 16,
|
|
paddingVertical: 16,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
|
|
}
|
|
});
|
|
export default function AutomodSubmitFeedbackModal(props) {
|
|
const { onCloseModal, automodDecision } = props;
|
|
const top = useSafeAreaInsets_native().top;
|
|
const [state, setState] = useState(Feedback.BUG);
|
|
return <Navigator screens={useMemo(() => {
|
|
let onSubmit2;
|
|
const onCloseModal2 = onCloseModal;
|
|
const state2 = state;
|
|
const onChange3 = function onChange(a0) {
|
|
setState(a0);
|
|
};
|
|
onSubmit2 = function onSubmit() {
|
|
trackWithMetadata(AnalyticEvents.GUILD_AUTOMOD_FEEDBACK, {
|
|
feedback_type: state,
|
|
message_id: automodDecision.messageId,
|
|
content: automodDecision.messageContent,
|
|
decision_id: automodDecision.decisionId
|
|
});
|
|
executeAlertAction(automodDecision.messageId, automodDecision.channel, AutomodAlertActionType.SUBMIT_FEEDBACK);
|
|
presentFeedbackSent();
|
|
onCloseModal();
|
|
};
|
|
const r8 = {};
|
|
r8[initialRouteName] = {
|
|
ignoreKeyboard: true,
|
|
title: "",
|
|
customNavbar: () => <Navbar onClose={onCloseModal2} />,
|
|
headerLeft: () => null,
|
|
render: () => <SubmitFeedbackScreen feedback={state2} onChange={onChange3} onSubmit={onSubmit2} />
|
|
};
|
|
return r8;
|
|
}, [state, onCloseModal, automodDecision])} initialRouteName={initialRouteName} headerStatusBarHeight={top} />;
|
|
};
|