110 lines
3.9 KiB
TypeScript
110 lines
3.9 KiB
TypeScript
// Metro module 15703 (f15704).
|
|
import { View } from "react-native";
|
|
import RelationshipStore from "../../../stores/RelationshipStore";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import { AVATAR_SIZE_MAP, AvatarSizes, Avatar } from "../../../design/void/native";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { useStateFromStores } from "../../../_bundle/Module589";
|
|
import UserUtils, { getUserTag } from "../../../utils/UserUtils";
|
|
import { useMessageRequestRelativeTimestampText } from "../hooks/useMessageRequestTimestampText";
|
|
import AvatarUtils from "../../../utils/native/AvatarUtils";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import MessageRequestPreview from "./MessageRequestPreview";
|
|
import MessageRequestMutualServers from "./MessageRequestMutualServers";
|
|
const useStyles = createStyles({
|
|
avatar: {
|
|
borderRadius: AVATAR_SIZE_MAP[AvatarSizes.NORMAL] / 2,
|
|
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
|
|
},
|
|
avatarContainer: {
|
|
marginRight: 16,
|
|
alignItems: "flex-start",
|
|
height: "100%"
|
|
},
|
|
detailsContainer: {
|
|
marginRight: 8,
|
|
justifyContent: "flex-start",
|
|
alignItems: "flex-start",
|
|
flex: 1
|
|
},
|
|
messageDetails: {
|
|
flexDirection: "row",
|
|
alignItems: "center"
|
|
},
|
|
username: {
|
|
flexShrink: 1,
|
|
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY
|
|
},
|
|
timestampSeparator: {
|
|
marginHorizontal: 6
|
|
},
|
|
messagePreview: {
|
|
marginTop: 2
|
|
},
|
|
usernameTextContainer: {
|
|
flexShrink: 1
|
|
}
|
|
});
|
|
export default function MessageRequestRowSenderDetails(props) {
|
|
const { channel, otherUser } = props;
|
|
let isRestricted = props.isRestricted;
|
|
if (isRestricted === void 0) {
|
|
isRestricted = false;
|
|
}
|
|
const styles = useStyles();
|
|
const stateFromStores = useStateFromStores([RelationshipStore], () => {
|
|
const r1 = otherUser == null;
|
|
let r8 = null;
|
|
if (!r1) {
|
|
let r9 = RelationshipStore.getNickname(otherUser.id);
|
|
if (r9 == null) {
|
|
r9 = UserUtils.getGlobalName(otherUser);
|
|
}
|
|
r8 = r9;
|
|
}
|
|
return r8;
|
|
});
|
|
const messageRequestRelativeTimestampText = useMessageRequestRelativeTimestampText(channel);
|
|
const source = AvatarUtils.DEFAULT_AVATARS[Math.floor(Math.random() * AvatarUtils.DEFAULT_AVATARS.length)];
|
|
const r63 = [<View style={styles.avatarContainer}>
|
|
<Avatar {...otherUser != null ? {
|
|
avatarStyle: styles.avatar,
|
|
user: otherUser,
|
|
guildId: void 0,
|
|
disablePlaceholder: true,
|
|
avatarDecoration: otherUser?.avatarDecoration
|
|
} : {
|
|
avatarStyle: styles.avatar,
|
|
source
|
|
}} />
|
|
</View>, ,];
|
|
let r75 = stateFromStores;
|
|
if (r75 == null) {
|
|
r75 = otherUser?.username;
|
|
}
|
|
if (r75 == null) {
|
|
r75 = intl.string(t["30mdIx"]);
|
|
}
|
|
const r109 = [<View style={styles.messageDetails}>
|
|
<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary" style={styles.usernameTextContainer}>
|
|
<Text variant="text-md/semibold" color="mobile-text-heading-primary" style={styles.username}>{r75}</Text>
|
|
{stateFromStores != null && <Text variant="text-md/medium" color="text-muted">
|
|
{" "}
|
|
{getUserTag(otherUser)}
|
|
</Text>}
|
|
</Text>
|
|
<Text style={styles.timestampSeparator} variant="text-xs/medium" color="text-muted">·</Text>
|
|
<Text variant="text-xs/semibold" color="text-muted">{messageRequestRelativeTimestampText}</Text>
|
|
</View>, isRestricted ? !isRestricted : <MessageRequestPreview style={styles.messagePreview} channel={channel} />, ,];
|
|
if (isRestricted) {
|
|
isRestricted = otherUser != null;
|
|
}
|
|
if (isRestricted) {
|
|
isRestricted = <MessageRequestMutualServers style={styles.messagePreview} userId={otherUser.id} suffix={intl.string(t.hTltPn)} />;
|
|
}
|
|
r109[2] = isRestricted;
|
|
r63[1] = <View style={styles.detailsContainer}>{r109}</View>;
|
|
return <>{r63}</>;
|
|
};
|