From 230b86ea8aec108c2d9f4ccbaf6878a1af728270 Mon Sep 17 00:00:00 2001 From: Cooper Ransom Date: Thu, 7 Mar 2024 11:42:17 -0500 Subject: [PATCH] Replace src/utils/setup/App.tsx with src/setup/App.tsx & merge movie-web/dev --- src/setup/App.tsx | 2 - src/utils/setup/App.tsx | 149 ++++++++++++++++++++++------------------ 2 files changed, 83 insertions(+), 68 deletions(-) diff --git a/src/setup/App.tsx b/src/setup/App.tsx index 60616024..a2440ef8 100644 --- a/src/setup/App.tsx +++ b/src/setup/App.tsx @@ -1,4 +1,3 @@ -import { Analytics } from "@vercel/analytics/react"; import { ReactElement, Suspense, lazy, useEffect, useState } from "react"; import { lazyWithPreload } from "react-lazy-with-preload"; import { @@ -174,7 +173,6 @@ function App() { {showDowntime && ( )} - ); } diff --git a/src/utils/setup/App.tsx b/src/utils/setup/App.tsx index 37c55e0f..d235f9cb 100644 --- a/src/utils/setup/App.tsx +++ b/src/utils/setup/App.tsx @@ -1,4 +1,4 @@ -import { ReactElement, Suspense, lazy, useEffect } from "react"; +import { ReactElement, Suspense, lazy, useEffect, useState } from "react"; import { lazyWithPreload } from "react-lazy-with-preload"; import { Navigate, @@ -16,6 +16,7 @@ import { AboutPage } from "@/pages/About"; import { AdminPage } from "@/pages/admin/AdminPage"; import VideoTesterView from "@/pages/developer/VideoTesterView"; import { DmcaPage, shouldHaveDmcaPage } from "@/pages/Dmca"; +import MaintenancePage from "@/pages/errors/MaintenancePage"; import { NotFoundPage } from "@/pages/errors/NotFoundPage"; import { HomePage } from "@/pages/HomePage"; import { LoginPage } from "@/pages/Login"; @@ -23,6 +24,7 @@ import { OnboardingPage } from "@/pages/onboarding/Onboarding"; import { OnboardingExtensionPage } from "@/pages/onboarding/OnboardingExtension"; import { OnboardingProxyPage } from "@/pages/onboarding/OnboardingProxy"; import { RegisterPage } from "@/pages/Register"; +import { SupportPage } from "@/pages/Support"; import { Layout } from "@/setup/Layout"; import { useHistoryListener } from "@/stores/history"; import { LanguageProvider } from "@/stores/language"; @@ -83,80 +85,95 @@ function QueryView() { return null; } +// Duplicate of @/src/setup/App.tsx function App() { useHistoryListener(); useOnlineListener(); + const maintenance = false; // Changing to true shows maintenance page + const [showDowntime, setShowDowntime] = useState(maintenance); + + const handleButtonClick = () => { + setShowDowntime(false); + }; + + useEffect(() => { + const sessionToken = sessionStorage.getItem("downtimeToken"); + if (!sessionToken && maintenance) { + setShowDowntime(true); + sessionStorage.setItem("downtimeToken", "true"); + } + }, [setShowDowntime, maintenance]); return ( - - {/* functional routes */} - } /> - } /> - } /> - - {/* pages */} - + {!showDowntime && ( + + {/* functional routes */} + } /> + } /> + } /> + {/* pages */} + + + + + + } + /> + + + + + + } + /> + } /> + } /> + } /> + } /> + } /> + } /> + } + /> + } /> + {shouldHaveDmcaPage() ? ( + } /> + ) : null} + {/* Support page */} + } /> + {/* Settings page */} + - + - - } - /> - - - - - - } - /> - } /> - } /> - } /> - } /> - } /> - } /> - } - /> - } /> - - {shouldHaveDmcaPage() ? ( - } /> - ) : null} - - {/* Settings page */} - - - - } - /> - - {/* admin routes */} - } /> - - {/* other */} - } /> - } /> - {/* developer routes that can abuse workers are disabled in production */} - {process.env.NODE_ENV === "development" ? ( - } /> - ) : null} - } /> - + } + /> + {/* admin routes */} + } /> + {/* other */} + } /> + } /> + {/* developer routes that can abuse workers are disabled in production */} + {process.env.NODE_ENV === "development" ? ( + } /> + ) : null} + } /> + + )} + {showDowntime && ( + + )} ); } - -export default App;