Added warlords class stats table
This commit is contained in:
@@ -10,7 +10,7 @@ import { CSS } from "@dnd-kit/utilities"
|
||||
import Cookies from "js-cookie"
|
||||
import { GripVertical } from "lucide-react"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useEffect, useMemo, useState } from "react"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
|
||||
import ArcadeStats from "./_stats/arcade/arcade"
|
||||
import BedwarsStats from "./_stats/bedwars/bedwars"
|
||||
@@ -114,17 +114,14 @@ export function PlayerStats(
|
||||
})
|
||||
)
|
||||
|
||||
const cookieOpts = useMemo(() => {
|
||||
const cookieOpts: Parameters<typeof Cookies.set>[2] = {
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
sameSite: "lax",
|
||||
expires: 365
|
||||
}
|
||||
return cookieOpts
|
||||
}, [])
|
||||
const cookieOpts = useRef<Parameters<typeof Cookies.set>[2]>({
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
sameSite: "lax",
|
||||
expires: 365
|
||||
})
|
||||
|
||||
function updateStatsOrder(arr: string[]) {
|
||||
Cookies.set(COOKIE_VALUES.statsOrder, JSON.stringify(arr), cookieOpts)
|
||||
Cookies.set(COOKIE_VALUES.statsOrder, JSON.stringify(arr), cookieOpts.current)
|
||||
}
|
||||
|
||||
function handleDragEnd(event: DragEndEvent) {
|
||||
@@ -147,7 +144,7 @@ export function PlayerStats(
|
||||
}
|
||||
const cookie = Cookies.get(COOKIE_VALUES.statsOrder)
|
||||
if (cookie) {
|
||||
Cookies.set(COOKIE_VALUES.statsOrder, cookie, cookieOpts)
|
||||
Cookies.set(COOKIE_VALUES.statsOrder, cookie, cookieOpts.current)
|
||||
}
|
||||
}, [layout, cookieOpts])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user