Files
discord-decomp/modules/user_profile/native/NonUserBotProfileContent.tsx
T
2026-11-01 12:12:55 +02:00

88 lines
4.5 KiB
TypeScript

// Metro module 8375 (f8376).
import { memo } from "react";
import { View } from "react-native";
import { PROFILE_CONTENT_BOTTOM_PADDING, PROFILE_CONTENT_WITHOUT_STATUS_TOP_PADDING } from "./Constants";
import { ACTION_SHEET_MAX_WIDTH } from "../../action_sheet/native/ActionSheetConstants";
import UserProfileSharedStyles from "./UserProfileSharedStyles";
import { useUserProfileAnalyticsContext } from "../UserProfileAnalyticsContext";
import NicknameUtils from "../../../utils/NicknameUtils";
import UserUtils from "../../../utils/UserUtils";
import useBadges from "../hooks/useBadges";
import useUserProfileBannerHeight from "../hooks/native/useUserProfileBannerHeight";
import useUserProfileOverscrollStyles from "./useUserProfileOverscrollStyles";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import useProfileTheme from "../hooks/useProfileTheme";
import { useUserProfileColors } from "../hooks/native/useUserProfileColors";
import { copy } from "../../../utils/ClipboardUtils.native";
import { presentUsernameCopied, presentUserPronouns } from "../../toast/native/ToastUtils";
import UserProfileOverscrollBanner from "./UserProfileOverscrollBanner";
import ReanimatedRexport from "../../reanimated/ReanimatedRexport";
import { OpenableUserProfileAvatar } from "./UserProfileAvatar";
import UserProfilePrimaryInfo from "./UserProfilePrimaryInfo";
import { intl, t } from "../../../intl/index.native";
import UserProfileAboutMeCard from "./UserProfileAboutMeCard";
const r32 = memo(function NonUserBotProfileContent(props) {
const { user, channel, displayProfile, scrollPosition } = props;
const styles = UserProfileSharedStyles();
const trackUserProfileAction = useUserProfileAnalyticsContext().trackUserProfileAction;
const name = NicknameUtils.useName(channel?.guild_id, channel?.id, user);
const userTag = UserUtils.useUserTag(user);
const badges = useBadges(displayProfile);
const userProfileBannerHeight = useUserProfileBannerHeight(ACTION_SHEET_MAX_WIDTH);
const styles2 = useUserProfileOverscrollStyles({
scrollPosition,
bannerHeight: userProfileBannerHeight
});
const { bannerAnimatedStyle, bannerImageAnimatedStyle, contentAnimatedStyle, blurAnimatedProps, showBlur } = styles2;
const bottom = useSafeAreaInsets_native().bottom;
const profileTheme = useProfileTheme({
user,
displayProfile
});
const userProfileColors = useUserProfileColors({
theme: profileTheme.theme,
primaryColor: profileTheme.primaryColor,
secondaryColor: profileTheme.secondaryColor
});
const { avatarBackground, containerBackground } = userProfileColors;
if (user == null) {
return null;
}
const r74 = [<UserProfileOverscrollBanner user={user} displayProfile={displayProfile} bannerHeight={userProfileBannerHeight} bannerAnimatedStyle={bannerAnimatedStyle} bannerImageAnimatedStyle={bannerImageAnimatedStyle} blurAnimatedProps={blurAnimatedProps} showBlur={showBlur} />, ,];
let guildId = displayProfile?.guildId;
if (guildId == null) {
guildId = void 0;
}
const r86 = [<OpenableUserProfileAvatar user={user} guildId={guildId} backgroundColor={avatarBackground} disableStatus />, ,];
const guild_id = channel?.guild_id;
const pronouns = displayProfile?.pronouns;
const handleCopyUsername = function handleCopyUsername() {
trackUserProfileAction({
action: "COPY_USERNAME"
});
copy(userTag);
presentUsernameCopied();
};
r86[1] = <View style={[styles.profileContentWrapper, styles.profileContent, {
paddingTop: PROFILE_CONTENT_WITHOUT_STATUS_TOP_PADDING,
paddingBottom: bottom + PROFILE_CONTENT_BOTTOM_PADDING
}]}>
<View style={styles.primaryInfo}>
<UserProfilePrimaryInfo user={user} guildId={guild_id} displayName={name} pronouns={pronouns} badges={badges} badgeContainerBackground={containerBackground} displayNameAccessibilityHint={intl.string(t.y5MwJy)} onPressDisplayName={handleCopyUsername} onPressUserTag={handleCopyUsername} onPressPronouns={function onPressPronouns() {
trackUserProfileAction({
action: "PRESS_PRONOUNS"
});
presentUserPronouns();
}} showBadgeToastOnPress />
</View>
<View style={styles.cards}>
<UserProfileAboutMeCard userId={user.id} displayProfile={displayProfile} channel={channel} style={[styles.card, {
backgroundColor: containerBackground
}]} />
</View>
</View>;
r74[1] = <ReanimatedRexport.View style={contentAnimatedStyle}>{r86}</ReanimatedRexport.View>;
return <>{r74}</>;
});
export default r32;