-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: auto switch theme behavior & footer theme indicator #4677
Conversation
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/6342827952 |
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/6343959925 |
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/6344000764 |
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/6344247626 |
frontend/src/ts/config.ts
Outdated
export function setAutoSwitchThemeOff(): void { | ||
if (!config.autoSwitchTheme) return; | ||
config.autoSwitchTheme = false; | ||
saveToLocalStorage("autoSwitchTheme", undefined); | ||
ConfigEvent.dispatch("autoSwitchTheme", config.autoSwitchTheme); | ||
Notifications.add("Auto switch theme disabled", 0); | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why add this? Why not just call setAutoSwitchTheme(false)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using that was causing RangeError: Maximum call stack size exceeded
causing it to crash, can't really figure out why but maybe it somehow ends up recursively calling itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was looping because you are setting autoswitchtheme to off when reacting to autoswitchtheme being changed to off. I added a check where its only set to off if its already on, and its all good.
Changing manually to a preset or custom theme now turns auto switch theme mode off with a notification. And now the auto switch mode does override the custom theme as well (statement in settings also updated) if it is the later one set. Fixes monkeytypegame#4659, that is the footer theme is now correctly displayed with auto switch themes as well.
…, miodec) (#4677) * fix: auto switch theme behavior & footer indicator Changing manually to a preset or custom theme now turns auto switch theme mode off with a notification. And now the auto switch mode does override the custom theme as well (statement in settings also updated) if it is the later one set. Fixes #4659, that is the footer theme is now correctly displayed with auto switch themes as well. * removed unnecessary function --------- Co-authored-by: Miodec <jack@monkeytype.com>
* Add files via upload * Delete frontend/static/sound/error/triangle.wav * Delete frontend/static/sound/error/damage.wav * modified error sound code to support multiple sound options and added two error sound alternatives * added compatability for previous users of the error sound, converts legacy true/false config values to 1 or off * fixed opiton names and values in commandline * fix: auto switch theme behavior & footer theme indicator (#4677) * fix: auto switch theme behavior & footer indicator Changing manually to a preset or custom theme now turns auto switch theme mode off with a notification. And now the auto switch mode does override the custom theme as well (statement in settings also updated) if it is the later one set. Fixes #4659, that is the footer theme is now correctly displayed with auto switch themes as well. * removed unnecessary function --------- Co-authored-by: Miodec <jack@monkeytype.com> * fixed off config value * moved compatibilty code to replaceLegacyValues --------- Co-authored-by: Sanidhya Singh <sanidhyas3s@gmail.com> Co-authored-by: Miodec <jack@monkeytype.com>
@Miodec You removed the notification as well with the function, shall I add that in a new PR? |
Yeah, sure |
Changing manually to a preset or custom theme now turns auto switch theme mode off with a notification. And now the auto switch mode does override the custom theme as well (statement in settings also updated), priority simply given to the last way theme was modified.
Fixes Autoswitch theme causing the footer theme indicator to show wrong theme #4659, that is the footer theme is now correctly displayed with auto switch themes as well.