mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +03:00
feat: add active theme handling in theme deletion modals
This commit is contained in:
parent
61d4910b6d
commit
13eeb2cee7
@ -69,6 +69,7 @@ export const ThemeCard = ({ theme, onListUpdated }: ThemeCardProps) => {
|
|||||||
onThemeDeleted={onListUpdated}
|
onThemeDeleted={onListUpdated}
|
||||||
themeId={theme.id}
|
themeId={theme.id}
|
||||||
themeName={theme.name}
|
themeName={theme.name}
|
||||||
|
isActive={theme.isActive}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
@ -2,6 +2,7 @@ import { Button } from "@renderer/components/button/button";
|
|||||||
import { Modal } from "@renderer/components/modal/modal";
|
import { Modal } from "@renderer/components/modal/modal";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import "./modals.scss";
|
import "./modals.scss";
|
||||||
|
import { removeCustomCss } from "@renderer/helpers";
|
||||||
|
|
||||||
interface DeleteAllThemesModalProps {
|
interface DeleteAllThemesModalProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@ -17,6 +18,12 @@ export const DeleteAllThemesModal = ({
|
|||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
|
|
||||||
const handleDeleteAllThemes = async () => {
|
const handleDeleteAllThemes = async () => {
|
||||||
|
const activeTheme = await window.electron.getActiveCustomTheme();
|
||||||
|
|
||||||
|
if (activeTheme) {
|
||||||
|
removeCustomCss();
|
||||||
|
}
|
||||||
|
|
||||||
await window.electron.deleteAllCustomThemes();
|
await window.electron.deleteAllCustomThemes();
|
||||||
onClose();
|
onClose();
|
||||||
onThemesDeleted();
|
onThemesDeleted();
|
||||||
|
@ -2,11 +2,13 @@ import { Button } from "@renderer/components/button/button";
|
|||||||
import { Modal } from "@renderer/components/modal/modal";
|
import { Modal } from "@renderer/components/modal/modal";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import "./modals.scss";
|
import "./modals.scss";
|
||||||
|
import { removeCustomCss } from "@renderer/helpers";
|
||||||
|
|
||||||
interface DeleteThemeModalProps {
|
interface DeleteThemeModalProps {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
themeId: string;
|
themeId: string;
|
||||||
|
isActive: boolean;
|
||||||
onThemeDeleted: () => void;
|
onThemeDeleted: () => void;
|
||||||
themeName: string;
|
themeName: string;
|
||||||
}
|
}
|
||||||
@ -15,12 +17,17 @@ export const DeleteThemeModal = ({
|
|||||||
visible,
|
visible,
|
||||||
onClose,
|
onClose,
|
||||||
themeId,
|
themeId,
|
||||||
|
isActive,
|
||||||
onThemeDeleted,
|
onThemeDeleted,
|
||||||
themeName,
|
themeName,
|
||||||
}: DeleteThemeModalProps) => {
|
}: DeleteThemeModalProps) => {
|
||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
|
|
||||||
const handleDeleteTheme = async () => {
|
const handleDeleteTheme = async () => {
|
||||||
|
if (isActive) {
|
||||||
|
removeCustomCss();
|
||||||
|
}
|
||||||
|
|
||||||
await window.electron.deleteCustomTheme(themeId);
|
await window.electron.deleteCustomTheme(themeId);
|
||||||
onThemeDeleted();
|
onThemeDeleted();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user