diff --git a/apps/studio/next.config.js b/apps/studio/next.config.js index 3e1e931248a..2177d91b3a9 100644 --- a/apps/studio/next.config.js +++ b/apps/studio/next.config.js @@ -438,6 +438,22 @@ const nextConfig = { }, ] : []), + + ...(process.env.MAINTENANCE_MODE === 'true' + ? [ + { + source: '/((?!maintenance).*)', // Redirect all paths except /maintenance + destination: '/maintenance', + permanent: false, + }, + ] + : [ + { + source: '/maintenance', + destination: '/', + permanent: false, + }, + ]), ] }, async headers() { diff --git a/apps/studio/pages/maintenance.tsx b/apps/studio/pages/maintenance.tsx new file mode 100644 index 00000000000..44b95647869 --- /dev/null +++ b/apps/studio/pages/maintenance.tsx @@ -0,0 +1,60 @@ +import { RefreshCw } from 'lucide-react' +import { useTheme } from 'next-themes' +import Head from 'next/head' + +import { BASE_PATH } from 'lib/constants' +import type { NextPageWithLayout } from 'types' +import { Button, cn } from 'ui' +import { useMemo } from 'react' + +const MaintenancePage: NextPageWithLayout = () => { + const { resolvedTheme } = useTheme() + const isDarkMode = resolvedTheme?.includes('dark') + + const imgUrl = useMemo( + () => + isDarkMode ? `${BASE_PATH}/img/supabase-dark.svg` : `${BASE_PATH}/img/supabase-light.svg`, + [isDarkMode] + ) + + return ( + <> + + Supabase | Under Maintenance + +
+
+ Supabase +
+
+

Under Maintenance

+

+ We are currently improving our services. The dashboard will be back online shortly. +

+
+
+

+ Reload the page to check if the maintenance window has ended +

+ +
+
+ + ) +} + +MaintenancePage.getLayout = (page) => ( +
+ {page} +
+) + +export default MaintenancePage diff --git a/turbo.json b/turbo.json index 2137fa130e1..1888dac5b6e 100644 --- a/turbo.json +++ b/turbo.json @@ -73,6 +73,7 @@ "SUPABASE_URL", "VERCEL", "VERCEL_ENV", + "MAINTENANCE_MODE", // These envs are used in the packages "NEXT_PUBLIC_STORAGE_KEY", "NEXT_PUBLIC_AUTH_DEBUG_KEY",