daphnis/components/RecentChunithmScores/page.tsx

60 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-08-15 02:27:17 +00:00
import React, { FC } from "react";
import {
chuni_profile_rating,
chuni_static_music,
} from "@/prisma/schemas/artemis/generated/artemis";
2024-08-15 02:27:17 +00:00
type ChunithmRecent = chuni_profile_rating &
chuni_static_music & { rating: number; jacketPath: string | undefined };
type ChunithmProfileRecentPlays = {
chuniProfileRecentPlays: {
2024-08-15 02:27:17 +00:00
recentRating: ChunithmRecent[];
};
};
2024-08-15 02:27:17 +00:00
export const ChunithmRecentPlays: FC<ChunithmProfileRecentPlays> = ({
chuniProfileRecentPlays,
}) => {
return (
<div>
2024-08-15 02:27:17 +00:00
{chuniProfileRecentPlays.recentRating.map(
(playersRecentRatingList, index) => {
const jacketPath = playersRecentRatingList.jacketPath?.replace(
".dds",
".png",
);
return (
2024-08-15 02:31:58 +00:00
<div key={index} className="center flex p-2">
<div className="m-4 font-bold">{index + 1}.</div>
2024-08-15 02:27:17 +00:00
{jacketPath && (
<img
src={`/JacketArt/${jacketPath}`}
alt="Jacket"
style={{ width: "80px", height: "80px" }}
/>
)}
<div>
<ul className="pl-2">
<li>
<strong>Title:</strong> {playersRecentRatingList.title}
</li>
<li>
<strong>Score:</strong>{" "}
{playersRecentRatingList.score?.toLocaleString()}
</li>
<li>
<strong>Rating:</strong>{" "}
{(playersRecentRatingList.rating / 100).toFixed(2)}
</li>
</ul>
</div>
</div>
);
},
)}
</div>
);
};