diff --git a/projects/website/src/components/score/score-buttons.tsx b/projects/website/src/components/score/score-buttons.tsx index cd7f82d..3d18f34 100644 --- a/projects/website/src/components/score/score-buttons.tsx +++ b/projects/website/src/components/score/score-buttons.tsx @@ -20,7 +20,7 @@ type Props = { beatSaverMap?: BeatSaverMap; alwaysSingleLine?: boolean; setIsLeaderboardExpanded?: (isExpanded: boolean) => void; - setScore?: (score: ScoreSaberScoreToken) => void; + updateScore?: (score: ScoreSaberScoreToken) => void; }; export default function ScoreButtons({ @@ -29,7 +29,7 @@ export default function ScoreButtons({ beatSaverMap, alwaysSingleLine, setIsLeaderboardExpanded, - setScore, + updateScore, }: Props) { const [leaderboardExpanded, setLeaderboardExpanded] = useState(false); const { toast } = useToast(); @@ -84,8 +84,8 @@ export default function ScoreButtons({ className={`flex gap-2 ${alwaysSingleLine ? "flex-row" : "flex-row lg:flex-col"} items-center justify-center`} > {/* Edit score button */} - {score && leaderboard && setScore && ( - + {score && leaderboard && updateScore && ( + )} {/* View Leaderboard button */} diff --git a/projects/website/src/components/score/score-editor-button.tsx b/projects/website/src/components/score/score-editor-button.tsx index c72f257..c71850a 100644 --- a/projects/website/src/components/score/score-editor-button.tsx +++ b/projects/website/src/components/score/score-editor-button.tsx @@ -12,10 +12,10 @@ import Tooltip from "@/components/tooltip"; type ScoreEditorButtonProps = { score: ScoreSaberScoreToken; leaderboard: ScoreSaberLeaderboardToken; - setScore: (score: ScoreSaberScoreToken) => void; + updateScore: (score: ScoreSaberScoreToken) => void; }; -export default function ScoreEditorButton({ score, leaderboard, setScore }: ScoreEditorButtonProps) { +export default function ScoreEditorButton({ score, leaderboard, updateScore }: ScoreEditorButtonProps) { const [isScoreEditMode, setIsScoreEditMode] = useState(false); const maxScore = leaderboard.maxScore || 1; // Use 1 to prevent division by zero @@ -24,14 +24,14 @@ export default function ScoreEditorButton({ score, leaderboard, setScore }: Scor const handleSliderChange = (value: number[]) => { const newAccuracy = Math.max(0, Math.min(value[0], 100)); // Ensure the accuracy stays within 0-100 const newBaseScore = (newAccuracy / 100) * maxScore; - setScore({ + updateScore({ ...score, baseScore: newBaseScore, }); }; const handleSliderReset = () => { - setScore({ + updateScore({ ...score, baseScore: (accuracy / 100) * maxScore, }); diff --git a/projects/website/src/components/score/score.tsx b/projects/website/src/components/score/score.tsx index 57d7f73..8b53f9a 100644 --- a/projects/website/src/components/score/score.tsx +++ b/projects/website/src/components/score/score.tsx @@ -60,7 +60,7 @@ export default function Score({ player, playerScore }: Props) { beatSaverMap={beatSaverMap} score={score} setIsLeaderboardExpanded={setIsLeaderboardExpanded} - setScore={score => { + updateScore={score => { setBaseScore(score.baseScore); }} />