mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: disable delete all themes button when no themes exist
This commit is contained in:
commit
15746a5598
2 changed files with 4 additions and 2 deletions
|
@ -7,9 +7,10 @@ import { useState } from "react";
|
||||||
|
|
||||||
interface ThemeActionsProps {
|
interface ThemeActionsProps {
|
||||||
onListUpdated: () => void;
|
onListUpdated: () => void;
|
||||||
|
themesCount: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ThemeActions = ({ onListUpdated }: ThemeActionsProps) => {
|
export const ThemeActions = ({ onListUpdated, themesCount }: ThemeActionsProps) => {
|
||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
|
|
||||||
const [addThemeModalVisible, setAddThemeModalVisible] = useState(false);
|
const [addThemeModalVisible, setAddThemeModalVisible] = useState(false);
|
||||||
|
@ -41,6 +42,7 @@ export const ThemeActions = ({ onListUpdated }: ThemeActionsProps) => {
|
||||||
theme="danger"
|
theme="danger"
|
||||||
className="settings-appearance__button"
|
className="settings-appearance__button"
|
||||||
onClick={() => setDeleteAllThemesModalVisible(true)}
|
onClick={() => setDeleteAllThemesModalVisible(true)}
|
||||||
|
disabled={themesCount < 1}
|
||||||
>
|
>
|
||||||
<TrashIcon />
|
<TrashIcon />
|
||||||
{t("clear_themes")}
|
{t("clear_themes")}
|
||||||
|
|
|
@ -19,7 +19,7 @@ export const SettingsAppearance = () => {
|
||||||
<div className="settings-appearance">
|
<div className="settings-appearance">
|
||||||
<p className="settings-appearance__description">Appearance</p>
|
<p className="settings-appearance__description">Appearance</p>
|
||||||
|
|
||||||
<ThemeActions onListUpdated={loadThemes} />
|
<ThemeActions onListUpdated={loadThemes} themesCount={themes.length} />
|
||||||
|
|
||||||
<div className="settings-appearance__themes">
|
<div className="settings-appearance__themes">
|
||||||
{!themes.length ? (
|
{!themes.length ? (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue