diff --git a/app/(sharing)/[token]/[id]/page.tsx b/app/(sharing)/[token]/[id]/page.tsx index 45cb41e..bb3b96d 100644 --- a/app/(sharing)/[token]/[id]/page.tsx +++ b/app/(sharing)/[token]/[id]/page.tsx @@ -1,7 +1,8 @@ import { getAuth } from "@/auth/queries/getauth"; import { generatePlaylogId, getSongsWithTitles } from "@/lib/api"; import { shareScore } from "../token"; -import { getDifficultyClass, getDifficultyText } from "@/lib/helpers"; +import { getDifficultyClass, getDifficultyText, getGrade } from "@/lib/helpers"; +import { type chuni_score_playlog } from "@/prisma/schemas/artemis/generated/artemis"; export default async function Share({ params, @@ -30,32 +31,81 @@ export default async function Share({ const playlogIds = await generatePlaylogId(playlogId); // Filter songsData to match the playlogIds - const matchedSongs = songsData.filter((song) => playlogIds.includes(song.id)); + const matchedSongs: chuni_score_playlog[] = songsData.filter((song) => + playlogIds.includes(song.id) + ); return ( -
-
+
+
{matchedSongs.map((song) => ( -
-
-

Score: {song.score}

+
+
+
+ + {song.isNewRecord && "NEW RECORD!!"} + +
+

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

))}
-
-

Broccoli

+
+ {matchedSongs.map((song) => ( +
+
+ + {song.isNewRecord && "NEW!!"} + +
+
+ + {getGrade(song.score ?? 0)} + +
+
+ ))}
-
-

Tamago

+
+ {matchedSongs.map((song) => ( +
+
+ + {song.isFullCombo && "FULL COMBO"} + + + Max combo: {song.maxCombo} + +
+
+ ))}
- -
-

Pork

+
+ {matchedSongs.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 1b30b6a..1006671 100644 --- a/components/scoreplaylog/colums.tsx +++ b/components/scoreplaylog/colums.tsx @@ -16,37 +16,33 @@ import { Badge } from "@/components/ui/badge"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { generateShareToken } from "@/app/(sharing)/[token]/token"; -export type Song = { - title: string; - artist: string; - score?: number | null; - userPlayDate: string | null; - isFullCombo: boolean | null; - isAllJustice: boolean | null; - id: number; -}; -export const columns: ColumnDef[] = [ +import { chuni_score_playlog } from "@/prisma/schemas/artemis/generated/artemis"; +import { chuni_static_music } from "@/prisma/schemas/artemis/generated/artemis"; + +export const columns: ColumnDef[] = [ { accessorKey: "title", header: "Title", cell: ({ row }) => (
-
+
{row.original.title} {row.original.isFullCombo && ( Full Combo )} {row.original.isAllJustice && ( - + All Justice )} + {row.original.isNewRecord && ( + New!! + )}
- -
+
{row.original.artist}
@@ -68,14 +64,13 @@ export const columns: ColumnDef[] = [ const song = row.original; const [error, setError] = useState(""); const router = useRouter(); - - + const handleGenerateShareToken = async () => { const { token, error } = await generateShareToken(row.original.id); if (error) { setError(error); } else { - const newTab = window.open(`/${token}/${row.original.id}`, '_blank'); + const newTab = window.open(`/${token}/${row.original.id}`, "_blank"); if (newTab) { newTab.focus(); } else { @@ -96,7 +91,9 @@ export const columns: ColumnDef[] = [ Actions navigator.clipboard.writeText(song.title)} + onClick={() => + song.title && navigator.clipboard.writeText(song.title) + } > Copy song title