From ac6aae672d832bc26b192fc7359157d69b658209 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Sat, 31 May 2025 04:18:50 +0530 Subject: [PATCH] game name activity fix --- src/components/Activities.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Activities.tsx b/src/components/Activities.tsx index 4ac5051..390ed3f 100644 --- a/src/components/Activities.tsx +++ b/src/components/Activities.tsx @@ -2,6 +2,7 @@ import Image from "next/image"; import { useState, useEffect } from "react"; import { API_BASE_URL } from "@/data/shared"; import { PlusCircleIcon, XCircleIcon, UserPlusIcon, TrophyIcon } from '@heroicons/react/24/outline'; +import { GetGameByID } from "@/data/games"; interface Activity { id: string; @@ -86,16 +87,17 @@ export default function Activities() { amount = amount * 1.9; } const formattedAmount = amount > 0 ? `${amount} SOL` : ""; - + const gameData = GetGameByID(activity.game); + const gameName = gameData?.name || activity.game; switch (activity.type) { case "create": - return <>{ownerUsername} created a {activity.game} game with a {formattedAmount} entry fee.; + return <>{ownerUsername} created a {gameName} game with a {formattedAmount} entry fee.; case "close": - return <>{ownerUsername} cancelled their {activity.game} game.; + return <>{ownerUsername} cancelled their {gameName} game.; case "join": - return <>{joinerUsername} joined {activity.game} with a {formattedAmount} entry fee.; + return <>{joinerUsername} joined {gameName} with a {formattedAmount} entry fee.; case "won": - return <>{ownerUsername} won {formattedAmount} in {activity.game}!; + return <>{ownerUsername} won {formattedAmount} in {gameName}!; default: return "Unknown activity"; }