Skip to content

Commit

Permalink
add ability to jump to current round
Browse files Browse the repository at this point in the history
  • Loading branch information
diceroll123 committed Sep 30, 2024
1 parent acfb56c commit 1547c28
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ function MaxBetInput() {
}

function TitleHeading(props) {
const { setRoundState } = useContext(RoundContext);
const { setRoundState, roundState } = useContext(RoundContext);

return (
<>
Expand All @@ -239,6 +239,16 @@ function TitleHeading(props) {

// scroll to top
window.scrollTo({ top: 0, behavior: "smooth" });

if (
window.scrollY === 0 &&
roundState.currentSelectedRound !== roundState.currentRound
) {
// TODO MAYBE: add a confirmation dialog?
setRoundState({
currentSelectedRound: roundState.currentRound,
});
}
}}
>
<Center>
Expand Down

0 comments on commit 1547c28

Please sign in to comment.