From e539d41f58634a2e8daa3d8b41292aea220d584b Mon Sep 17 00:00:00 2001 From: Aaron Pepper Date: Wed, 15 Jan 2025 11:59:29 -0500 Subject: [PATCH] fix keep changes button in modal --- .../LudicrousCofirmationDialog.tsx | 5 ++--- .../main/SideBar/Miner/components/ModeSelect.tsx | 8 +++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/containers/floating/LudicrousCofirmationDialog/LudicrousCofirmationDialog.tsx b/src/containers/floating/LudicrousCofirmationDialog/LudicrousCofirmationDialog.tsx index 6ce61abe5..15bf0f979 100644 --- a/src/containers/floating/LudicrousCofirmationDialog/LudicrousCofirmationDialog.tsx +++ b/src/containers/floating/LudicrousCofirmationDialog/LudicrousCofirmationDialog.tsx @@ -4,7 +4,7 @@ import { DialogContent, Dialog } from '@app/components/elements/dialog/Dialog'; import { useCallback, useEffect, useState } from 'react'; import { ButtonWrapper, CountdownNumber, KeepButton, RevertButton, Text, TextWrapper, Title, Wrapper } from './styles'; import { useTranslation } from 'react-i18next'; -import { useMiningStore } from '@app/store/useMiningStore'; +import { changeMiningMode } from '@app/store/miningStoreActions.ts'; function Countdown({ onComplete }: { onComplete: () => void }) { const [count, setCount] = useState(30); @@ -25,7 +25,6 @@ export default function LudicrousCofirmationDialog() { const { t } = useTranslation('components', { useSuspense: false }); const open = useUIStore((s) => s.dialogToShow === 'ludicrousConfirmation'); const setDialogToShow = useUIStore((s) => s.setDialogToShow); - const changeMiningMode = useMiningStore((s) => s.changeMiningMode); const handleClose = useCallback(() => { setDialogToShow(null); @@ -34,7 +33,7 @@ export default function LudicrousCofirmationDialog() { const handleChange = useCallback(async () => { await changeMiningMode({ mode: 'Ludicrous' }); setDialogToShow(null); - }, [changeMiningMode, setDialogToShow]); + }, [setDialogToShow]); return ( diff --git a/src/containers/main/SideBar/Miner/components/ModeSelect.tsx b/src/containers/main/SideBar/Miner/components/ModeSelect.tsx index 0e56f866c..7f453d4e6 100644 --- a/src/containers/main/SideBar/Miner/components/ModeSelect.tsx +++ b/src/containers/main/SideBar/Miner/components/ModeSelect.tsx @@ -14,6 +14,7 @@ import { modeType } from '@app/store/types'; import { CustomPowerLevelsDialogContainer } from './CustomPowerLevels/CustomPowerLevelsDialogContainer'; import { useMiningMetricsStore } from '@app/store/useMiningMetricsStore.ts'; import { changeMiningMode } from '@app/store/miningStoreActions.ts'; +import { useUIStore } from '@app/store/useUIStore'; function ModeSelect() { const { t } = useTranslation('common', { useSuspense: false }); @@ -28,6 +29,7 @@ function ModeSelect() { const isMining = isCPUMining || isGPUMining; const isMiningLoading = (isMining && !isMiningInitiated) || (isMiningInitiated && !isMining); const custom_power_levels_enabled = useAppConfigStore((s) => s.custom_power_levels_enabled); + const setDialogToShow = useUIStore((s) => s.setDialogToShow); const handleChange = useCallback( async (newMode: string) => { @@ -35,9 +37,13 @@ function ModeSelect() { setCustomLevelsDialog(true); return; } + if (newMode === 'Ludicrous') { + setDialogToShow('ludicrousConfirmation'); + return; + } await changeMiningMode({ mode: newMode as modeType }); }, - [setCustomLevelsDialog] + [setCustomLevelsDialog, setDialogToShow] ); const tabOptions = useMemo(() => {