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 { useState, useEffect } from "react";
|
||||||
import { API_BASE_URL } from "@/data/shared";
|
import { API_BASE_URL } from "@/data/shared";
|
||||||
import { PlusCircleIcon, XCircleIcon, UserPlusIcon, TrophyIcon } from '@heroicons/react/24/outline';
|
import { PlusCircleIcon, XCircleIcon, UserPlusIcon, TrophyIcon } from '@heroicons/react/24/outline';
|
||||||
|
import { GetGameByID } from "@/data/games";
|
||||||
|
|
||||||
interface Activity {
|
interface Activity {
|
||||||
id: string;
|
id: string;
|
||||||
|
|
@ -86,16 +87,17 @@ export default function Activities() {
|
||||||
amount = amount * 1.9;
|
amount = amount * 1.9;
|
||||||
}
|
}
|
||||||
const formattedAmount = amount > 0 ? `${amount} SOL` : "";
|
const formattedAmount = amount > 0 ? `${amount} SOL` : "";
|
||||||
|
const gameData = GetGameByID(activity.game);
|
||||||
|
const gameName = gameData?.name || activity.game;
|
||||||
switch (activity.type) {
|
switch (activity.type) {
|
||||||
case "create":
|
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":
|
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":
|
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":
|
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:
|
default:
|
||||||
return "Unknown activity";
|
return "Unknown activity";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user