import { getAuth } from "@/auth/queries/getauth"; import { generatePlaylogId, getSongsWithTitles } from "@/lib/api"; import { shareScore } from "../token"; import { getDifficultyClass, getDifficultyText } from "@/lib/helpers"; export default async function Share({ params, }: { params: { token: string; id: string }; }) { const { token, id } = params; // Verify the token const tokenResult = await shareScore(token); if (tokenResult.error) { return

{tokenResult.error}

; } const { user } = await getAuth(); if (!user?.UserId) { return

Error: No user ID found.

; } const userId = user?.UserId; const playlogId = parseInt(id); const songsData = await getSongsWithTitles(userId); const playlogIds = await generatePlaylogId(playlogId); // Filter songsData to match the playlogIds const matchedSongs = songsData.filter((song) => playlogIds.includes(song.id)); return (

Salmon

Broccoli

Tamago

Pork

Edamame

//
//
// {matchedSongs.map((song) => ( //
//
//

{song.title}

//

Artist: {song.artist}

//

Genre: {song.genre}

//

diff: {song.chartlevel}

//

Level: {song.level}

//

Full Combo: {song.isFullCombo ? "Yes" : "No"}

//

Score: {song.score}

//
// // {getDifficultyText(song.chartId)} // //
//
//
// ))} //
); }