Updated page to support maintance mode
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import DisplayName from "@/components/player/displayname"
|
||||
import { Accordion } from "@/components/ui/accordion"
|
||||
import { Card, CardContent } from "@/components/ui/card"
|
||||
import { env } from "@/lib/env/server"
|
||||
import { getGuild } from "@/lib/hypixel/api/guild"
|
||||
import { getUuid } from "@/lib/hypixel/api/mojang"
|
||||
import { getPlayer } from "@/lib/hypixel/api/player"
|
||||
import { getExactLevel } from "@/lib/hypixel/general/level"
|
||||
import { Loader2Icon } from "lucide-react"
|
||||
import { Loader2Icon, ShieldAlert } from "lucide-react"
|
||||
import { Metadata } from "next"
|
||||
import { Suspense } from "react"
|
||||
import Sidebar from "./_components/Sidebar"
|
||||
@@ -23,6 +24,17 @@ export async function generateMetadata({ params }: { params: Promise<{ ign: stri
|
||||
}
|
||||
|
||||
export default async function PlayerPage({ params }: PageProps<"/player/[ign]">) {
|
||||
const maintenance = env.MAINTENANCE_MODE
|
||||
|
||||
if (maintenance) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2 justify-center items-center h-screen">
|
||||
<ShieldAlert className="size-30" />
|
||||
<h1 className="text-xl">Not available right now. This is just so I could have a front page for Hypixel Production API Key.</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const { ign } = await params
|
||||
|
||||
return (
|
||||
|
||||
12
src/lib/env/server.ts
vendored
12
src/lib/env/server.ts
vendored
@@ -1,10 +1,12 @@
|
||||
import { createEnv } from "@t3-oss/env-nextjs";
|
||||
import z from "zod";
|
||||
import { createEnv } from "@t3-oss/env-nextjs"
|
||||
import z from "zod"
|
||||
|
||||
export const env = createEnv({
|
||||
server: {
|
||||
HYPIXEL_API_KEY: z.string().min(1),
|
||||
MAINTENANCE_MODE: z.coerce.boolean().default(false),
|
||||
HYPIXEL_API_KEY: z.string().min(1)
|
||||
},
|
||||
experimental__runtimeEnv: true,
|
||||
emptyStringAsUndefined: true,
|
||||
})
|
||||
emptyStringAsUndefined: true
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user