always show country flags in ranking pages
All checks were successful
deploy / deploy (push) Successful in 2m3s

This commit is contained in:
Lee 2023-11-27 01:03:27 +00:00
parent 3b7f458d5c
commit 9e73ff3937
2 changed files with 6 additions and 10 deletions

@ -57,7 +57,7 @@ export default function GlobalRanking({
{players.map((player) => ( {players.map((player) => (
<tr key={player.rank} className="border-b border-border"> <tr key={player.rank} className="border-b border-border">
<PlayerRanking <PlayerRanking
showCountryFlag={country == undefined ? false : true} isCountry={country == undefined ? false : true}
player={player} player={player}
/> />
</tr> </tr>

@ -8,30 +8,26 @@ import CountyFlag from "../CountryFlag";
type PlayerRankingProps = { type PlayerRankingProps = {
player: ScoresaberPlayer; player: ScoresaberPlayer;
showCountryFlag?: boolean; isCountry?: boolean;
}; };
const Avatar = dynamic(() => import("@/components/Avatar")); const Avatar = dynamic(() => import("@/components/Avatar"));
export default function PlayerRanking({ export default function PlayerRanking({
player, player,
showCountryFlag, isCountry,
}: PlayerRankingProps) { }: PlayerRankingProps) {
const settingsStore = useStore(useSettingsStore, (store) => store); const settingsStore = useStore(useSettingsStore, (store) => store);
return ( return (
<> <>
<td className="px-4 py-2"> <td className="px-4 py-2">
#{formatNumber(showCountryFlag ? player.countryRank : player.rank)}{" "} #{formatNumber(isCountry ? player.countryRank : player.rank)}{" "}
<span className="text-sm"> <span className="text-sm">{isCountry && "(#" + player.rank + ")"}</span>
{showCountryFlag && "(#" + player.rank + ")"}
</span>
</td> </td>
<td className="flex items-center gap-2 px-4 py-2"> <td className="flex items-center gap-2 px-4 py-2">
<Avatar url={player.profilePicture} label="Avatar" size={24} /> <Avatar url={player.profilePicture} label="Avatar" size={24} />
{showCountryFlag && (
<CountyFlag countryCode={player.country} className="!h-5 !w-5" /> <CountyFlag countryCode={player.country} className="!h-5 !w-5" />
)}
<Link <Link
className="transform-gpu transition-all hover:text-blue-500" className="transform-gpu transition-all hover:text-blue-500"
href={`/player/${player.id}/top/1`} href={`/player/${player.id}/top/1`}