From 4fc648449d2275d34a4f94e8e2671d7d05125b1f Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Mon, 7 Jul 2025 11:48:51 -0700 Subject: implement chart view by ID, allow request by pbOnly --- .../components/displays/DancerushScoreDisplay.tsx | 38 ++++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'frontend/src/components/displays/DancerushScoreDisplay.tsx') diff --git a/frontend/src/components/displays/DancerushScoreDisplay.tsx b/frontend/src/components/displays/DancerushScoreDisplay.tsx index b030db7..4799787 100644 --- a/frontend/src/components/displays/DancerushScoreDisplay.tsx +++ b/frontend/src/components/displays/DancerushScoreDisplay.tsx @@ -7,6 +7,7 @@ interface Score { // eslint-disable-next-line @typescript-eslint/no-explicit-any [key: string]: any; timestamp: string | number; + username?: string; } interface ScoreDisplayProps { @@ -16,6 +17,8 @@ interface ScoreDisplayProps { sortDirection: "asc" | "desc"; onSort: (field: string) => void; onDelete?: (scoreId: number) => void; + showUsername?: boolean; + hideTitleArtist?: boolean; } const DancerushScoreDisplay: React.FC = ({ @@ -25,6 +28,8 @@ const DancerushScoreDisplay: React.FC = ({ sortDirection, onSort, onDelete, + showUsername = false, + hideTitleArtist = false, }) => { // Key mappings for better display names. Hit or miss const keyDisplayNames: Record = { @@ -42,6 +47,7 @@ const DancerushScoreDisplay: React.FC = ({ good: "Good", bad: "Bad", miss: "Miss", + username: "Username", }; const primaryKeys = ["title", "artist", "song"]; @@ -228,9 +234,8 @@ const DancerushScoreDisplay: React.FC = ({ // Prioritize important keys for table display const tableKeys = [ - "title", - "song", - "artist", + ...(hideTitleArtist ? [] : ["title", "song", "artist"]), + ...(showUsername ? ["username"] : []), "score", "difficulty", "lamp", @@ -277,12 +282,21 @@ const DancerushScoreDisplay: React.FC = ({ {/* Primary Info */}
-

- {score.title || score.song || "Unknown Title"} -

- {score.artist && ( -

- {score.artist} + {!hideTitleArtist && ( + <> +

+ {score.title || score.song || "Unknown Title"} +

+ {score.artist && ( +

+ {score.artist} +

+ )} + + )} + {showUsername && score.username && ( +

+ by {score.username}

)}
@@ -412,9 +426,13 @@ const DancerushScoreDisplay: React.FC = ({ : score[key], ).toLocaleDateString()} + ) : key === "username" ? ( + + {score[key] || "Unknown"} + ) : ( {renderValue(score[key], key)} -- cgit v1.2.3