Fix the issue with some games not having platforms

This commit is contained in:
Mosh Hamedani 2023-03-29 09:01:52 -04:00
parent c128ebd4d7
commit a633036e64
2 changed files with 2 additions and 2 deletions

View file

@ -16,7 +16,7 @@ const GameCard = ({ game }: Props) => {
<Image src={getCroppedImageUrl(game.background_image)} /> <Image src={getCroppedImageUrl(game.background_image)} />
<CardBody> <CardBody>
<HStack justifyContent='space-between' marginBottom={3}> <HStack justifyContent='space-between' marginBottom={3}>
<PlatformIconList platforms={game.parent_platforms.map(p => p.platform)} /> <PlatformIconList platforms={game.parent_platforms?.map(p => p.platform)} />
<CriticScore score={game.metacritic} /> <CriticScore score={game.metacritic} />
</HStack> </HStack>
<Heading fontSize='2xl'>{game.name}<Emoji rating={game.rating_top}/></Heading> <Heading fontSize='2xl'>{game.name}<Emoji rating={game.rating_top}/></Heading>

View file

@ -17,7 +17,7 @@ interface Props {
platforms: Platform[]; platforms: Platform[];
} }
const PlatformIconList = ({ platforms }: Props) => { const PlatformIconList = ({ platforms = [] }: Props) => {
const iconMap: { [key: string]: IconType } = { const iconMap: { [key: string]: IconType } = {
pc: FaWindows, pc: FaWindows,
playstation: FaPlaystation, playstation: FaPlaystation,