"use client"; import React, { FC, useState } from "react"; import { getDifficultyText } from "@/lib/helpers"; import { Skeleton } from "../ui/skeleton"; type userRatingBaseList = { title: string; artist: string; genre: string; chartId: string | number; level: string | number; jacketPath: string; rating: number; version: number; index: number; musicId: number | null; difficultId: number | null; score: number | null; }; type chunithmTopPlays = { chuniProfileTopPlays: { topPlays: userRatingBaseList[]; }; }; export const ChunithmTopPlays: FC = ({ chuniProfileTopPlays, }) => { return (
{" "} {chuniProfileTopPlays.topPlays.map((chuniProfileTopPlays, index) => { const [isLoading, setIsLoading] = useState(true); const jacketPath = chuniProfileTopPlays.jacketPath?.replace( ".dds", ".png", ); const handleImageLoad = () => { setIsLoading(false); }; const handleImageError = () => { setIsLoading(false); }; return (
{jacketPath && ( <> Jacket {isLoading && ( )} )} {!jacketPath && ( )}
  • Title: {chuniProfileTopPlays.title}
  • Level: {chuniProfileTopPlays.level}
  • Difficulty: {" "} {getDifficultyText(Number(chuniProfileTopPlays.chartId))}
  • Score: {" "} {chuniProfileTopPlays.score?.toLocaleString()}
  • Rating: {" "} {(chuniProfileTopPlays.rating / 100).toFixed(2)}
); })}
); };