diff --git a/app/(public)/layout.tsx b/app/(public)/layout.tsx
index c944587..3bb7b33 100644
--- a/app/(public)/layout.tsx
+++ b/app/(public)/layout.tsx
@@ -4,6 +4,8 @@ import { Footer } from '@/components/layout/footer'
import MobileTabBar from '@/components/layout/MobileTabBar'
import CTA from '@/components/sections/cta'
import UpdateNotification from '@/components/UpdateNotification'
+import PWAInstallPrompt, { IOSInstallPrompt } from '@/components/PWAInstallPrompt'
+import ClientFloatingWhatsApp from '@/components/ClientFloatingWhatsApp'
export const metadata: Metadata = {
title: 'Padmaaja Rasooi - Premium Food Products | Multigrain Flour & Rice',
@@ -27,6 +29,14 @@ export default async function RootLayout({
{/* PWA Update Notification */}
+
+
+
{/* Mobile Tab Bar */}
diff --git a/app/layout.tsx b/app/layout.tsx
index 427ec4c..0f59ac0 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -6,8 +6,7 @@ import { Toaster } from '@/components/ui/sonner'
import { auth } from '@/auth';
import StructuredData from '@/components/StructuredData'
import { generateOrganizationJsonLd } from '@/lib/structured-data'
-import PWAInstallPrompt, { IOSInstallPrompt } from '@/components/PWAInstallPrompt'
-import ClientFloatingWhatsApp from '@/components/ClientFloatingWhatsApp'
+
// Optimize font loading
const inter = Inter({
@@ -230,14 +229,7 @@ export default async function PublicRootLayout({
-
-
-
+
diff --git a/app/suspended/layout.tsx b/app/suspended/layout.tsx
new file mode 100644
index 0000000..eb5ae8a
--- /dev/null
+++ b/app/suspended/layout.tsx
@@ -0,0 +1,18 @@
+import type { Metadata } from 'next'
+
+export const metadata: Metadata = {
+ title: 'Website Temporarily Suspended',
+ description: 'This website is temporarily unavailable due to pending maintenance dues.'
+}
+
+export default function SuspendedLayout({
+ children,
+}: {
+ children: React.ReactNode
+}) {
+ return (
+
+ {children}
+
+ )
+}
diff --git a/app/suspended/page.tsx b/app/suspended/page.tsx
new file mode 100644
index 0000000..5c4b2b2
--- /dev/null
+++ b/app/suspended/page.tsx
@@ -0,0 +1,20 @@
+export default function SuspendedPage() {
+ return (
+
+
+
+ Service Notice
+
+
+ Website Temporarily Suspended
+
+
+ This website is temporarily unavailable due to pending maintenance dues.
+
+
+ Please contact the administrator to restore services.
+
+
+
+ )
+}
diff --git a/proxy.ts b/proxy.ts
index 1cdabec..a23d1f4 100644
--- a/proxy.ts
+++ b/proxy.ts
@@ -1,56 +1,26 @@
import { NextResponse } from 'next/server'
import type { NextRequest } from 'next/server'
-export default async function proxy(request: NextRequest) {
- const { pathname } = request.nextUrl
+export function proxy(request: NextRequest) {
+ const isSuspended = process.env.SITE_SUSPENDED === 'true'
- // Skip middleware for admin routes, API routes, and static files
- if (pathname.startsWith('/admin') ||
- pathname.startsWith('/api') ||
- pathname.startsWith('/_next') ||
- pathname === '/favicon.ico') {
+ // Fast path: do nothing if the site is not suspended.
+ if (!isSuspended) {
return NextResponse.next()
}
- // Check if maintenance mode is enabled via API
- try {
- const maintenanceResponse = await fetch(new URL('/api/maintenance-check', request.url), {
- headers: {
- // Forward cookies to maintain session for admin check
- cookie: request.headers.get('cookie') || ''
- }
- })
-
- if (maintenanceResponse.ok) {
- const { maintenanceMode } = await maintenanceResponse.json()
-
- // If maintenance mode is ON and user is not on maintenance page
- if (maintenanceMode && pathname !== '/maintenance') {
- return NextResponse.redirect(new URL('/maintenance', request.url))
- }
-
- // If maintenance mode is OFF and user is on maintenance page
- if (!maintenanceMode && pathname === '/maintenance') {
- return NextResponse.redirect(new URL('/', request.url))
- }
- }
- } catch (error) {
- console.error('Middleware error:', error)
- // If maintenance check fails, allow the request to continue
+ const { pathname } = request.nextUrl
+
+ // Allow access to the suspended page itself.
+ if (pathname === '/suspended') {
+ return NextResponse.next()
}
- return NextResponse.next()
+ return NextResponse.redirect(new URL('/suspended', request.url))
}
export const config = {
matcher: [
- /*
- * Match all request paths except for the ones starting with:
- * - api (API routes)
- * - _next/static (static files)
- * - _next/image (image optimization files)
- * - favicon.ico (favicon file)
- */
- '/((?!api|_next/static|_next/image|favicon.ico).*)',
+ '/((?!_next/static|_next/image|favicon.ico|suspended).*)',
],
}