// Metro module 11922 (f11923).
import { useCallback } from "react";
import { Image as Image2, Pressable, View } from "react-native";
import Module712 from "../../../../_bundle/Module712";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import useShouldOpenGameProfileModal from "../../hooks/useShouldOpenGameProfileModal";
import { GameProfileSources, GameProfileTrackActionActions } from "../../GameProfileAnalyticUtils";
import GameProfileActionCreators_native from "../../GameProfileActionCreators.native";
import { intl, t } from "../../../../intl/index.native";
import { Text } from "../../../../design/components/Text/native/Text";
import { GameProfileSimilarGamesMobileExperiment } from "../../SimilarGamesExperiments";
import useSimilarGames from "../../hooks/useSimilarGames";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import { FlashList } from "../../../../_bundle/noop_6676";
let PX_12, PX_16, PX_122, useStyles, ListPadding, SimilarGameCard, LoadingCard;
const Spacer = function Spacer() {
return ;
};
ListPadding = function ListPadding() {
return ;
};
SimilarGameCard = function SimilarGameCard(props) {
const { game, trackAction, cardWidth: cardWidth2 } = props;
const styles = useStyles();
const height = 1.34 * cardWidth2;
const coverURL = game.getCoverURL(Math.ceil(height));
const r10 = {
width: cardWidth2,
height
};
const shouldOpenGameProfileModal = useShouldOpenGameProfileModal({
gameId: game.id,
source: GameProfileSources.SimilarGames
});
const { shouldOpenGameProfile, gameId } = shouldOpenGameProfileModal;
return {
trackAction(GameProfileTrackActionActions.ClickSimilarGame, game.id);
let r14 = shouldOpenGameProfile;
if (shouldOpenGameProfile) {
r14 = gameId != null;
}
if (r14) {
GameProfileActionCreators_native.openGameProfileModal({
gameId,
gameProfileModalChecks: {
shouldOpenGameProfile: true,
gameId
},
source: GameProfileSources.SimilarGames
});
}
}, [game.id, trackAction, shouldOpenGameProfile, gameId])} accessibilityRole="button" accessibilityLabel={intl.formatToPlainString(t["8QLQB+"], {
gameName: game.name
})}>
{coverURL != null ? :
{game.name}
}
;
};
LoadingCard = function LoadingCard(props) {
const cardWidth2 = props.cardWidth;
return
;
};
PX_12 = Module712.space.PX_12;
PX_16 = Module712.space.PX_16;
PX_122 = Module712.space.PX_12;
useStyles = createStyles({
container: {
gap: Module712.space.PX_8,
marginHorizontal: -1 * Module712.space.PX_16
},
header: {
paddingHorizontal: Module712.space.PX_16
},
card: {
gap: Module712.space.PX_4
},
coverArt: {
borderRadius: Module712.radii.sm
},
coverArtFallback: {
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
justifyContent: "center",
alignItems: "center",
padding: Module712.space.PX_8
},
loadingArt: {
borderRadius: Module712.radii.sm,
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
}
});
export default function GameProfileSimilarGames(props) {
const { gameId: gameId2, trackAction: trackAction2 } = props;
const styles = useStyles();
const config = GameProfileSimilarGamesMobileExperiment.useConfig({
location: "GameProfileSimilarGames"
});
const { enabled, dense } = config;
const similarGames2 = useSimilarGames(gameId2, enabled);
const { isFetching, similarGames } = similarGames2;
const length = dense ? 4 : 3;
const cardWidth = (useWindowDimensions_native().width - 2 * PX_16 - (length - 1) * PX_12 - PX_122) / length;
const data = Array.from({
length
}, (a0, a1) => a1);
return isFetching ?
{intl.string(t["6rLyQB"])}
} showsHorizontalScrollIndicator={false} ItemSeparatorComponent={Spacer} ListHeaderComponent={ListPadding} ListFooterComponent={ListPadding} />
: similarGames.length !== 0 ?
{intl.string(t["6rLyQB"])}
} showsHorizontalScrollIndicator={false} ItemSeparatorComponent={Spacer} ListHeaderComponent={ListPadding} ListFooterComponent={ListPadding} decelerationRate="fast" snapToInterval={cardWidth + PX_12} />
: null;
};