From 951d27856207ed4eae91df67e862234c3d9bae64 Mon Sep 17 00:00:00 2001 From: Taken Date: Tue, 16 Sep 2025 14:12:42 +0200 Subject: [PATCH] Updated cookies --- src/app/(main)/layout.tsx | 2 +- src/app/(main)/settings/page.tsx | 13 +++++++++++ src/app/(stats)/player/[ign]/page.tsx | 2 +- src/components/clear-cookies.tsx | 33 +++++++++++++++++++++++++++ src/components/header.tsx | 8 ++++++- 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 src/app/(main)/settings/page.tsx create mode 100644 src/components/clear-cookies.tsx diff --git a/src/app/(main)/layout.tsx b/src/app/(main)/layout.tsx index 3936e8c..67ee0ba 100644 --- a/src/app/(main)/layout.tsx +++ b/src/app/(main)/layout.tsx @@ -4,7 +4,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) { return ( <>
-
+
{children}
diff --git a/src/app/(main)/settings/page.tsx b/src/app/(main)/settings/page.tsx new file mode 100644 index 0000000..865319c --- /dev/null +++ b/src/app/(main)/settings/page.tsx @@ -0,0 +1,13 @@ +import ClearCookiesButton from "@/components/clear-cookies" + +export default function SettingsPage() { + return ( +
+
+

Cookies

+

The site stores cookies to save prefrences. If you wish to delete these cookies use the bottom bellow.

+
+ +
+ ) +} diff --git a/src/app/(stats)/player/[ign]/page.tsx b/src/app/(stats)/player/[ign]/page.tsx index 3a6c46f..dfa366a 100644 --- a/src/app/(stats)/player/[ign]/page.tsx +++ b/src/app/(stats)/player/[ign]/page.tsx @@ -78,7 +78,7 @@ async function SuspendedPage({ params }: Pick, "param const { data: layout } = schema.safeParse(JSON.parse(c.get(COOKIE_VALUES.statsOrder)?.value ?? "null")) return ( -
+
{ + const values = Object.values(COOKIE_VALUES) + let existing: number = 0 + + for (const val of values) { + const c = Cookies.get(val) + if (c) existing++ + + Cookies.remove(val) + } + + if (existing === 0) { + toast.success("No cookies to clear") + } else { + toast.success("Cleared " + existing + " cookies") + } + }} + variant="destructive" + > + Clear Cookies + + ) +} diff --git a/src/components/header.tsx b/src/components/header.tsx index 03fca7c..d1e9e61 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -1,3 +1,4 @@ +import { Settings } from "lucide-react" import Link from "next/link" import { SearchBar } from "./search-bar" import { ThemeSwitcher } from "./theme-switcher" @@ -10,7 +11,12 @@ export default function Header({ searchBar = false }: { searchBar?: boolean }) { HypStats {searchBar && } - +
+ + + + +
)