"use client"; import Image from "next/image"; import { useEffect, useRef } from "react"; import type { GamePricePoint, GameProfile } from "@/lib/game/game-profile-types"; import { describeProfile, discountPercent, formatCount, formatPrice, formatRatingPercent, localizeScore, type ModalDict, } from "@/lib/game/game-format"; import { steamdbAppUrl } from "@/lib/game/discord-app"; export function ModalReviews({ profile, dict, localeTag, }: { profile: GameProfile; dict: ModalDict; localeTag: string; }) { const { dbRating, hasReviews, metascore, opencritic } = describeProfile(profile); if (!hasReviews) { return null; } const steamdbRating: { score: number; url: string } | null = dbRating != null && profile.steamId ? { score: dbRating, url: steamdbAppUrl(profile.steamId) } : null; return (
{dict.reviews}
{dict.totalReviews}
{localizeScore(profile.steamReviews.label, dict)}
{formatCount(profile.steamReviews.total, localeTag, dict.reviewsUnit)}
) : null} {steamdbRating ? ({dict.steamdbRating}
{formatRatingPercent(steamdbRating.score, localeTag)}
steamdb.info ↗
) : null} {metascore ? (Metacritic
{metascore.score ?? "—"} {metascore.score != null ? ( /100 ) : null}
{formatCount(metascore.count, localeTag, dict.reviewsUnit)}
) : null} {opencritic ? (OpenCritic
{opencritic.score ?? "—"} {opencritic.score != null ? ( /100 ) : null}
{formatCount(opencritic.count, localeTag, dict.reviewsUnit)}
) : null}{dict.prices}
{isFree ? ({dict.free}
) : ({dict.bestPrice} · {bestPrice.shop}
{formatPrice(bestPrice, localeTag)}{" "} {discountPercent(bestPrice) ? ( -%{discountPercent(bestPrice)} ) : null}
) : null} {historyLow ? ({dict.historyLow} · {historyLow.shop}
{formatPrice(historyLow, localeTag)}
{dict.screenshots}