99 lines
3.6 KiB
TypeScript
99 lines
3.6 KiB
TypeScript
// Metro module 11034 (f11035).
|
|
import _slicedToArray from "../../../_bundle/_slicedToArray";
|
|
import { View } from "react-native";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { CLEAR_COMMUNICATION_DISABLED_MODAL_NAME, GUILD_COMMUNICATION_DISABLED_RESOURCE_LINK } from "../GuildDisableCommunicationConstants";
|
|
import { AnalyticEvents, Fonts } from "../../../Constants";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import useUserCommunicationDisabled from "../useUserCommunicationDisabled";
|
|
import useMountEffect from "../../../hooks/useMountEffect";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
import CommunicationDisabledActionCreators from "../../../actions/CommunicationDisabledActionCreators";
|
|
import ToastActionCreators from "../../toast/native/ToastActionCreators";
|
|
import * as _index_native from "../../../intl/index.native";
|
|
import { intl } from "../../../intl/index.native";
|
|
import Module10356 from "../../../_bundle/Module10356";
|
|
import Alert from "../../../components_native/common/Alert";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import NicknameUtils from "../../../utils/NicknameUtils";
|
|
import CountDown from "../../../components_native/common/CountDown";
|
|
const useStyles = createStyles({
|
|
wrapper: {
|
|
padding: 16
|
|
},
|
|
body: {
|
|
paddingTop: 16
|
|
},
|
|
description: {
|
|
lineHeight: 18
|
|
},
|
|
cta: {
|
|
paddingTop: 8
|
|
},
|
|
countdown: {
|
|
fontFamily: Fonts.PRIMARY_SEMIBOLD
|
|
}
|
|
});
|
|
export default function GuildEnableCommunicationAlert(props) {
|
|
let styles, c18492_3;
|
|
const { guildId, userId, onCancel, ...rest } = props;
|
|
styles = void 0;
|
|
c18492_3 = void 0;
|
|
let _handleConfirmRemoveTimeout2 = function _handleConfirmRemoveTimeout() {
|
|
const r9 = async () => {
|
|
let c30334_0;
|
|
c30334_0 = void 0;
|
|
await CommunicationDisabledActionCreators.setCommunicationDisabledDuration(guildId, userId);
|
|
ToastActionCreators.open({
|
|
key: "GUILD_ENABLE_COMMUNICATION_SUCCESS",
|
|
content: intl.string(_index_native.t["/Mmbfv"]),
|
|
icon: Module10356
|
|
});
|
|
};
|
|
_handleConfirmRemoveTimeout2 = r9;
|
|
return r9.apply(this, arguments);
|
|
};
|
|
styles = useStyles();
|
|
c18492_3 = _slicedToArray(useUserCommunicationDisabled(userId, guildId), 1)[0];
|
|
useMountEffect(() => {
|
|
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
|
|
type: CLEAR_COMMUNICATION_DISABLED_MODAL_NAME,
|
|
guild_id: guildId,
|
|
other_user_id: userId
|
|
});
|
|
});
|
|
const props2 = {
|
|
...rest,
|
|
title: intl.string(_index_native.t["+ZD3ou"]),
|
|
style: styles.wrapper,
|
|
cancelText: intl.string(_index_native.t["ETE/oC"]),
|
|
onClose: rest?.onClose,
|
|
onCancel,
|
|
confirmText: intl.string(_index_native.t.qXtNtS),
|
|
onConfirm: function handleConfirmRemoveTimeout() {
|
|
return _handleConfirmRemoveTimeout2.apply(this, arguments);
|
|
}
|
|
};
|
|
const r15 = _index_native.t["t+abNU"];
|
|
let username = NicknameUtils.getName(guildId, null, UserStore.getUser(userId));
|
|
if (username == null) {
|
|
username = "";
|
|
}
|
|
props2.children = <View style={styles.body}>
|
|
<Text style={styles.description} variant="text-sm/medium">
|
|
{intl.format(r15, {
|
|
username,
|
|
countdown: function countdown(a0) {
|
|
return <CountDown style={styles.countdown} deadline={c18492_3 != null ? new Date(c18492_3) : 0} withUnits />;
|
|
}
|
|
})}
|
|
</Text>
|
|
<Text style={[styles.cta, styles.description]} variant="text-sm/medium">
|
|
{intl.format(_index_native.t.KtENkK, {
|
|
link: GUILD_COMMUNICATION_DISABLED_RESOURCE_LINK
|
|
})}
|
|
</Text>
|
|
</View>;
|
|
return <Alert {...props2} />;
|
|
};
|