diff --git a/src/app/ranking/country/[country]/page.tsx b/src/app/ranking/country/[country]/page.tsx index fbfa8fd..7e9014b 100644 --- a/src/app/ranking/country/[country]/page.tsx +++ b/src/app/ranking/country/[country]/page.tsx @@ -6,9 +6,11 @@ import Error from "@/components/Error"; import Pagination from "@/components/Pagination"; import { Spinner } from "@/components/Spinner"; import PlayerRanking from "@/components/player/PlayerRanking"; +import PlayerRankingMobile from "@/components/player/PlayerRankingMobile"; import { ScoresaberPlayer } from "@/schemas/scoresaber/player"; import { fetchTopPlayers } from "@/utils/scoresaber/api"; import { normalizedRegionName } from "@/utils/utils"; +import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; import { useCallback, useEffect, useState } from "react"; import ReactCountryFlag from "react-country-flag"; @@ -127,7 +129,7 @@ export default function RankingCountry({ params }: RankingCountryProps) {

- +
@@ -146,21 +148,34 @@ export default function RankingCountry({ params }: RankingCountryProps) { ))}
Rank
+ +
+ {players.map((player) => ( +
+ + + +
+ ))} +
+ + {/* Pagination */} +
+
+ { + updatePage(page); + }} + /> +
+
)} - - {/* Pagination */} -
-
- { - updatePage(page); - }} - /> -
-
diff --git a/src/app/ranking/global/page.tsx b/src/app/ranking/global/page.tsx index 30ff854..43a19d4 100644 --- a/src/app/ranking/global/page.tsx +++ b/src/app/ranking/global/page.tsx @@ -6,9 +6,11 @@ import Error from "@/components/Error"; import Pagination from "@/components/Pagination"; import { Spinner } from "@/components/Spinner"; import PlayerRanking from "@/components/player/PlayerRanking"; +import PlayerRankingMobile from "@/components/player/PlayerRankingMobile"; import { ScoresaberPlayer } from "@/schemas/scoresaber/player"; import { fetchTopPlayers } from "@/utils/scoresaber/api"; import { GlobeAsiaAustraliaIcon } from "@heroicons/react/20/solid"; +import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; import { useCallback, useEffect, useState } from "react"; @@ -113,7 +115,7 @@ export default function RankingGlobal() {

You are viewing Global scores

- +
@@ -132,21 +134,34 @@ export default function RankingGlobal() { ))}
Rank
+ +
+ {players.map((player) => ( +
+ + + +
+ ))} +
+ + {/* Pagination */} +
+
+ { + updatePage(page); + }} + /> +
+
)} - - {/* Pagination */} -
-
- { - updatePage(page); - }} - /> -
-
diff --git a/src/components/player/PlayerRankingMobile.tsx b/src/components/player/PlayerRankingMobile.tsx new file mode 100644 index 0000000..46ee1ee --- /dev/null +++ b/src/components/player/PlayerRankingMobile.tsx @@ -0,0 +1,58 @@ +import { ScoresaberPlayer } from "@/schemas/scoresaber/player"; +import { useSettingsStore } from "@/store/settingsStore"; +import { formatNumber } from "@/utils/number"; +import ReactCountryFlag from "react-country-flag"; +import { useStore } from "zustand"; +import Avatar from "../Avatar"; +import Label from "../Label"; + +type PlayerRankingProps = { + player: ScoresaberPlayer; + showCountryFlag?: boolean; +}; + +export default function PlayerRankingMobile({ + player, + showCountryFlag = true, +}: PlayerRankingProps) { + const settingsStore = useStore(useSettingsStore, (store) => store); + + return ( +
+
+

+

#{formatNumber(player.rank)}

+ + {showCountryFlag && ( + + )} +

+ {player.name} +

+

+
+
+
+
+ ); +}