diff --git a/gui/app/src/components/AppStatusGate.tsx b/gui/app/src/components/AppStatusGate.tsx
index a74c3b28f..3b044878c 100644
--- a/gui/app/src/components/AppStatusGate.tsx
+++ b/gui/app/src/components/AppStatusGate.tsx
@@ -1,16 +1,33 @@
+import { useEffect, useState } from 'react';
import { Navigate, Outlet, useLocation } from 'react-router-dom';
import { useWebsocketAPI } from '@/hooks/websocket-api';
import { useErrorReporting } from '@/hooks/error-reporting';
+import { ConnectionLost } from './onboarding/pages/ConnectionLost';
+import { ErrorReportingConsentPage } from './ErrorReportingConsent';
export const CONNECTING_PATH = '/connecting';
export const ERROR_REPORTING_CONSENT_PATH = '/error-reporting-consent';
const STATUS_PATHS = [CONNECTING_PATH, ERROR_REPORTING_CONSENT_PATH];
+interface ReturnTo {
+ path: string;
+ state: unknown;
+}
+
+function StatusPage({ path }: { path: string }) {
+ return path === ERROR_REPORTING_CONSENT_PATH ? (
+
+ ) : (
+
+ );
+}
+
export function AppStatusGate() {
const { isConnected } = useWebsocketAPI();
const { needsAnswer } = useErrorReporting();
const location = useLocation();
+ const [appShown, setAppShown] = useState(false);
const statusPath = needsAnswer
? ERROR_REPORTING_CONSENT_PATH
@@ -18,15 +35,29 @@ export function AppStatusGate() {
? CONNECTING_PATH
: null;
const onStatusPath = STATUS_PATHS.includes(location.pathname);
- const returnTo: string = onStatusPath
- ? (location.state?.returnTo ?? '/')
- : location.pathname + location.search;
- if (statusPath && location.pathname !== statusPath) {
+ useEffect(() => {
+ if (!statusPath && !onStatusPath) setAppShown(true);
+ }, [statusPath, onStatusPath]);
+
+ const returnTo: ReturnTo = onStatusPath
+ ? (location.state?.returnTo ?? { path: '/', state: null })
+ : { path: location.pathname + location.search, state: location.state };
+
+ if (!appShown && statusPath && location.pathname !== statusPath) {
return ;
}
- if (!statusPath && onStatusPath) {
- return ;
+ if ((appShown || !statusPath) && onStatusPath) {
+ return ;
}
- return ;
+
+ const covering = appShown ? statusPath : null;
+ return (
+ <>
+ {covering && }
+
+
+
+ >
+ );
}