From 4086fa88c28718ee7c4a45d0e5e278de16ff6122 Mon Sep 17 00:00:00 2001
From: Purp1e <47248616+Purple-CSGO@users.noreply.github.com>
Date: Thu, 27 Mar 2025 21:13:59 +0800
Subject: [PATCH] [feat] dynamic page with latest stable release notes
---
src/app/(main)/dynamic/page.tsx | 82 +++++++++++++++++++++++++++++++
src/app/(main)/home/page.tsx | 2 +-
src/app/globals.css | 5 ++
src/components/window/SideBar.tsx | 9 ++--
4 files changed, 94 insertions(+), 4 deletions(-)
create mode 100644 src/app/(main)/dynamic/page.tsx
diff --git a/src/app/(main)/dynamic/page.tsx b/src/app/(main)/dynamic/page.tsx
new file mode 100644
index 0000000..9f2c3a9
--- /dev/null
+++ b/src/app/(main)/dynamic/page.tsx
@@ -0,0 +1,82 @@
+"use client"
+
+import { MarkdownRender } from "@/components/markdown"
+import { Card, CardBody, CardHeader, CardIcon } from "@/components/window/Card"
+import { createClient } from "@/utils/supabase/client"
+import { NewspaperFolding } from "@icon-park/react"
+import useSWR from "swr"
+import { Chip, Skeleton } from "@heroui/react"
+
+export default function Page() {
+ return (
+
+
+
+
+ 动态
+
+ {/*
+ {}}>读取
+ */}
+
+
+
+
+
+
+ )
+}
+
+const ReleaseNotes = () => {
+ const noticeFetcher = async () => {
+ const supabase = createClient()
+ const { data /* , error */ } = await supabase
+ .from("ReleaseNote")
+ .select("version, content, created_at")
+ .eq("stable", true)
+ .order("created_at", { ascending: false })
+ .range(0, 10)
+
+ return data
+ }
+
+ const { data: releases /* , error */, isLoading } = useSWR("/api/release-notes", noticeFetcher)
+
+ if (isLoading) return (
+
+
+
+
+
+ )
+
+ return (
+
+ {releases?.map((release, index) => (
+ -
+ {/* */}
+
+
+
CS工具箱 {release.version}
+
+ {/*
+ 版本:{release?.version}
+ */}
+
+ 发布时间:
+ {release?.created_at ? new Date(release.created_at).toLocaleString() : "未知时间"}
+
+
+
+
+
+ {release?.content || "无内容"}
+
+
+
+ {/* */}
+
+ ))}
+
+ )
+}
diff --git a/src/app/(main)/home/page.tsx b/src/app/(main)/home/page.tsx
index b0f9bd5..8a70f48 100644
--- a/src/app/(main)/home/page.tsx
+++ b/src/app/(main)/home/page.tsx
@@ -13,7 +13,7 @@ const Home = () => {
-
+
diff --git a/src/app/globals.css b/src/app/globals.css
index 8054566..23138c7 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -21,3 +21,8 @@ a {
* {
box-sizing: border-box;
}
+
+/* 隐藏滚动条 */
+.hide-scrollbar::-webkit-scrollbar {
+ display: none;
+}
\ No newline at end of file
diff --git a/src/components/window/SideBar.tsx b/src/components/window/SideBar.tsx
index bd22caa..cb3335e 100644
--- a/src/components/window/SideBar.tsx
+++ b/src/components/window/SideBar.tsx
@@ -1,6 +1,6 @@
"use client"
-import { cn, user } from "@heroui/react"
-import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
+import { cn } from "@heroui/react"
+import { Home, MonitorOne, Movie, NewspaperFolding, Setting, Terminal, Toolkit } from "@icon-park/react"
import { usePathname, useRouter } from "next/navigation"
import type { ReactNode } from "react"
import { getVersion } from "@tauri-apps/api/app"
@@ -90,12 +90,15 @@ const SideBar = () => {