diff --git a/src/components/leaderboard/leaderboard-scores.tsx b/src/components/leaderboard/leaderboard-scores.tsx index 1f71c4e..780cfb3 100644 --- a/src/components/leaderboard/leaderboard-scores.tsx +++ b/src/components/leaderboard/leaderboard-scores.tsx @@ -5,8 +5,8 @@ import ScoreSaberLeaderboard from "@/common/data-fetcher/types/scoresaber/scores import ScoreSaberLeaderboardScoresPage from "@/common/data-fetcher/types/scoresaber/scoresaber-leaderboard-scores-page"; import useWindowDimensions from "@/hooks/use-window-dimensions"; import { useQuery } from "@tanstack/react-query"; -import { motion, useAnimation } from "framer-motion"; -import { useCallback, useEffect, useState } from "react"; +import { motion } from "framer-motion"; +import { useEffect, useState } from "react"; import Card from "../card"; import Pagination from "../input/pagination"; import LeaderboardScore from "./leaderboard-score"; @@ -17,7 +17,6 @@ type Props = { export default function LeaderboardScores({ leaderboard }: Props) { const { width } = useWindowDimensions(); - const controls = useAnimation(); const [currentPage, setCurrentPage] = useState(1); const [currentScores, setCurrentScores] = useState(); @@ -33,23 +32,12 @@ export default function LeaderboardScores({ leaderboard }: Props) { staleTime: 30 * 1000, // Cache data for 30 seconds }); - const handleAnimation = useCallback(() => { - controls.set({ x: -50, opacity: 0 }); - controls.start({ x: 0, opacity: 1, transition: { duration: 0.25 } }); - }, [controls]); - useEffect(() => { if (scores) { setCurrentScores(scores); } }, [scores]); - useEffect(() => { - if (scores) { - handleAnimation(); - } - }, [scores, handleAnimation]); - useEffect(() => { refetch(); }, [leaderboard, currentPage, refetch]); @@ -59,27 +47,27 @@ export default function LeaderboardScores({ leaderboard }: Props) { } return ( - -
- {isError &&

Oopsies! Something went wrong.

} - {currentScores.scores.length === 0 &&

No scores found. Invalid Page?

} -
+ + +
+ {isError &&

Oopsies! Something went wrong.

} + {currentScores.scores.length === 0 &&

No scores found. Invalid Page?

} +
-
{currentScores.scores.map((playerScore, index) => ( ))}
-
- -
+ +
+ ); }