From 30c03e267267770ffba33e050d41b38e8b6f2213 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 23 Oct 2025 11:32:59 -0700 Subject: refactor: drs,around,diva display cleanup logic --- .../displays/DancearoundScoreDisplay.tsx | 16 ++++------ .../components/displays/DancerushScoreDisplay.tsx | 8 ++--- .../src/components/displays/DivaScoreDisplay.tsx | 34 +++------------------- 3 files changed, 11 insertions(+), 47 deletions(-) (limited to 'frontend') diff --git a/frontend/src/components/displays/DancearoundScoreDisplay.tsx b/frontend/src/components/displays/DancearoundScoreDisplay.tsx index a2d18f8..a98179d 100644 --- a/frontend/src/components/displays/DancearoundScoreDisplay.tsx +++ b/frontend/src/components/displays/DancearoundScoreDisplay.tsx @@ -37,20 +37,16 @@ const DancearoundScoreDisplay: React.FC = ({ }) => { // Key mappings for better display names. Hit or miss const keyDisplayNames: Record = { - title: "Title", - artist: "Artist", score: "Score", - difficulty: "Difficulty Level", + difficulty: "Difficulty", lamp: "Rank", - diff_lamp: "Chart Difficulty", - timestamp: "Date", + level: "Level", judgements: "Judgements", maxCombo: "Max Combo", perfect: "Perfect", great: "Great", good: "Good", bad: "Bad", - miss: "Miss", username: "Username", clear_status: "Status" }; @@ -58,11 +54,10 @@ const DancearoundScoreDisplay: React.FC = ({ const mainStatKeys = [ "score", "difficulty", + "level", "lamp", - "diff_lamp", ]; const expandableKeys = ["judgements", "optional", "clear_status"]; - const localSkipKeys = ["num_players"] // eslint-disable-next-line @typescript-eslint/no-explicit-any const formatValue = (value: any, key: string): string => { if (value === null || value === undefined) return "N/A"; @@ -178,7 +173,7 @@ const DancearoundScoreDisplay: React.FC = ({ const getScoreEntries = (score: Score) => { const entries = Object.entries(score).filter( - ([key]) => !globalSkipKeys.includes(key) && !localSkipKeys.includes(key), + ([key]) => !globalSkipKeys.includes(key) && key !== "num_players", ); const mainStats = entries.filter(([key]) => mainStatKeys.includes(key)); @@ -227,7 +222,7 @@ const DancearoundScoreDisplay: React.FC = ({ // Get all possible keys for table headers const allKeys = Array.from( new Set(scores.flatMap((score) => Object.keys(score))), - ).filter((key) => !globalSkipKeys.includes(key) && !localSkipKeys.includes(key)); + ).filter((key) => !globalSkipKeys.includes(key) && key !== "num_players"); // Prioritize important keys for table display const tableKeys = [ @@ -268,7 +263,6 @@ const DancearoundScoreDisplay: React.FC = ({ return (
{sortedScores.map((score, index) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { mainStats, expandable, timestamp } = getScoreEntries(score); const chartIdHash = SHA1(`dancearound${score.title}${score.artist}`).toString(); diff --git a/frontend/src/components/displays/DancerushScoreDisplay.tsx b/frontend/src/components/displays/DancerushScoreDisplay.tsx index fb31870..fcdc254 100644 --- a/frontend/src/components/displays/DancerushScoreDisplay.tsx +++ b/frontend/src/components/displays/DancerushScoreDisplay.tsx @@ -37,10 +37,8 @@ const DancerushScoreDisplay: React.FC = ({ }) => { // Key mappings for better display names. Hit or miss const keyDisplayNames: Record = { - title: "Title", - artist: "Artist", score: "Score", - difficulty: "Difficulty Number", + difficulty: "Level", lamp: "Rank", diff_lamp: "Chart Difficulty", timestamp: "Date", @@ -50,7 +48,6 @@ const DancerushScoreDisplay: React.FC = ({ great: "Great", good: "Good", bad: "Bad", - miss: "Miss", username: "Username", num_players: "Players" }; @@ -61,7 +58,7 @@ const DancerushScoreDisplay: React.FC = ({ "lamp", "diff_lamp", ]; - const expandableKeys = ["judgements", "optional"]; + const expandableKeys = ["judgements", "optional", "num_players"]; // eslint-disable-next-line @typescript-eslint/no-explicit-any const formatValue = (value: any, key: string): string => { if (value === null || value === undefined) return "N/A"; @@ -272,7 +269,6 @@ const DancerushScoreDisplay: React.FC = ({ return (
{sortedScores.map((score, index) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const { mainStats, expandable, timestamp } = getScoreEntries(score); const chartIdHash = SHA1(`dancerush${score.title}${score.artist}`).toString(); diff --git a/frontend/src/components/displays/DivaScoreDisplay.tsx b/frontend/src/components/displays/DivaScoreDisplay.tsx index 74dd431..2646b6b 100644 --- a/frontend/src/components/displays/DivaScoreDisplay.tsx +++ b/frontend/src/components/displays/DivaScoreDisplay.tsx @@ -44,8 +44,6 @@ const DivaScoreDisplay: React.FC = ({ }) => { // Key mappings for better display names. Hit or miss const keyDisplayNames: Record = { - title: "Title", - artist: "Artist", score: "SCORE", difficulty: "Difficulty Rating", lamp: "CLEAR RANK", @@ -53,13 +51,7 @@ const DivaScoreDisplay: React.FC = ({ timestamp: "Date", judgements: "Judgements", maxCombo: "Max Combo", - perfect: "Perfect", - great: "Great", - good: "Good", - bad: "Bad", - miss: "Miss", username: "Username", - num_players: "Players" }; const mainStatKeys = [ @@ -69,6 +61,7 @@ const DivaScoreDisplay: React.FC = ({ "diff_lamp", ]; const expandableKeys = ["judgements", "optional"]; + const gameParam = new URLSearchParams(window.location.search).get("game") || "diva"; // eslint-disable-next-line @typescript-eslint/no-explicit-any const formatValue = (value: any, key: string): string => { if (value === null || value === undefined) return "N/A"; @@ -318,10 +311,9 @@ const DivaScoreDisplay: React.FC = ({ return (
{sortedScores.map((score, index) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { mainStats, expandable, others, timestamp } = + const chartIdHash = SHA1(`${gameParam}${score.title}${score.artist}`).toString(); + const { mainStats, expandable, timestamp } = getScoreEntries(score); - const chartIdHash = SHA1(`diva${score.title}${score.artist}`).toString(); return (
= ({
{!hideTitleArtist && ( - +

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

@@ -376,24 +368,6 @@ const DivaScoreDisplay: React.FC = ({
))} - {/* Other fields */} - {others.length > 0 && ( -
-
- {others.map(([key, value]) => ( -
- - {getDisplayName(key)}: - - - {renderValue(value, key)} - -
- ))} -
-
- )} - {/* Timestamp */}

-- cgit v1.2.3