game name activity fix
This commit is contained in:
parent
500b60ffde
commit
ac6aae672d
|
|
@ -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 <><span className="font-bold">{ownerUsername}</span> created a <span className="font-bold">{activity.game}</span> game with a {formattedAmount} entry fee.</>;
|
||||
return <><span className="font-bold">{ownerUsername}</span> created a <span className="font-bold">{gameName}</span> game with a {formattedAmount} entry fee.</>;
|
||||
case "close":
|
||||
return <><span className="font-bold">{ownerUsername}</span> cancelled their <span className="font-bold">{activity.game}</span> game.</>;
|
||||
return <><span className="font-bold">{ownerUsername}</span> cancelled their <span className="font-bold">{gameName}</span> game.</>;
|
||||
case "join":
|
||||
return <><span className="font-bold">{joinerUsername}</span> joined <span className="font-bold">{activity.game}</span> with a {formattedAmount} entry fee.</>;
|
||||
return <><span className="font-bold">{joinerUsername}</span> joined <span className="font-bold">{gameName}</span> with a {formattedAmount} entry fee.</>;
|
||||
case "won":
|
||||
return <><span className="font-bold">{ownerUsername}</span> won {formattedAmount} in <span className="font-bold">{activity.game}</span>!</>;
|
||||
return <><span className="font-bold">{ownerUsername}</span> won {formattedAmount} in <span className="font-bold">{gameName}</span>!</>;
|
||||
default:
|
||||
return "Unknown activity";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user