fix: updating themes when installing

This commit is contained in:
Chubby Granny Chaser 2025-02-16 04:28:55 +00:00
parent 22e567466f
commit c36aff8f62
No known key found for this signature in database
5 changed files with 16 additions and 6 deletions

View file

@ -29,6 +29,7 @@ import type {
LibraryGame, LibraryGame,
GameRunning, GameRunning,
TorBoxUser, TorBoxUser,
Theme,
} from "@types"; } from "@types";
import type { AxiosProgressEvent } from "axios"; import type { AxiosProgressEvent } from "axios";
import type disk from "diskusage"; import type disk from "diskusage";

View file

@ -2,7 +2,6 @@ import { Modal } from "@renderer/components/modal/modal";
import { TextField } from "@renderer/components/text-field/text-field"; import { TextField } from "@renderer/components/text-field/text-field";
import { Button } from "@renderer/components/button/button"; import { Button } from "@renderer/components/button/button";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import "./modals.scss";
import { useUserDetails } from "@renderer/hooks"; import { useUserDetails } from "@renderer/hooks";
import { Theme } from "@types"; import { Theme } from "@types";
import { useForm } from "react-hook-form"; import { useForm } from "react-hook-form";
@ -11,6 +10,8 @@ import * as yup from "yup";
import { yupResolver } from "@hookform/resolvers/yup"; import { yupResolver } from "@hookform/resolvers/yup";
import { useCallback } from "react"; import { useCallback } from "react";
import "./modals.scss";
interface AddThemeModalProps { interface AddThemeModalProps {
visible: boolean; visible: boolean;
onClose: () => void; onClose: () => void;

View file

@ -15,6 +15,14 @@ export const SettingsAppearance = () => {
loadThemes(); loadThemes();
}, []); }, []);
useEffect(() => {
const unsubscribe = window.electron.onCssInjected(() => {
loadThemes();
});
return () => unsubscribe();
}, []);
return ( return (
<div className="settings-appearance"> <div className="settings-appearance">
<ThemeActions onListUpdated={loadThemes} themesCount={themes.length} /> <ThemeActions onListUpdated={loadThemes} themesCount={themes.length} />

View file

@ -86,12 +86,12 @@ export function SettingsRealDebrid() {
<CheckboxField <CheckboxField
label={t("enable_real_debrid")} label={t("enable_real_debrid")}
checked={form.useRealDebrid} checked={form.useRealDebrid}
onChange={() => onChange={() => {
setForm((prev) => ({ setForm((prev) => ({
...prev, ...prev,
useRealDebrid: !form.useRealDebrid, useRealDebrid: !form.useRealDebrid,
})) }));
} }}
/> />
{form.useRealDebrid && ( {form.useRealDebrid && (

View file

@ -1,8 +1,8 @@
export interface Theme { export interface Theme {
id: string; id: string;
name: string; name: string;
author: string | undefined; author?: string;
authorName: string | undefined; authorName?: string;
isActive: boolean; isActive: boolean;
code: string; code: string;
createdAt: Date; createdAt: Date;