diff --git a/src/components/leaderboard/leaderboard-player.tsx b/src/components/leaderboard/leaderboard-player.tsx index 1e59718..67362e6 100644 --- a/src/components/leaderboard/leaderboard-player.tsx +++ b/src/components/leaderboard/leaderboard-player.tsx @@ -1,19 +1,28 @@ +import ScoreSaberPlayer from "@/common/model/player/impl/scoresaber-player"; import ScoreSaberScoreToken from "@/common/model/token/scoresaber/score-saber-score-token"; import Image from "next/image"; import Link from "next/link"; type Props = { + /** + * The claimed player. + */ + player: ScoreSaberPlayer; + + /** + * The score to display. + */ score: ScoreSaberScoreToken; }; -export default function LeaderboardPlayer({ score }: Props) { - const player = score.leaderboardPlayerInfo; +export default function LeaderboardPlayer({ player, score }: Props) { + const scorePlayer = score.leaderboardPlayerInfo; return (
Song Artwork -

{player.name}

+

{scorePlayer.name}

); diff --git a/src/components/leaderboard/leaderboard-score.tsx b/src/components/leaderboard/leaderboard-score.tsx index f7fbec8..93378fa 100644 --- a/src/components/leaderboard/leaderboard-score.tsx +++ b/src/components/leaderboard/leaderboard-score.tsx @@ -5,8 +5,14 @@ import ScoreSaberScoreToken from "@/common/model/token/scoresaber/score-saber-sc import LeaderboardPlayer from "./leaderboard-player"; import LeaderboardScoreStats from "./leaderboard-score-stats"; import ScoreRankInfo from "@/components/score/score-rank-info"; +import ScoreSaberPlayer from "@/common/model/player/impl/scoresaber-player"; type Props = { + /** + * The claimed player. + */ + player: ScoreSaberPlayer; + /** * The score to display. */ @@ -18,12 +24,12 @@ type Props = { leaderboard: ScoreSaberLeaderboardToken; }; -export default function LeaderboardScore({ score, leaderboard }: Props) { +export default function LeaderboardScore({ player, score, leaderboard }: Props) { return (
- +
diff --git a/src/components/leaderboard/leaderboard-scores.tsx b/src/components/leaderboard/leaderboard-scores.tsx index 0f5bf57..7a57a22 100644 --- a/src/components/leaderboard/leaderboard-scores.tsx +++ b/src/components/leaderboard/leaderboard-scores.tsx @@ -11,17 +11,23 @@ import Card from "../card"; import Pagination from "../input/pagination"; import LeaderboardScore from "./leaderboard-score"; import { scoreAnimation } from "@/components/score/score-animation"; +import ScoreSaberPlayer from "@/common/model/player/impl/scoresaber-player"; type LeaderboardScoresProps = { + initialPage?: number; + player: ScoreSaberPlayer; leaderboard: ScoreSaberLeaderboardToken; }; -export default function LeaderboardScores({ leaderboard }: LeaderboardScoresProps) { +export default function LeaderboardScores({ initialPage, player, leaderboard }: LeaderboardScoresProps) { + if (!initialPage) { + initialPage = 1; + } const { width } = useWindowDimensions(); const controls = useAnimation(); - const [previousPage, setPreviousPage] = useState(1); - const [currentPage, setCurrentPage] = useState(1); + const [previousPage, setPreviousPage] = useState(initialPage); + const [currentPage, setCurrentPage] = useState(initialPage); const [currentScores, setCurrentScores] = useState(); const topOfScoresRef = useRef(null); @@ -98,7 +104,7 @@ export default function LeaderboardScores({ leaderboard }: LeaderboardScoresProp > {currentScores.scores.map((playerScore, index) => ( - + ))} diff --git a/src/components/player/player-scores.tsx b/src/components/player/player-scores.tsx index fffe8fc..d4542de 100644 --- a/src/components/player/player-scores.tsx +++ b/src/components/player/player-scores.tsx @@ -205,7 +205,7 @@ export default function PlayerScores({ initialScoreData, initialSearch, player, > {currentScores.playerScores.map((playerScore, index) => ( - + ))} diff --git a/src/components/score/score.tsx b/src/components/score/score.tsx index dd3f544..2abcc5a 100644 --- a/src/components/score/score.tsx +++ b/src/components/score/score.tsx @@ -9,15 +9,21 @@ import ScoreButtons from "./score-buttons"; import ScoreSongInfo from "./score-info"; import ScoreRankInfo from "./score-rank-info"; import ScoreStats from "./score-stats"; +import ScoreSaberPlayer from "@/common/model/player/impl/scoresaber-player"; type Props = { + /** + * The claimed player + */ + player: ScoreSaberPlayer; + /** * The score to display. */ playerScore: ScoreSaberPlayerScoreToken; }; -export default function Score({ playerScore }: Props) { +export default function Score({ player, playerScore }: Props) { const { score, leaderboard } = playerScore; const [beatSaverMap, setBeatSaverMap] = useState(); const [isLeaderboardExpanded, setIsLeaderboardExpanded] = useState(false); @@ -31,6 +37,7 @@ export default function Score({ playerScore }: Props) { fetchBeatSaverData(); }, [fetchBeatSaverData]); + const page = Math.floor(score.rank / 12) + 1; return (
- {isLeaderboardExpanded && } + {isLeaderboardExpanded && }
); }