From e1a9760b3806618b4622309f62cefcdd3bc00c49 Mon Sep 17 00:00:00 2001 From: polaris Date: Sat, 6 Jul 2024 23:57:37 -0400 Subject: [PATCH] redesigned share page and change type names --- app/(sharing)/[token]/[id]/page.tsx | 115 ++++++++++++++++------------ components/scoreplaylog/colums.tsx | 4 +- 2 files changed, 66 insertions(+), 53 deletions(-) diff --git a/app/(sharing)/[token]/[id]/page.tsx b/app/(sharing)/[token]/[id]/page.tsx index bb3b96d..ccaa765 100644 --- a/app/(sharing)/[token]/[id]/page.tsx +++ b/app/(sharing)/[token]/[id]/page.tsx @@ -2,7 +2,13 @@ import { getAuth } from "@/auth/queries/getauth"; import { generatePlaylogId, getSongsWithTitles } from "@/lib/api"; import { shareScore } from "../token"; import { getDifficultyClass, getDifficultyText, getGrade } from "@/lib/helpers"; -import { type chuni_score_playlog } from "@/prisma/schemas/artemis/generated/artemis"; +import { + type chuni_score_playlog, + chuni_static_music, +} from "@/prisma/schemas/artemis/generated/artemis"; + +type chunithm = chuni_score_playlog & + chuni_static_music & { playCount: number }; export default async function Share({ params, @@ -31,83 +37,90 @@ export default async function Share({ const playlogIds = await generatePlaylogId(playlogId); // Filter songsData to match the playlogIds - const matchedSongs: chuni_score_playlog[] = songsData.filter((song) => + const chunithm: chunithm[] = songsData.filter((song) => playlogIds.includes(song.id) ); return ( -
-
- {matchedSongs.map((song) => ( -
-
-
- - {song.isNewRecord && "NEW RECORD!!"} - -
-

- {" "} - {song.score?.toLocaleString()} -

-
+
+
+ {chunithm.map((song) => ( +
+ + {song.isNewRecord && "NEW RECORD!!"} + + + Song: {song.title} +
))}
-
- {matchedSongs.map((song) => ( +
+ {chunithm.map((song) => (
-
- - {song.isNewRecord && "NEW!!"} - -
-
- - {getGrade(song.score ?? 0)} - -
+ + {song.isNewRecord && "NEW RECORD!!"} + + + Artist: {song.artist} +
))}
-
- {matchedSongs.map((song) => ( +
+ {chunithm.map((song) => (
-
- - {song.isFullCombo && "FULL COMBO"} - - - Max combo: {song.maxCombo} - -
+ + {song.isNewRecord && "NEW RECORD!!"} + + + Score: {song.score?.toLocaleString()} +
))}
-
- {matchedSongs.map((song) => ( -
-
- + +
+ {chunithm.map((song) => ( +
+ + Rank: {getGrade(song.score ?? 0)} + +
+ ))} +
+ +
+ {chunithm.map((song) => ( +
+ + {song.isFullCombo && "FULL COMBO"} + + + Max combo: {song.maxCombo} + +
+ ))} +
+ +
+ {chunithm.map((song) => ( +
+
+ Judge Justice: {song.judgeJustice} Judge Attack: {song.judgeAttack} - + Miss: {song.judgeGuilty}
))}
-
-

Edamame

-
); } diff --git a/components/scoreplaylog/colums.tsx b/components/scoreplaylog/colums.tsx index f1fe2d4..f5ae304 100644 --- a/components/scoreplaylog/colums.tsx +++ b/components/scoreplaylog/colums.tsx @@ -21,10 +21,10 @@ import { chuni_score_playlog } from "@/prisma/schemas/artemis/generated/artemis" import { chuni_static_music } from "@/prisma/schemas/artemis/generated/artemis"; import { getGrade } from "@/lib/helpers"; -type includesPlayCount = chuni_score_playlog & +type chunithm = chuni_score_playlog & chuni_static_music & { playCount: number }; -export const columns: ColumnDef[] = [ +export const columns: ColumnDef[] = [ { accessorKey: "title", header: "Title",