Updated site
This commit is contained in:
@@ -10,6 +10,23 @@ const nextConfig: NextConfig = {
|
|||||||
experimental: {
|
experimental: {
|
||||||
browserDebugInfoInTerminal: true,
|
browserDebugInfoInTerminal: true,
|
||||||
turbopackFileSystemCacheForDev: true
|
turbopackFileSystemCacheForDev: true
|
||||||
|
},
|
||||||
|
cacheLife: {
|
||||||
|
hypixelApi: {
|
||||||
|
stale: 1000 * 60,
|
||||||
|
revalidate: 1000 * 30,
|
||||||
|
expire: 1000 * 60 * 5
|
||||||
|
},
|
||||||
|
mojangApi: {
|
||||||
|
stale: 1000 * 60,
|
||||||
|
revalidate: 1000 * 30,
|
||||||
|
expire: 1000 * 60 * 5
|
||||||
|
},
|
||||||
|
playerWithGuild: {
|
||||||
|
stale: 1000 * 60 * 60 * 24,
|
||||||
|
revalidate: 1000 * 60 * 60 * 24,
|
||||||
|
expire: 1000 * 60 * 60 * 24 * 7
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { Metadata } from "next"
|
|||||||
import { cookies } from "next/headers"
|
import { cookies } from "next/headers"
|
||||||
import { Suspense } from "react"
|
import { Suspense } from "react"
|
||||||
import z from "zod"
|
import z from "zod"
|
||||||
import { PlayerPageLoadText, PlayerStats } from "./_client"
|
import { PlayerStats } from "./_client"
|
||||||
import Sidebar from "./_components/sidebar"
|
import Sidebar from "./_components/sidebar"
|
||||||
|
|
||||||
export async function generateMetadata({ params }: PageProps<"/player/[ign]">): Promise<Metadata> {
|
export async function generateMetadata({ params }: PageProps<"/player/[ign]">): Promise<Metadata> {
|
||||||
@@ -38,7 +38,6 @@ export default function PlayerPage({ params }: PageProps<"/player/[ign]">) {
|
|||||||
fallback={
|
fallback={
|
||||||
<div className="flex flex-col justify-center items-center h-screen">
|
<div className="flex flex-col justify-center items-center h-screen">
|
||||||
<Loader2Icon className="animate-spin size-30" />
|
<Loader2Icon className="animate-spin size-30" />
|
||||||
<PlayerPageLoadText />
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
13
src/components/ui/skeleton.tsx
Normal file
13
src/components/ui/skeleton.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="skeleton"
|
||||||
|
className={cn("bg-accent animate-pulse rounded-md", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Skeleton }
|
||||||
@@ -8,11 +8,7 @@ export async function getGuild(id: string, type: "id" | "player" | "name" = "pla
|
|||||||
"use cache"
|
"use cache"
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
cacheLife({
|
cacheLife("hypixelApi")
|
||||||
stale: 1000 * 60,
|
|
||||||
revalidate: 1000 * 60 * 5,
|
|
||||||
expire: 1000 * 60 * 5
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(`${guildApi}?${type}=${id}`, {
|
const res = await fetch(`${guildApi}?${type}=${id}`, {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { cacheLife } from "next/dist/server/use-cache/cache-life"
|
import { cacheLife } from "next/dist/server/use-cache/cache-life"
|
||||||
|
import { setTimeout } from "node:timers/promises"
|
||||||
import z from "zod"
|
import z from "zod"
|
||||||
|
|
||||||
const mojangApi = "https://api.mojang.com/users/profiles/minecraft"
|
const mojangApi = "https://api.mojang.com/users/profiles/minecraft"
|
||||||
@@ -12,13 +13,11 @@ export async function getUuid(ign: string) {
|
|||||||
"use cache"
|
"use cache"
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
cacheLife({
|
cacheLife("mojangApi")
|
||||||
stale: 1000 * 60,
|
|
||||||
revalidate: 1000 * 60 * 5,
|
|
||||||
expire: 1000 * 60 * 5
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await setTimeout(5000)
|
||||||
|
|
||||||
const res = await fetch(`${mojangApi}/${ign}`)
|
const res = await fetch(`${mojangApi}/${ign}`)
|
||||||
|
|
||||||
if (!res.ok) return null
|
if (!res.ok) return null
|
||||||
|
|||||||
@@ -8,11 +8,7 @@ export async function getSession(uuid: string) {
|
|||||||
"use cache"
|
"use cache"
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
cacheLife({
|
cacheLife("hypixelApi")
|
||||||
stale: 1000 * 60,
|
|
||||||
revalidate: 1000 * 60 * 5,
|
|
||||||
expire: 1000 * 60 * 5
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
||||||
|
|||||||
@@ -8,11 +8,7 @@ export async function getPlayerForGuild(uuid: string) {
|
|||||||
"use cache"
|
"use cache"
|
||||||
|
|
||||||
// if (process.env.NODE_ENV === "production") {
|
// if (process.env.NODE_ENV === "production") {
|
||||||
cacheLife({
|
cacheLife("playerWithGuild")
|
||||||
stale: 1000 * 60 * 60,
|
|
||||||
revalidate: 1000 * 60 * 60 * 24 * 7,
|
|
||||||
expire: 1000 * 60 * 60 * 24 * 7
|
|
||||||
})
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
||||||
@@ -38,11 +34,7 @@ export async function getPlayer(uuid: string) {
|
|||||||
"use cache"
|
"use cache"
|
||||||
|
|
||||||
if (process.env.NODE_ENV === "production") {
|
if (process.env.NODE_ENV === "production") {
|
||||||
cacheLife({
|
cacheLife("hypixelApi")
|
||||||
stale: 1000 * 60,
|
|
||||||
revalidate: 1000 * 60 * 5,
|
|
||||||
expire: 1000 * 60 * 5
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user