61 lines
2.2 KiB
TypeScript
61 lines
2.2 KiB
TypeScript
// Metro module 10360 (f10361).
|
|
import { useMemo, useCallback } from "react";
|
|
import { View } from "react-native";
|
|
import GuildIcon, { ImageSizes, GuildIconSizes } from "../../guild/native/GuildIcon";
|
|
import ClipView, { CutoutShape } from "../../../design/components/Icon/native/ClipView";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { useGuildIncidentsState } from "../../guild_antiraid/GuildAntiRaidHooks";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { transitionToChannel } from "../../routing/transitionToChannel";
|
|
import { NotificationPressable } from "./Notification";
|
|
import { WarningIcon } from "../../../design/components/Icon/native/redesign/generated/WarningIcon";
|
|
import { SystemMessageText } from "./MessagePreviewText";
|
|
let c6933_8 = {
|
|
shape: CutoutShape.RoundedRect,
|
|
x: ImageSizes[GuildIconSizes.NORMAL] - -6 - 24,
|
|
y: -6,
|
|
width: 24,
|
|
height: 24,
|
|
cornerRadius: Module712.radii.sm
|
|
};
|
|
const useStyles = createStyles({
|
|
warningBadge: {
|
|
position: "absolute",
|
|
top: -6,
|
|
right: -6,
|
|
width: 24,
|
|
height: 24,
|
|
alignItems: "center",
|
|
justifyContent: "center"
|
|
},
|
|
warningIcon: {
|
|
width: 16,
|
|
height: 16
|
|
}
|
|
});
|
|
export default function AlertNotification(props) {
|
|
const notification = props.notification;
|
|
const { key, channel, guild } = notification;
|
|
const styles = useStyles();
|
|
const text = useGuildIncidentsState(key).incidentData?.raidDetectedAt != null ? intl.string(t.Mn3elp) : intl.string(t.evRhwg);
|
|
return <NotificationPressable icon={<>
|
|
<ClipView cutouts={[c6933_8]}>
|
|
<GuildIcon guild={guild} selected={false} />
|
|
</ClipView>
|
|
<View style={styles.warningBadge}>
|
|
<WarningIcon style={styles.warningIcon} color={Module712.colors.ICON_FEEDBACK_WARNING} />
|
|
</View>
|
|
</>} header={useMemo(() => ({
|
|
type: "simple",
|
|
text: intl.string(t["2IY4YN"]),
|
|
secondaryText: guild?.name
|
|
}), [guild])} onPress={useCallback(() => {
|
|
transitionToChannel(channel.id, {
|
|
navigationReplace: true
|
|
});
|
|
}, [channel.id])} notification={notification}>
|
|
<SystemMessageText text={text} />
|
|
</NotificationPressable>;
|
|
};
|