diff --git a/src/app/[lang]/tag/[id]/page.tsx b/src/app/[lang]/tag/[id]/page.tsx index c14992b7..b4fe4f95 100644 --- a/src/app/[lang]/tag/[id]/page.tsx +++ b/src/app/[lang]/tag/[id]/page.tsx @@ -12,8 +12,8 @@ import { import { HeaderMain } from "~/components/ui/header"; import { api } from "~/trpc/server"; import { type Metadata } from "next"; -import { TagBasic } from "./components/basic"; import { cn } from "~/utils"; +import { Button } from "~/components/ui/button"; interface Props { params: { id: string; lang: Locale }; @@ -101,6 +101,9 @@ export default async function TagDetailPage(props: Props) { const rank = statistics.map((item) => item[0]!.author.id); + const max = statistics[0]?.length || 0; + const first = statistics[0]![0]; + return ( <> @@ -134,57 +137,95 @@ export default async function TagDetailPage(props: Props) { -
-

{tag.name}

- -
+
+

{tag.name}

+

{tag.introduce}

+ +
+
+

统计

+

+ 共收录了{" "} + + {total} + {" "} + 首诗,诗人{" "} + + {statistics.length} + {" "} + 位。 其中,最多的诗人是{" "} + {first?.author.name} + ,共有{" "} + + {max} + {" "} + 首诗。 +

+ +
+ {statistics.slice(0, 10).map((item, index) => { + const poem = item[0]!; + + return ( +
4, + })} + > +
+
+ {item.length} +
+
+
+ {poem.author.name} +
+
+ ); + })} +
+
+
+
-
+
{rank.map((key) => { const item = json[key]!; const author = item[0]!.author; return ( -
-

+
+

{author.name}{" "} - + {author.namePinYin} -

-
    +

+
{item?.map((poem) => ( - - {poem.title} - + + {poem.title} + + ))} - +
); })} diff --git a/src/utils/index.ts b/src/utils/index.ts index 19e63d20..918b3ba3 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -10,3 +10,17 @@ export function isMobile() { } export const MyHost = `https://aspoem.com`; + +/** 可用其他颜色 */ +export const colors = [ + "text-blue-500", + "text-yellow-500", + "text-purple-500", + "text-green-500", + "text-pink-500", + "text-indigo-500", + "text-teal-500", + "text-cyan-500", + "text-lime-500", + "text-orange-500", +];