Updated cookie impl
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
"use client"
|
||||
|
||||
import { Accordion } from "@/components/ui/accordion"
|
||||
import { COOKIE_VALUES } from "@/data/general"
|
||||
import { Player } from "@/lib/schema/player"
|
||||
import { closestCenter, DndContext, DragEndEvent, KeyboardSensor, PointerSensor, useSensor, useSensors } from "@dnd-kit/core"
|
||||
import { arrayMove, SortableContext, sortableKeyboardCoordinates, verticalListSortingStrategy } from "@dnd-kit/sortable"
|
||||
import { useSortable } from "@dnd-kit/sortable"
|
||||
@@ -10,7 +12,6 @@ import { GripVertical } from "lucide-react"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useEffect, useState } from "react"
|
||||
|
||||
import { Player } from "@/lib/schema/player"
|
||||
import ArcadeStats from "./_stats/arcade/arcade"
|
||||
import BedwarsStats from "./_stats/bedwars/bedwars"
|
||||
import BlitzStats from "./_stats/blitz/blitz"
|
||||
@@ -25,6 +26,12 @@ import TNTGamesStats from "./_stats/tnt-games/tnt-games"
|
||||
import UHCStats from "./_stats/uhc/uhc"
|
||||
import WoolGamesStats from "./_stats/woolgames/woolgames"
|
||||
|
||||
export function PlayerPageLoadText() {
|
||||
const path = usePathname()
|
||||
|
||||
return <p>{`Loading stats for ${path.split("/").at(-1)}`}</p>
|
||||
}
|
||||
|
||||
interface SortableStatItemProps {
|
||||
id: string
|
||||
children: React.ReactNode
|
||||
@@ -60,12 +67,6 @@ function SortableStatItem({ id, children }: SortableStatItemProps) {
|
||||
)
|
||||
}
|
||||
|
||||
export function PlayerPageLoadText() {
|
||||
const path = usePathname()
|
||||
|
||||
return <p>{`Loading stats for ${path.split("/").at(-1)}`}</p>
|
||||
}
|
||||
|
||||
export default function PlayerStats(
|
||||
{ stats, achievements, layout }: {
|
||||
stats: NonNullable<Player["player"]["stats"]>
|
||||
@@ -108,7 +109,7 @@ export default function PlayerStats(
|
||||
)
|
||||
|
||||
function updateStatsOrder(arr: string[]) {
|
||||
Cookies.set("player-stats-order", JSON.stringify(arr), {
|
||||
Cookies.set(COOKIE_VALUES.statsOrder, JSON.stringify(arr), {
|
||||
secure: process.env.NODE_ENV === "production",
|
||||
sameSite: "lax",
|
||||
expires: 365
|
||||
|
||||
Reference in New Issue
Block a user