Skip to content
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

[GH-3463]: Added commands to add/remove the current theme to favorites #3682

Merged
merged 7 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/src/ts/commandline/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import ResultSavingCommands from "./lists/result-saving";
import NavigationCommands from "./lists/navigation";
import FontSizeCommands from "./lists/font-size";
import ResultScreenCommands from "./lists/result-screen";
import AddThemeToFavorite from "./lists/add-theme-to-favorite";

import TagsCommands from "./lists/tags";
import CustomThemesListCommands from "./lists/custom-themes-list";
Expand Down Expand Up @@ -248,6 +249,7 @@ export const commands: MonkeyTypes.CommandsSubgroup = {
...CustomThemesListCommands,
...FlipTestColorsCommands,
...ColorfulModeCommands,
...AddThemeToFavorite,
{
id: "changeCustomBackground",
display: "Custom background...",
Expand Down
20 changes: 20 additions & 0 deletions frontend/src/ts/commandline/lists/add-theme-to-favorite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Config, * as UpdateConfig from "../../config";

const commands: MonkeyTypes.Command[] = [
{
id: "addThemeToFavorite",
display: "Add current theme to favorite...",
icon: "fa-heart",
exec: (): void => {
const { theme, favThemes } = Config;
console.log(theme);
if (favThemes.includes(theme)) {
UpdateConfig.setFavThemes([...favThemes.filter((t) => t !== theme)]);
} else {
UpdateConfig.setFavThemes([...favThemes, theme]);
}
},
},
];

export default commands;