feat: implement custom theme management

This commit is contained in:
Hachi-R
2025-01-24 15:27:46 -03:00
parent 6bf049d136
commit 58f63cab44
12 changed files with 95 additions and 0 deletions

View File

@@ -74,6 +74,10 @@ import "./cloud-save/upload-save-game";
import "./cloud-save/delete-game-artifact";
import "./cloud-save/select-game-backup-path";
import "./notifications/publish-new-repacks-notification";
import "./themes/add-custom-theme";
import "./themes/delete-custom-theme";
import "./themes/get-all-custom-themes";
import "./themes/delete-all-custom-themes";
import { isPortableVersion } from "@main/helpers";
ipcMain.handle("ping", () => "pong");

View File

@@ -0,0 +1,12 @@
import { Theme } from "@types";
import { themes } from "@main/level/sublevels/themes";
import { registerEvent } from "../register-event";
const addCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
theme: Theme
) => {
await themes.put(theme.id, theme);
};
registerEvent("addCustomTheme", addCustomTheme);

View File

@@ -0,0 +1,9 @@
import { themes } from "@main/level/sublevels/themes";
import { registerEvent } from "../register-event";
const deleteAllCustomThemes = async (_event: Electron.IpcMainInvokeEvent) => {
console.log("sexo2");
await themes.clear();
};
registerEvent("deleteAllCustomThemes", deleteAllCustomThemes);

View File

@@ -0,0 +1,11 @@
import { themes } from "@main/level/sublevels/themes";
import { registerEvent } from "../register-event";
const deleteCustomTheme = async (
_event: Electron.IpcMainInvokeEvent,
themeId: string
) => {
await themes.del(themeId);
};
registerEvent("deleteCustomTheme", deleteCustomTheme);

View File

@@ -0,0 +1,8 @@
import { themes } from "@main/level/sublevels/themes";
import { registerEvent } from "../register-event";
const getAllCustomThemes = async (_event: Electron.IpcMainInvokeEvent) => {
return await themes.values().all();
};
registerEvent("getAllCustomThemes", getAllCustomThemes);