Skip to content

Commit

Permalink
Save their preference about showing the seek graph
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenAsJade committed Nov 24, 2024
1 parent 5cc7f1d commit 909add7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/lib/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export const defaults = {
"show-move-numbers": true,
"show-offline-friends": true,
"show-ratings-in-rating-grid": false,
"show-seek-graph": false,

"show-tournament-indicator": true, // implicitly on desktop
"show-tournament-indicator-on-mobile": false,
Expand Down
6 changes: 4 additions & 2 deletions src/views/Play/CustomGames.styl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
}


// This shenanigans is needed to ensure that the canvas of the seek graph
// remains rendered, so we don't loose the reference we have to it.
.seek-graph-container.hidden {
clip-path: inset(0 100% 100% 0); /* Clip the entire element */
position: absolute; /* Remove it from the layout */
Expand All @@ -70,12 +72,12 @@
position: static; /* Return to normal layout */
}
}

.Modal {
border: none;
box-shadow: none;
}

.ChallengeModal {
width: 100%;
max-height: unset;
Expand Down
5 changes: 3 additions & 2 deletions src/views/Play/CustomGames.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as preferences from "@/lib/preferences";
import * as player_cache from "@/lib/player_cache";
import * as rengo_utils from "@/lib/rengo_utils";

import { usePreference } from "@/lib/preferences";
import { del } from "@/lib/requests";
import { alert } from "@/lib/swal_config";
import { OgsResizeDetector } from "@/components/OgsResizeDetector";
Expand Down Expand Up @@ -74,10 +75,10 @@ export function CustomGames(): JSX.Element {
const canvas: HTMLCanvasElement = React.useMemo(() => allocateCanvasOrError(), []);
const seekgraph = React.useRef<SeekGraph>();

const [seekGraphVisible, setSeekGraphVisible] = React.useState(false);
const [seekGraphVisible, setSeekGraphVisible] = usePreference("show-seek-graph");

const toggleSeekGraph = () => {
setSeekGraphVisible((prev) => !prev);
setSeekGraphVisible(!seekGraphVisible);
};

// Used to not change the challenge list while they are trying to point the mouse at it
Expand Down

0 comments on commit 909add7

Please sign in to comment.