decord/source/modules/user_profile/native/UserProfileRecentActivityCard.tsx
github-actions 4f02868c60 chore: update source for alpha 346.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4792.js (118.4 MB)
2026-09-11 10:30:06 +00:00

343 lines
13 KiB
TypeScript

// Module ID: 13165
// Function ID: 13166
// Name: UserProfileRecentActivityCard
// Dependencies: [19, 17, 21, 13103, 8221, 13108, 4607, 576, 8429, 4317, 8656, 4458, 5639, 1396, 1925, 4603, 13094, 7236, 7256, 13115, 13116, 8768, 8779, 5175, 1114, 2]
// Exports: default
// Module 13165 (UserProfileRecentActivityCard)
import nativeDefault from "native" /* 576 */;
import StringUtils from "StringUtils" /* 1925 */;
import FastImageDefault from "FastImage" /* 5639 */;
import useAnalyticsLocations from "useAnalyticsLocations" /* 7236 */;
import AnalyticsLocationDefault from "AnalyticsLocation" /* 7256 */;
import utils from "utils" /* 8221 */;
import ContentInventoryTypes from "ContentInventoryTypes" /* 8429 */;
import GameProfileAnalyticUtils from "GameProfileAnalyticUtils" /* 8779 */;
import ContentInventoryActivityImageUtils from "ContentInventoryActivityImageUtils" /* 13094 */;
import BadgesAll from "Badges" /* 13103 */;
import TrendingType from "TrendingType" /* 13108 */;
import useTrackUserProfileActivityActionDefault from "useTrackUserProfileActivityAction" /* 13115 */;
import useTrackUserProfileActivityViewDefault from "useTrackUserProfileActivityView" /* 13116 */;
import noop from "module_19" /* 19 */;
const useAnalyticsLocationsDefault = useAnalyticsLocations;
const useOpenGameProfileModalDefault = tmp4(8768);
require = fn;
function GamingEntryBadges(entry) {
entry = entry.entry;
const tmp = closure_9();
const badgeCell = tmp;
const found = items.filter((predicate) => predicate.predicate(entry));
let obj = { location: "user-profile", style: tmp.badges, children: null };
if (obj2.isTopGameEntry(entry)) {
const obj3 = { style: tmp.badgeCell, children: null };
const obj4 = { entry };
obj3.children = tmp2(BadgesAll.TopGameBadge, obj4);
let mapped = tmp2(View, obj3);
} else {
mapped = found.map((Badge, index) => {
const obj = { style: badgeCell.badgeCell, children: timestampProducer(Badge.Badge, { entry }) };
return timestampProducer(View, obj, index);
});
}
obj.children = mapped;
return closure_6(BadgesAll.BadgesContainer, obj);
}
const View = fn(17).View;
const jsxProd = fn(21);
({ jsx: metroRequire, jsxs: closure_7 } = jsxProd);
let items = [
{
Badge: BadgesAll.GameTimestampBadge,
predicate() {
return true;
}
},
,
,
,
,
];
let obj = {
Badge: BadgesAll.GameTimestampBadge,
predicate() {
return true;
}
};
items[1] = { Badge: BadgesAll.NewGameBadge, predicate: fn(8221).isEntryNew };
let obj2 = { Badge: BadgesAll.NewGameBadge, predicate: fn(8221).isEntryNew };
items[2] = {
Badge: BadgesAll.StreakBadge,
predicate(entry) {
let num = utils.getStreakCount(entry);
if (num == null) {
num = 0;
}
return num >= 2;
}
};
let obj3 = {
Badge: BadgesAll.StreakBadge,
predicate(entry) {
let num = utils.getStreakCount(entry);
if (num == null) {
num = 0;
}
return num >= 2;
}
};
items[3] = {
Badge: BadgesAll.TrendingBadge,
predicate(entry) {
const trendingType = utils.getTrendingType(entry);
return null != trendingType && trendingType !== TrendingType.TrendingType.TRENDING_TYPE_UNSPECIFIED;
}
};
let obj4 = {
Badge: BadgesAll.TrendingBadge,
predicate(entry) {
const trendingType = utils.getTrendingType(entry);
return null != trendingType && trendingType !== TrendingType.TrendingType.TRENDING_TYPE_UNSPECIFIED;
}
};
items[4] = {
Badge: BadgesAll.ResurrectedBadge,
predicate(entry) {
return null != utils.getResurrectedEntryLastPlayTime(entry);
}
};
let obj5 = {
Badge: BadgesAll.ResurrectedBadge,
predicate(entry) {
return null != utils.getResurrectedEntryLastPlayTime(entry);
}
};
items[5] = {
Badge: BadgesAll.MarathonBadge,
predicate(entry) {
let tmp3 = true === utils.isEntryMarathon(entry);
if (tmp3) {
tmp3 = null != utils.getMarathonDescription(entry).text;
const tmpResult = utils;
}
return tmp3;
}
};
const createStyles = fn(4607);
let obj7 = { body: null, content: null, imageContainer: null, imageAspectRatio: null, posterImageAspectRatio: null, largeImage: null, smallImageBackground: null, smallImage: null, badges: null, badgeCell: null };
let obj6 = {
Badge: BadgesAll.MarathonBadge,
predicate(entry) {
let tmp3 = true === utils.isEntryMarathon(entry);
if (tmp3) {
tmp3 = null != utils.getMarathonDescription(entry).text;
const tmpResult = utils;
}
return tmp3;
}
};
obj7.body = { flexDirection: "row", alignItems: "center", gap: nativeDefault.space.PX_16 };
obj7.content = { flex: 1 };
obj7.imageContainer = { position: "relative" };
obj7.imageAspectRatio = { width: 60, maxHeight: 60, aspectRatio: "1 / 1" };
obj7.posterImageAspectRatio = { width: 60, maxHeight: 100, aspectRatio: "2 / 3" };
let size = { borderRadius: nativeDefault.radii.xs, width: "100%", height: "100%" };
obj7.largeImage = size;
const rect = { borderRadius: 16, position: "absolute", right: -4, bottom: -4, backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOW };
obj7.smallImageBackground = rect;
obj7.smallImage = { width: 24, height: 24, borderRadius: 12 };
let obj9 = { flexDirection: "row", alignItems: "center", gap: nativeDefault.space.PX_16 };
obj7.badges = { flexDirection: "row", flexWrap: "wrap", alignItems: "center", rowGap: nativeDefault.space.PX_4, marginTop: nativeDefault.space.PX_8 };
let obj10 = { flexDirection: "row", flexWrap: "wrap", alignItems: "center", rowGap: nativeDefault.space.PX_4, marginTop: nativeDefault.space.PX_8 };
obj7.badgeCell = { width: "50%", paddingRight: nativeDefault.space.PX_8 };
let closure_9 = createStyles.createStyles(obj7);
let closure_11 = noop.memo((poster) => {
({ largeImage, smallImage } = poster);
const tmp = closure_9();
let src;
if (largeImage != null) {
src = largeImage.src;
}
if (null == src) {
const obj2 = { style: null, children: null };
items = [, ];
({ imageContainer: arr2[0], imageAspectRatio: arr2[1] } = tmp);
obj2.style = items;
let obj3 = { size: "custom", style: tmp.largeImage, color: null };
const tmp12 = View;
const tmp2Result = tmp2(4458);
const colors = nativeDefault.colors;
obj3.color = tmp2(4458).isThemeDark(obj.useThemeContext().theme) ? colors.WHITE : colors.BLACK;
obj3 = tmp11(tmp2(8656).UnknownGameIcon, obj3);
obj2.children = obj3;
timestampProducer(tmp12, obj2);
const isThemeDarkResult = tmp2(4458).isThemeDark(obj.useThemeContext().theme);
} else {
const items1 = [tmp.imageContainer, ];
const obj4 = { style: null, children: null };
items1[1] = poster.poster ? tmp.posterImageAspectRatio : tmp.imageAspectRatio;
obj4.style = items1;
const obj5 = { source: null, alt: null, style: null };
const tmp16 = React5;
const tmp6 = importDefault;
const tmp7 = FastImageDefault;
obj5.source = tmp2(1396).makeSource(largeImage.src);
obj5.alt = largeImage.alt;
obj5.style = tmp.largeImage;
const items2 = [timestampProducer(tmp7, obj5), ];
let src1;
if (smallImage != null) {
src1 = smallImage.src;
}
let tmp5Result = null != src1;
if (tmp5Result) {
const obj6 = { style: tmp.smallImageBackground, children: null };
const obj7 = { source: null, alt: null, style: null };
const tmp6Result = tmp6(5639);
obj7.source = tmp2(1396).makeSource(smallImage.src);
obj7.alt = smallImage.alt;
obj7.style = tmp.smallImage;
obj6.children = tmp5(tmp6Result, obj7);
tmp5Result = tmp5(tmp17, obj6);
const tmp2Result4 = tmp2(1396);
}
items2[1] = tmp5Result;
obj4.children = items2;
return tmp16(View, obj4);
}
});
let closure_12 = noop.memo((arg0) => {
({ entry, title, subtitle } = arg0);
({ largeImage, smallImage, style } = arg0);
const tmp = closure_9();
const obj = { style, children: null };
const obj2 = { style: tmp.body, children: null };
const obj3 = { largeImage, smallImage, poster: ContentInventoryTypes.isWatchedMediaEntry(entry) };
items = [timestampProducer(closure_11, obj3), ];
const obj5 = { style: tmp.content, children: null };
const isNullOrEmptyResult = StringUtils.isNullOrEmpty(title);
let tmp2Result = !isNullOrEmptyResult;
if (!isNullOrEmptyResult) {
const obj7 = { variant: "text-md/semibold", color: "mobile-text-heading-primary", lineClamp: 1, children: title };
tmp2Result = tmp2(tmp5(4603).Text, obj7);
}
const items1 = [tmp2Result, , ];
const isNullOrEmptyResult1 = StringUtils.isNullOrEmpty(subtitle);
let tmp2Result2 = !isNullOrEmptyResult1;
if (!isNullOrEmptyResult1) {
const obj8 = { variant: "text-xs/medium", lineClamp: 1, children: subtitle };
tmp2Result2 = tmp2(tmp5(4603).Text, obj8);
}
items1[1] = tmp2Result2;
const tmp5Result = StringUtils;
let isGamingLikeEntryResult = ContentInventoryTypes.isGamingLikeEntry(entry);
if (isGamingLikeEntryResult) {
const obj9 = { entry };
isGamingLikeEntryResult = tmp2(GamingEntryBadges, obj9);
}
items1[2] = isGamingLikeEntryResult;
obj5.children = items1;
items[1] = React5(View, obj5);
obj2.children = items;
obj.children = React5(View, obj2);
return timestampProducer(View, obj);
});
size = fn(2);
const result = size.fileFinishedImporting("modules/user_profile/native/UserProfileRecentActivityCard.tsx");
export default function UserProfileRecentActivityCard(style) {
({ user, entry } = style);
closure_1 = undefined;
const imageForContentEntry = ContentInventoryActivityImageUtils.useImageForContentEntry({ entry, showCoverImage: false, trackingSource: "user_profile_recent_activity_native" });
({ largeImage, smallImage } = imageForContentEntry);
const analyticsLocations = useAnalyticsLocationsDefault(AnalyticsLocationDefault.USER_PROFILE_RECENT_ACTIVITY_CARD).analyticsLocations;
const tmp6 = useTrackUserProfileActivityActionDefault({ display: "recent", user, entry, analyticsLocations });
closure_0 = tmp6;
useTrackUserProfileActivityViewDefault({ userId: user.id, onAction: tmp6 });
let application_id;
if ("application_id" in entry.extra) {
application_id = entry.extra.application_id;
}
const obj3 = { location: "UserProfileRecentActivityCard", applicationId: application_id, source: null, trackEntryPointImpression: true, sourceUserId: null };
const obj2 = { userId: user.id, onAction: tmp6 };
obj3.source = GameProfileAnalyticUtils.GameProfileSources.UserProfile;
obj3.sourceUserId = user.id;
const tmp4ResultResult = useOpenGameProfileModalDefault(obj3);
closure_1 = tmp4ResultResult;
items = [tmp6, tmp4ResultResult];
const callback = noop.useCallback(() => {
closure_0({ action: "PRESS_TEXT" });
if (closure_1 != null) {
closure_1();
}
}, items);
const tmp4Result = useOpenGameProfileModalDefault;
if (tmpResult.isGamingLikeEntry(entry)) {
const obj4 = { title: entry.extra.game_name };
let obj8 = obj4;
} else {
if (tmpResult4.isWatchedMediaEntry(entry)) {
const obj5 = { title: entry.extra.media_title, subtitle: entry.extra.media_subtitle };
obj8 = obj5;
} else {
if (tmpResult5.isListenedSessionEntry(entry)) {
const first = entry.extra.entries[0];
let media;
if (first != null) {
media = first.media;
}
let title1;
if (media != null) {
title1 = media.title;
}
const obj6 = { title: title1, subtitle: null };
let name;
if (media != null) {
const first1 = media.artists[0];
if (first1 != null) {
name = first1.name;
}
}
obj6.subtitle = name;
obj8 = obj6;
} else {
if (tmpResult6.isLaunchedActivityEntry(entry)) {
const obj7 = { title: entry.extra.activity_name };
obj8 = obj7;
} else {
obj8 = { title: "r" };
}
tmpResult6 = tmp(8429);
}
tmpResult5 = tmp(8429);
}
tmpResult4 = tmp(8429);
}
({ title, subtitle } = obj8);
let str;
if (title != null) {
str = title.trim();
}
let trimmed;
if (subtitle != null) {
trimmed = subtitle.trim();
}
const tmp20 = timestampProducer(closure_12, { entry, largeImage, smallImage, title: str, subtitle: trimmed, style: style.style });
const obj9 = { value: analyticsLocations, children: null };
let tmp19Result = tmp20;
if (null != tmp4ResultResult) {
const obj10 = { onPress: callback, accessibilityRole: "button", accessibilityLabel: null, children: null };
const intl = tmp(1114).intl;
if (str == null) {
str = "";
}
const obj11 = { gameName: str };
obj10.accessibilityLabel = intl.formatToPlainString(tmp(1114).t["9sZWVp"], obj11);
obj10.children = tmp20;
tmp19Result = tmp19(tmp(5175).PressableOpacity, obj10);
}
obj9.children = tmp19Result;
return timestampProducer(useAnalyticsLocations.AnalyticsLocationProvider, obj9);
};