From 2e53523076dfc0cdd5e08c4fb966275f64d9d9bc Mon Sep 17 00:00:00 2001 From: Hydra Date: Sat, 20 Apr 2024 21:11:01 -0300 Subject: [PATCH] fix: select Folder Modal doesn't close --- src/renderer/pages/game-details/game-details.tsx | 4 ++++ src/renderer/pages/game-details/repacks-modal.tsx | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/renderer/pages/game-details/game-details.tsx b/src/renderer/pages/game-details/game-details.tsx index 9c9178bf..aae3f267 100644 --- a/src/renderer/pages/game-details/game-details.tsx +++ b/src/renderer/pages/game-details/game-details.tsx @@ -51,6 +51,7 @@ export function GameDetails() { const { t, i18n } = useTranslation("game_details"); const [showRepacksModal, setShowRepacksModal] = useState(false); + const [showSelectFolderModal, setShowSelectFolderModal] = useState(false); const randomGameObjectID = useRef(null); @@ -153,6 +154,7 @@ export function GameDetails() { ).then(() => { getGame(); setShowRepacksModal(false); + setShowSelectFolderModal(false); }); }; @@ -177,6 +179,8 @@ export function GameDetails() { visible={showRepacksModal} gameDetails={gameDetails} startDownload={handleStartDownload} + showSelectFolderModal={showSelectFolderModal} + setShowSelectFolderModal={setShowSelectFolderModal} onClose={() => setShowRepacksModal(false)} /> )} diff --git a/src/renderer/pages/game-details/repacks-modal.tsx b/src/renderer/pages/game-details/repacks-modal.tsx index 3282ee3b..7908c486 100644 --- a/src/renderer/pages/game-details/repacks-modal.tsx +++ b/src/renderer/pages/game-details/repacks-modal.tsx @@ -16,6 +16,8 @@ import { SelectFolderModal } from "./select-folder-modal"; export interface RepacksModalProps { visible: boolean; gameDetails: ShopDetails; + showSelectFolderModal: boolean; + setShowSelectFolderModal: (value: boolean) => void; startDownload: (repackId: number, downloadPath: string) => Promise; onClose: () => void; } @@ -23,10 +25,11 @@ export interface RepacksModalProps { export function RepacksModal({ visible, gameDetails, + showSelectFolderModal, + setShowSelectFolderModal, startDownload, onClose, }: RepacksModalProps) { - const [openSelectFolderModal, setOpenSelectFolderModal] = useState(false); const [diskFreeSpace, setDiskFreeSpace] = useState(null); const [filteredRepacks, setFilteredRepacks] = useState([]); const [repack, setRepack] = useState(null); @@ -53,7 +56,7 @@ export function RepacksModal({ const handleRepackClick = (repack: GameRepack) => { setRepack(repack); - setOpenSelectFolderModal(true); + setShowSelectFolderModal(true); }; const handleFilter: React.ChangeEventHandler = (event) => { @@ -76,8 +79,8 @@ export function RepacksModal({ onClose={onClose} > setOpenSelectFolderModal(false)} + visible={showSelectFolderModal} + onClose={() => setShowSelectFolderModal(false)} gameDetails={gameDetails} startDownload={startDownload} repack={repack}