// Metro module 11924 (f11925).
import { useCallback, useMemo } from "react";
import { Pressable, View } from "react-native";
import { IGDB_ATTRIBUTION_LINK } from "../../../content_inventory/ContentInventoryConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import Linking from "../../../../lib/native/Linking";
import { getGenreText } from "../../../../utils/SKUUtils";
import { intl, t } from "../../../../intl/index.native";
import { GameCompanyRole } from "../../../../flow/Server";
import { dateFormat } from "../../../../utils/DateUtils";
import { GameUpdatePlatformIcon } from "../../../game_update/native/GameUpdatePlatformIcon";
import getGameProfileWebsiteData from "../utils/getGameProfileWebsiteData";
import { Text } from "../../../../design/components/Text/native/Text";
let useStyles;
const GameProfileWebsiteButton = function GameProfileWebsiteButton(props) {
const { icon, action, title, trackAction, url } = props;
return {
Linking.openURL(url);
trackAction(action);
}, [trackAction, action, url])} hitSlop={Module712.space.PX_4}>{icon};
};
useStyles = createStyles({
container: {
gap: Module712.space.PX_8
},
headerText: {
paddingHorizontal: Module712.space.PX_8
},
detailsContainer: {
borderRadius: Module712.radii.lg,
borderWidth: 1,
borderColor: Module712.colors.BORDER_SUBTLE,
overflow: "hidden",
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW
},
detailsRow: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
padding: Module712.space.PX_12
},
detailsRowValue: {
flexDirection: "column",
flexShrink: 1,
paddingLeft: Module712.space.PX_32
},
detailsRowBottomBorder: {
borderBottomWidth: 1,
borderBottomColor: Module712.colors.BORDER_SUBTLE
},
platformsContainer: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_12
},
linksContainer: {
flexDirection: "row",
alignItems: "center",
gap: Module712.space.PX_12
}
});
export default function GameProfileDetails(props) {
const { game, trackAction: trackAction2 } = props;
const styles = useStyles();
const memo = useMemo(() => {
if (game == null) {
return [];
}
const value = game == null ? void 0 : game.genres.map(getGenreText).join(", ");
const r26 = value != null && value !== "";
const r28 = [];
if (r26) {
r28.push({
label: game.genres.length !== 1 ? intl.string(t.pDgwYB) : intl.string(t.mjFKqn),
value
});
}
const r59 = game == null ? void 0 : game.getCompanyByRole(GameCompanyRole.PUBLISHER);
const value2 = r59.map((item) => item.name).join(", ");
if (value2 != null && value2 !== "") {
r28.push({
label: r59.length !== 1 ? intl.string(t.Hc7Enk) : intl.string(t["4Byy/G"]),
value: value2
});
}
const r108 = game == null ? void 0 : game.getCompanyByRole(GameCompanyRole.DEVELOPER);
const value3 = r108.map((item) => item.name).join(", ");
if (value3 != null && value3 !== "") {
r28.push({
label: r108.length !== 1 ? intl.string(t.KATEJB) : intl.string(t.na3PT0),
value: value3
});
}
const firstReleaseDate = game?.firstReleaseDate;
if (firstReleaseDate != null && firstReleaseDate !== "") {
r28.push({
label: intl.string(t.H3mPDT),
value: dateFormat(new Date(firstReleaseDate), "LL")
});
}
const platforms = game?.platforms;
if (platforms != null && platforms.length > 0) {
r28.push({
label: game.platforms.length !== 1 ? intl.string(t.PNqxNe) : intl.string(t["UxAag+"]),
value:
{platforms.map((a0) => )}
});
}
const r237 = game == null;
let r238 = void 0;
if (!r237) {
const websites = game.websites;
r238 = websites == null ? void 0 : websites.map((website) => getGameProfileWebsiteData(website, Module712.colors.ICON_SUBTLE)).filter((item) => item != null);
}
if (r238 == null) {
r238 = [];
}
if (r238 != null && r238.length > 0) {
r28.push({
label: intl.string(t["Oj3o1/"]),
value:
{r238.map(({ title, icon, action: action2, url: url2 }) => )}
});
}
if (r28.length > 0) {
r28.push({
label: intl.string(t["BwQ+9e"]),
value: intl.format(t.XPFZVl, {
igdbLink: IGDB_ATTRIBUTION_LINK
})
});
}
return r28;
}, [styles.linksContainer, styles.platformsContainer, game, trackAction2]);
return memo.length !== 0 ?
{intl.string(t["7OjmmH"])}
{memo.map((item, index) => 1 ? index < memo.length - 1 ? styles.detailsRowBottomBorder : null : null]}>
{item.label}
{typeof item.value === "string" ? {item.value} : item.value}
)}
: null;
};