Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
Remove maintenance mode middleware
Luke Vella6375e8064161
diff --git a/components/maintenance.tsx b/components/maintenance.tsxnew file mode 100644index 000000000..4ac0ec207--- /dev/null+++ b/components/maintenance.tsx@@ -0,0 +1,28 @@+import { NextPage } from "next";+import Head from "next/head";++import Clock from "@/components/icons/clock.svg";++import Logo from "../public/logo.svg";++const Maintenance: NextPage = () => {+ return (+ <div className="flex h-full flex-col items-center justify-center bg-gray-100">+ <Head>+ <title>Down for maintenance - Be right back</title>+ </Head>+ <div className="w-96 rounded-lg border bg-white p-8 text-center shadow-sm">+ <div className="mb-4">+ <Clock className="inline-block h-20 text-indigo-500" />+ </div>+ <div className="">+ The site is currently down for some maintenance and will be back+ shortly…+ </div>+ </div>+ <Logo className="mt-8 inline-block h-8 text-slate-300" />+ </div>+ );+};++export default Maintenance;diff --git a/declarations/environment.d.ts b/declarations/environment.d.tsindex 7a75e25d2..1c7ce4654 100644--- a/declarations/environment.d.ts+++ b/declarations/environment.d.ts@@ -4,7 +4,7 @@ declare global {DATABASE_URL: string;NODE_ENV: "development" | "production";SECRET_PASSWORD: string;- MAINTENANCE_MODE?: "true";+ NEXT_PUBLIC_MAINTENANCE_MODE?: string;PLAUSIBLE_DOMAIN?: string;NEXT_PUBLIC_CRISP_WEBSITE_ID?: string;LEGACY_MONGODB_URI?: string;diff --git a/pages/_app.tsx b/pages/_app.tsxindex c42b18353..d31029279 100644--- a/pages/_app.tsx+++ b/pages/_app.tsx@@ -12,6 +12,7 @@ import PlausibleProvider from "next-plausible";import toast, { Toaster } from "react-hot-toast";import { MutationCache, QueryClient, QueryClientProvider } from "react-query";+import Maintenance from "@/components/maintenance";import ModalProvider from "@/components/modal/modal-provider";import PreferencesProvider from "@/components/preferences/preferences-provider";@@ -32,6 +33,9 @@ const queryClient = new QueryClient({});const MyApp: NextPage<AppProps> = ({ Component, pageProps }) => {+ if (process.env.NEXT_PUBLIC_MAINTENANCE_MODE === "1") {+ return <Maintenance />;+ }return (<PlausibleProviderdomain="rallly.co"diff --git a/pages/_middleware.ts b/pages/_middleware.tsdeleted file mode 100644index 2c5f24bc2..000000000--- a/pages/_middleware.ts+++ /dev/null@@ -1,15 +0,0 @@-import { NextMiddleware, NextResponse } from "next/server";--import { isInMaintenanceMode } from "../utils/constants";--export const middleware: NextMiddleware = async (req) => {- // redirect user to maintenance page if we're in maintenance mode-- if (isInMaintenanceMode && req.nextUrl.pathname !== "/maintenance") {- const url = req.nextUrl.clone();- url.pathname = "/maintenance";- return NextResponse.redirect(url, 302);- }-- return NextResponse.next();-};diff --git a/pages/maintenance.tsx b/pages/maintenance.tsxdeleted file mode 100644index e5cb8f19c..000000000--- a/pages/maintenance.tsx+++ /dev/null@@ -1,31 +0,0 @@-import { GetStaticProps, NextPage } from "next";--import Logo from "../public/logo.svg";-import { isInMaintenanceMode } from "../utils/constants";--const Maintenance: NextPage = () => {- return (- <div className="flex h-full flex-col items-center justify-center bg-gray-100">- <div className="w-96 rounded-lg border bg-white p-8 text-center shadow-sm">- <Logo className="mb-4 inline-block h-8 text-indigo-500" />- <div className="">- The site is currently under maintenance and will be back shortly…- </div>- </div>- </div>- );-};--export const getStaticProps: GetStaticProps = () => {- if (isInMaintenanceMode) {- return {- redirect: {- destination: "/",- permanent: true,- },- };- }- return { props: {} };-};--export default Maintenance;