feat: add service-down error page

This commit is contained in:
2026-02-09 23:08:08 +07:00
parent 48b3dbdab3
commit 5baf988984
12 changed files with 89 additions and 21 deletions

View File

@ -0,0 +1,11 @@
import StatusIndex from "@/features/status";
const page = () => {
return (
<div>
<StatusIndex />
</div>
);
};
export default page;

View File

@ -0,0 +1,7 @@
import React from "react";
const page = () => {
return <div>page</div>;
};
export default page;

12
app/(session)/layout.tsx Normal file
View File

@ -0,0 +1,12 @@
import AuthSessionProviderWrapper from "@/shared/providers/AuthSession";
import React from "react";
const layout = ({ children }: Readonly<{ children: React.ReactNode }>) => {
return (
<div>
<AuthSessionProviderWrapper>{children}</AuthSessionProviderWrapper>
</div>
);
};
export default layout;

View File

@ -30,7 +30,7 @@ export default function RootLayout({
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<AuthSessionProviderWrapper>{children}</AuthSessionProviderWrapper>
{children}
</body>
</html>
);

32
features/status/index.tsx Normal file
View File

@ -0,0 +1,32 @@
"use client";
import Image from "next/image";
import UnderContruction from "@/shared/assets/under-construction.svg";
const StatusIndex = () => {
return (
<div>
<div className="flex flex-col md:flex-row items-center justify-center text-center md:text-left px-4 pt-12 md:pt-22">
<Image
src={UnderContruction}
alt="Under Construction"
draggable={false}
width={240}
/>
<div className="mt-6 md:mt-0 md:ml-6 lg:ml-12 max-w-md">
<h1 className="text-xl font-semibold">
Service is temporarily unavailable
</h1>
<p className="text-sm text-neutral-300 mt-2">
We're currently experiencing an issue with this service and our team
is working to restore it as quickly as possible. You can still
browse other features while we fix the problem. Please check back in
a few moments. We appreciate your patience.
</p>
</div>
</div>
</div>
);
};
export default StatusIndex;

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 152 KiB

View File

@ -1,5 +1,6 @@
"use server";
import { headers } from "next/headers";
import { redirect } from "next/navigation";
import { UAParser } from "ua-parser-js";
export interface BackendResponse<T = unknown> {
@ -22,6 +23,7 @@ export const backendFetch = async (path: string, options: RequestInit = {}) => {
ip: userIp,
};
try {
const res = await fetch(`${process.env.BACKEND_ENDPOINT}/${path}`, {
...options,
headers: {
@ -40,4 +42,7 @@ export const backendFetch = async (path: string, options: RequestInit = {}) => {
}
return resJson;
} catch (error) {
redirect("/status?reason=backend-unreachable");
}
};

View File

@ -15,28 +15,28 @@ const NavigationLink = () => {
<div className="pl-10">
<NavigationMenu viewport={false}>
<NavigationMenuList className="flex-wrap">
<NavigationMenuItem>
<NavigationMenuItem key={1}>
<NavigationMenuLink asChild>
<Link href="/season" className="text-sm">
Season
</Link>
</NavigationMenuLink>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuItem key={2}>
<NavigationMenuLink asChild>
<Link href="/genres" className="text-sm">
Genres
</Link>
</NavigationMenuLink>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuItem key={3}>
<NavigationMenuLink asChild>
<Link href="/trending" className="text-sm">
Trending
</Link>
</NavigationMenuLink>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuItem key={4}>
<NavigationMenuTrigger className="font-normal">
Media
</NavigationMenuTrigger>
@ -62,7 +62,7 @@ const NavigationLink = () => {
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
<NavigationMenuItem>
<NavigationMenuItem key={5}>
<NavigationMenuTrigger className="font-normal">
Release
</NavigationMenuTrigger>