From 2ff31f5a826f5f1a23b570a394062a0de0531693 Mon Sep 17 00:00:00 2001 From: LukeGus Date: Fri, 8 Aug 2025 00:43:52 -0500 Subject: [PATCH] Dont unmount apps --- src/App.tsx | 58 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 99d1319c..8940ef8c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,36 +8,46 @@ import {SSHManager} from "@/apps/SSH/Manager/SSHManager.tsx" function App() { const [view, setView] = React.useState("homepage") + const [mountedViews, setMountedViews] = React.useState>(new Set(["homepage"])) - const renderActiveView = () => { - switch (view) { - case "homepage": - return - case "ssh_manager": - return - case "terminal": - return - case "tunnel": - return - case "config_editor": - return - } + const handleSelectView = (nextView: string) => { + setMountedViews((prev) => { + if (prev.has(nextView)) return prev + const next = new Set(prev) + next.add(nextView) + return next + }) + setView(nextView) } return (
- {renderActiveView()} + {mountedViews.has("homepage") && ( +
+ +
+ )} + {mountedViews.has("ssh_manager") && ( +
+ +
+ )} + {mountedViews.has("terminal") && ( +
+ +
+ )} + {mountedViews.has("tunnel") && ( +
+ +
+ )} + {mountedViews.has("config_editor") && ( +
+ +
+ )}
)