daphnis/components/RecentChunithmScores/page.tsx

79 lines
2.2 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 04:35:04 +00:00
import { getDifficultyText } from "@/lib/helpers";
2024-08-15 03:10:24 +00:00
type userRatingBaseList = {
title: string;
artist: string;
genre: string;
2024-08-15 04:35:04 +00:00
chartId: number;
2024-08-15 03:10:24 +00:00
level: string | number;
jacketPath: string;
rating: number;
version: number;
index: number;
musicId: number | null;
2024-08-15 04:35:04 +00:00
difficultId: string;
2024-08-15 03:10:24 +00:00
score: number | null;
};
type ChunithmProfileRecentPlays = {
chuniProfileRecentPlays: {
2024-08-15 03:10:24 +00:00
recentRating: userRatingBaseList[];
};
};
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"
2024-08-15 04:35:04 +00:00
style={{ width: "120px", height: "120px" }}
2024-08-15 02:27:17 +00:00
/>
)}
<div>
<ul className="pl-2">
<li>
2024-08-15 04:35:04 +00:00
<strong>Title: </strong> {playersRecentRatingList.title}
2024-08-15 02:27:17 +00:00
</li>
<li>
2024-08-15 04:35:04 +00:00
<strong>Level: </strong> {playersRecentRatingList.level}
</li>
<li>
<strong>Difficulty: </strong>
{getDifficultyText(playersRecentRatingList.chartId)}
</li>
<li>
<strong>Score: </strong>{" "}
2024-08-15 02:27:17 +00:00
{playersRecentRatingList.score?.toLocaleString()}
</li>
<li>
2024-08-15 04:35:04 +00:00
<strong>Rating: </strong>{" "}
2024-08-15 02:27:17 +00:00
{(playersRecentRatingList.rating / 100).toFixed(2)}
</li>
</ul>
</div>
</div>
);
},
)}
</div>
);
};