Files
discord-decomp/modules/game_profile/native/components/GameProfileView.tsx
T
2026-11-01 12:12:55 +02:00

85 lines
4.2 KiB
TypeScript

// Metro module 8515 (f8516).
import { useRef, useCallback } from "react";
import { View } from "react-native";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../../app_analytics/AnalyticsLocation";
import GameProfileHeader from "./GameProfileHeader";
import GameProfileMedia from "./GameProfileMedia";
import GameProfileStoreLinks from "./GameProfileStoreLinks";
import GameProfileReviews from "./GameProfileReviews";
import GameProfileSummary from "./GameProfileSummary";
import GameProfileLinkAccount from "./GameProfileLinkAccount";
import GameProfileCommunity from "./GameProfileCommunity";
import GameProfileAnnouncements from "./GameProfileAnnouncements";
import GameProfileShopCarousel from "./GameProfileShopCarousel";
import GameProfileSimilarGames from "./GameProfileSimilarGames";
import GameProfileDetails from "./GameProfileDetails";
import GameProfileGameClaimCta from "./GameProfileGameClaimCta";
import GameProfileReportButton from "./GameProfileReportButton";
const useStyles = createStyles({
container: {
flex: 1,
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST,
paddingBottom: Module712.space.PX_16
},
body: {
flexDirection: "column",
paddingVertical: Module712.space.PX_16,
paddingHorizontal: Module712.space.PX_16,
gap: Module712.space.PX_32,
maxWidth: 520,
alignSelf: "center",
width: "100%"
},
buttonsContainer: {
flexDirection: "column",
gap: Module712.space.PX_8
}
});
export default function GameProfileView(props) {
const { game, invite, viewId, source, trackAction, onGuildInviteResolved, closeModal, scrollY, websiteButtons, onStoreLinksMeasured, onHeaderHeightMeasured, scrollOffsetRef } = props;
const styles = useStyles();
const ref = useRef(null);
const ref2 = useRef(null);
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.GAME_PROFILE).analyticsLocations;
const callback = useCallback(() => {
const current = ref.current;
const current2 = ref2.current;
if (current != null && current2 != null && onStoreLinksMeasured != null) {
onStoreLinksMeasured(current + current2);
}
}, [onStoreLinksMeasured]);
return <AnalyticsLocationProvider value={analyticsLocations}>
<View style={styles.container}>
<GameProfileHeader game={game} scrollY={scrollY} onHeightMeasured={onHeaderHeightMeasured} />
<View style={styles.body} onLayout={(event) => {
ref.current = event.nativeEvent.layout.y;
callback();
}}>
<GameProfileMedia game={game} viewId={viewId} source={source} trackAction={trackAction} />
{websiteButtons.length > 0 && <View onLayout={(event) => {
const layout = event.nativeEvent.layout;
ref2.current = layout.y + layout.height;
callback();
}}>
<GameProfileStoreLinks game={game} websiteButtons={websiteButtons} trackAction={trackAction} />
</View>}
<GameProfileReviews game={game} trackAction={trackAction} />
<GameProfileSummary game={game} viewId={viewId} source={source} trackAction={trackAction} />
<GameProfileLinkAccount game={game} analyticsLocations={analyticsLocations} trackAction={trackAction} />
<GameProfileCommunity closeModal={closeModal} game={game} onInviteResolved={onGuildInviteResolved} trackAction={trackAction} />
<GameProfileAnnouncements gameId={game.id} invite={invite} closeModal={closeModal} trackAction={trackAction} scrollOffsetRef={scrollOffsetRef} />
<GameProfileShopCarousel game={game} closeModal={closeModal} trackAction={trackAction} />
<GameProfileSimilarGames gameId={game.id} trackAction={trackAction} />
<GameProfileDetails game={game} viewId={viewId} source={source} trackAction={trackAction} />
<View style={styles.buttonsContainer}>
<GameProfileGameClaimCta game={game} trackAction={trackAction} />
<GameProfileReportButton applicationId={game.id} trackAction={trackAction} />
</View>
</View>
</View>
</AnalyticsLocationProvider>;
};