fix: Electron build problems
This commit is contained in:
@@ -194,7 +194,7 @@ export function Dashboard({
|
||||
|
||||
setServerStatsLoading(true);
|
||||
const serversWithStats = await Promise.all(
|
||||
hosts.slice(0, 5).map(async (host: { id: number; name: string }) => {
|
||||
hosts.slice(0, 50).map(async (host: { id: number; name: string }) => {
|
||||
try {
|
||||
const metrics = await getServerMetricsById(host.id);
|
||||
return {
|
||||
@@ -213,7 +213,10 @@ export function Dashboard({
|
||||
}
|
||||
}),
|
||||
);
|
||||
setServerStats(serversWithStats);
|
||||
const validServerStats = serversWithStats.filter(
|
||||
(server) => server.cpu !== null && server.ram !== null,
|
||||
);
|
||||
setServerStats(validServerStats);
|
||||
setServerStatsLoading(false);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch dashboard data:", error);
|
||||
|
||||
@@ -651,7 +651,12 @@ export function Auth({
|
||||
);
|
||||
}
|
||||
|
||||
if (isElectron() && currentServerUrl && authLoading) {
|
||||
if (
|
||||
isElectron() &&
|
||||
currentServerUrl &&
|
||||
authLoading &&
|
||||
!isInElectronWebView()
|
||||
) {
|
||||
return (
|
||||
<div
|
||||
className={`w-[420px] max-w-full p-6 flex flex-col bg-dark-bg border-2 border-dark-border rounded-md overflow-y-auto my-2 ${className || ""}`}
|
||||
@@ -665,7 +670,7 @@ export function Auth({
|
||||
);
|
||||
}
|
||||
|
||||
if (isElectron() && currentServerUrl && !loggedIn) {
|
||||
if (isElectron() && currentServerUrl && !loggedIn && !isInElectronWebView()) {
|
||||
return (
|
||||
<div
|
||||
className="w-full h-screen flex items-center justify-center p-4"
|
||||
|
||||
@@ -529,7 +529,13 @@ export function LeftSidebar({
|
||||
{!isSidebarOpen && (
|
||||
<div
|
||||
onClick={() => setIsSidebarOpen(true)}
|
||||
className="absolute top-0 left-0 w-[10px] h-full bg-dark-bg cursor-pointer z-20 flex items-center justify-center rounded-tr-md rounded-br-md"
|
||||
className="fixed top-0 left-0 w-[10px] h-full cursor-pointer flex items-center justify-center rounded-tr-md rounded-br-md"
|
||||
style={{
|
||||
zIndex: 9999,
|
||||
backgroundColor: "#18181b",
|
||||
border: "2px solid #27272a",
|
||||
borderLeft: "none",
|
||||
}}
|
||||
>
|
||||
<ChevronRight size={10} />
|
||||
</div>
|
||||
|
||||
@@ -491,7 +491,16 @@ export function TopNavbar({
|
||||
{!isTopbarOpen && (
|
||||
<div
|
||||
onClick={() => setIsTopbarOpen(true)}
|
||||
className="absolute top-0 left-0 w-full h-[10px] cursor-pointer z-20 flex items-center justify-center rounded-bl-md rounded-br-md bg-dark"
|
||||
className="fixed top-0 cursor-pointer flex items-center justify-center rounded-bl-md rounded-br-md"
|
||||
style={{
|
||||
left: leftPosition,
|
||||
right: "17px",
|
||||
height: "10px",
|
||||
zIndex: 9999,
|
||||
backgroundColor: "#18181b",
|
||||
border: "2px solid #27272a",
|
||||
borderTop: "none",
|
||||
}}
|
||||
>
|
||||
<ChevronDown size={10} />
|
||||
</div>
|
||||
|
||||
@@ -345,7 +345,15 @@ function createApiInstance(
|
||||
toast.warning("Session expired. Please log in again.");
|
||||
});
|
||||
|
||||
setTimeout(() => window.location.reload(), 1000);
|
||||
const currentPath = window.location.pathname;
|
||||
const isOnAuthPage =
|
||||
currentPath === "/" ||
|
||||
currentPath === "/login" ||
|
||||
currentPath === "/auth";
|
||||
|
||||
if (!isOnAuthPage) {
|
||||
setTimeout(() => window.location.reload(), 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user