Updated site
This commit is contained in:
@@ -12,7 +12,7 @@ import { Metadata } from "next"
|
||||
import { cookies } from "next/headers"
|
||||
import { Suspense } from "react"
|
||||
import z from "zod"
|
||||
import { PlayerPageLoadText, PlayerStats } from "./_client"
|
||||
import { PlayerStats } from "./_client"
|
||||
import Sidebar from "./_components/sidebar"
|
||||
|
||||
export async function generateMetadata({ params }: PageProps<"/player/[ign]">): Promise<Metadata> {
|
||||
@@ -38,7 +38,6 @@ export default function PlayerPage({ params }: PageProps<"/player/[ign]">) {
|
||||
fallback={
|
||||
<div className="flex flex-col justify-center items-center h-screen">
|
||||
<Loader2Icon className="animate-spin size-30" />
|
||||
<PlayerPageLoadText />
|
||||
</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"
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
cacheLife({
|
||||
stale: 1000 * 60,
|
||||
revalidate: 1000 * 60 * 5,
|
||||
expire: 1000 * 60 * 5
|
||||
})
|
||||
cacheLife("hypixelApi")
|
||||
}
|
||||
|
||||
const res = await fetch(`${guildApi}?${type}=${id}`, {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { cacheLife } from "next/dist/server/use-cache/cache-life"
|
||||
import { setTimeout } from "node:timers/promises"
|
||||
import z from "zod"
|
||||
|
||||
const mojangApi = "https://api.mojang.com/users/profiles/minecraft"
|
||||
@@ -12,13 +13,11 @@ export async function getUuid(ign: string) {
|
||||
"use cache"
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
cacheLife({
|
||||
stale: 1000 * 60,
|
||||
revalidate: 1000 * 60 * 5,
|
||||
expire: 1000 * 60 * 5
|
||||
})
|
||||
cacheLife("mojangApi")
|
||||
}
|
||||
|
||||
await setTimeout(5000)
|
||||
|
||||
const res = await fetch(`${mojangApi}/${ign}`)
|
||||
|
||||
if (!res.ok) return null
|
||||
|
||||
@@ -8,11 +8,7 @@ export async function getSession(uuid: string) {
|
||||
"use cache"
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
cacheLife({
|
||||
stale: 1000 * 60,
|
||||
revalidate: 1000 * 60 * 5,
|
||||
expire: 1000 * 60 * 5
|
||||
})
|
||||
cacheLife("hypixelApi")
|
||||
}
|
||||
|
||||
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
||||
|
||||
@@ -8,11 +8,7 @@ export async function getPlayerForGuild(uuid: string) {
|
||||
"use cache"
|
||||
|
||||
// if (process.env.NODE_ENV === "production") {
|
||||
cacheLife({
|
||||
stale: 1000 * 60 * 60,
|
||||
revalidate: 1000 * 60 * 60 * 24 * 7,
|
||||
expire: 1000 * 60 * 60 * 24 * 7
|
||||
})
|
||||
cacheLife("playerWithGuild")
|
||||
// }
|
||||
|
||||
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
||||
@@ -38,11 +34,7 @@ export async function getPlayer(uuid: string) {
|
||||
"use cache"
|
||||
|
||||
if (process.env.NODE_ENV === "production") {
|
||||
cacheLife({
|
||||
stale: 1000 * 60,
|
||||
revalidate: 1000 * 60 * 5,
|
||||
expire: 1000 * 60 * 5
|
||||
})
|
||||
cacheLife("hypixelApi")
|
||||
}
|
||||
|
||||
const res = await fetch(`${playerApi}?uuid=${uuid}`, {
|
||||
|
||||
Reference in New Issue
Block a user