100 lines
4.1 KiB
TypeScript
100 lines
4.1 KiB
TypeScript
// Metro module 9094 (f9095).
|
|
import { useMemo } from "react";
|
|
import { View } from "react-native";
|
|
import UserStore from "../../../stores/UserStore";
|
|
import { AVATAR_SIZE_MAP, Avatar, StatusSizes, AvatarSizes } from "../../../design/void/native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { CutoutShape } from "../../../design/components/Icon/native/ClipView";
|
|
import { useStateFromStoresArray } from "../../../_bundle/Module589";
|
|
import { isNotNullish } from "../../../utils/GlobalUtils";
|
|
let c5956_7, useStyles;
|
|
const FacepileGroupDMAvatar = function FacepileGroupDMAvatar(props) {
|
|
let c16944_1;
|
|
const { style, size, animate, users, sources } = props;
|
|
let pileSizeOverride = props.pileSizeOverride;
|
|
const { status, accessible, accessibilityLabel } = props;
|
|
c16944_1 = void 0;
|
|
const styles = useStyles();
|
|
const width = AVATAR_SIZE_MAP[size];
|
|
const memo = useMemo(() => ({
|
|
width,
|
|
height: width
|
|
}), [width]);
|
|
if (pileSizeOverride == null) {
|
|
pileSizeOverride = c5956_7[size];
|
|
}
|
|
const r33 = AVATAR_SIZE_MAP[pileSizeOverride];
|
|
c16944_1 = r33;
|
|
return <View style={[memo, style]} accessible={accessible} accessibilityLabel={accessibilityLabel} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
|
|
<Avatar style={styles.firstFace} size={pileSizeOverride} guildId={void 0} cutout={useMemo(() => {
|
|
const r0 = c16944_1 / 2;
|
|
const r1 = r0 + 3;
|
|
const size = 2 * r1;
|
|
const r15 = Math.sqrt(2 * Math.pow(r1, 2));
|
|
const r18 = width - r0 - c16944_1;
|
|
const r25 = Math.sqrt(2 * Math.pow(r18, 2));
|
|
const r31 = -r15 - (r1 - r15) - r25 + (r25 - r18);
|
|
return {
|
|
nativeCutouts: [{
|
|
shape: CutoutShape.Circle,
|
|
x: c16944_1 - size - r31,
|
|
y: c16944_1 - size - r31,
|
|
size
|
|
}]
|
|
};
|
|
}, [width, r33])} animate={animate} {...users == null ? {
|
|
source: sources[0]
|
|
} : {
|
|
user: users[0]
|
|
}} />
|
|
<Avatar status={status} statusSizeOverride={StatusSizes.REFRESH_MEDIUM_10} autoStatusCutout style={styles.secondFace} size={pileSizeOverride} guildId={void 0} animate={animate} {...users == null ? {
|
|
source: sources[1]
|
|
} : {
|
|
user: users[1]
|
|
}} />
|
|
</View>;
|
|
};
|
|
const r25 = {};
|
|
r25[AvatarSizes.LARGE_48] = AvatarSizes.SMALL;
|
|
r25[AvatarSizes.XLARGE] = AvatarSizes.NORMAL;
|
|
r25[AvatarSizes.XXLARGE] = AvatarSizes.LARGE;
|
|
r25[AvatarSizes.PROFILE] = AvatarSizes.XXLARGE;
|
|
r25[AvatarSizes.REFRESH_MEDIUM_32] = AvatarSizes.XSMALL_20;
|
|
r25[AvatarSizes.XSMALL] = AvatarSizes.SIZE_16;
|
|
r25[AvatarSizes.SIZE_16] = AvatarSizes.XXSMALL_10;
|
|
r25[AvatarSizes.NORMAL] = AvatarSizes.XSMALL;
|
|
c5956_7 = r25;
|
|
useStyles = createStyles({
|
|
firstFace: {
|
|
position: "absolute",
|
|
top: 0,
|
|
left: 0
|
|
},
|
|
secondFace: {
|
|
position: "absolute",
|
|
bottom: 0,
|
|
right: 0
|
|
}
|
|
});
|
|
export default function GroupDMAvatar(props) {
|
|
let r32;
|
|
let channel;
|
|
L8: {
|
|
const style = props.style;
|
|
channel = props.channel;
|
|
const { size, animate, pileSizeOverride, status, accessible, accessibilityLabel } = props;
|
|
const stateFromStoresArray = useStateFromStoresArray([UserStore], () => channel.recipients.map((recipient) => UserStore.getUser(recipient)).filter(isNotNullish));
|
|
if (channel.icon == null && (channel.recipients.length !== 0 && stateFromStoresArray.length !== 0)) {
|
|
if (stateFromStoresArray.length === 1) {
|
|
r32 = <Avatar autoStatusCutout status={status} style={style} size={size} user={stateFromStoresArray[0]} guildId={void 0} animate={animate} accessible={accessible} accessibilityLabel={accessibilityLabel} />;
|
|
break L8;
|
|
}
|
|
r32 = <FacepileGroupDMAvatar status={status} style={style} size={size} animate={animate} users={stateFromStoresArray} pileSizeOverride={pileSizeOverride} accessible={accessible} accessibilityLabel={accessibilityLabel} />;
|
|
} else {
|
|
r32 = <Avatar autoStatusCutout status={status} style={style} size={size} channel={channel} animate={animate} accessible={accessible} accessibilityLabel={accessibilityLabel} />;
|
|
}
|
|
}
|
|
return r32;
|
|
};
|
|
export { FacepileGroupDMAvatar };
|