daphnis/components/userRatingBaseList/page.tsx

76 lines
2.1 KiB
TypeScript
Raw Permalink 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:42:19 +00:00
chartId: string | 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:42:19 +00:00
difficultId: number | null;
2024-08-15 03:10:24 +00:00
score: number | null;
};
2024-08-16 19:08:33 +00:00
type chunithmTopPlays = {
chuniProfileTopPlays: {
topPlays: userRatingBaseList[];
};
};
2024-08-17 02:00:51 +00:00
2024-08-16 19:08:33 +00:00
export const ChunithmTopPlays: FC<chunithmTopPlays> = ({
chuniProfileTopPlays,
2024-08-15 02:27:17 +00:00
}) => {
return (
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8">
{" "}
2024-08-16 19:08:33 +00:00
{chuniProfileTopPlays.topPlays.map((chuniProfileTopPlays, index) => {
const jacketPath = chuniProfileTopPlays.jacketPath?.replace(
".dds",
".png",
);
return (
2024-08-17 02:00:51 +00:00
<div key={index} className="flex flex-col items-center p-2">
<div className="font-bold"></div>
2024-08-16 19:08:33 +00:00
{jacketPath && (
<img
src={`/jacketArts/${jacketPath}`}
2024-08-16 19:08:33 +00:00
alt="Jacket"
2024-08-17 02:00:51 +00:00
className="h-28 w-28"
2024-08-16 19:08:33 +00:00
/>
)}
2024-08-17 02:00:51 +00:00
<ul className="mt-2 text-center">
<li>
<strong>Title: </strong> {chuniProfileTopPlays.title}
</li>
<li>
<strong>Level: </strong> {chuniProfileTopPlays.level}
</li>
<li>
<strong>Difficulty: </strong>{" "}
{getDifficultyText(Number(chuniProfileTopPlays.chartId))}
</li>
<li>
<strong>Score: </strong>{" "}
{chuniProfileTopPlays.score?.toLocaleString()}
</li>
<li>
<strong>Rating: </strong>{" "}
{(chuniProfileTopPlays.rating / 100).toFixed(2)}
</li>
</ul>
2024-08-16 19:08:33 +00:00
</div>
);
})}
</div>
);
};