From db1140ebce2c1a8ac473a01d719c48c245b00119 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 23 Oct 2025 11:50:05 -0700 Subject: refactor: more display refactor, remove invisible mainkey mappings --- .../displays/DancearoundScoreDisplay.tsx | 2 ++ .../components/displays/DancerushScoreDisplay.tsx | 2 ++ .../src/components/displays/DivaScoreDisplay.tsx | 7 +++++ .../components/displays/MusicDiverScoreDisplay.tsx | 28 ++++------------- .../components/displays/NostalgiaScoreDisplay.tsx | 32 ++++++-------------- .../components/displays/ReflecBeatScoreDisplay.tsx | 35 ++++------------------ 6 files changed, 31 insertions(+), 75 deletions(-) (limited to 'frontend/src') diff --git a/frontend/src/components/displays/DancearoundScoreDisplay.tsx b/frontend/src/components/displays/DancearoundScoreDisplay.tsx index a98179d..28ba9ed 100644 --- a/frontend/src/components/displays/DancearoundScoreDisplay.tsx +++ b/frontend/src/components/displays/DancearoundScoreDisplay.tsx @@ -37,6 +37,8 @@ const DancearoundScoreDisplay: React.FC = ({ }) => { // Key mappings for better display names. Hit or miss const keyDisplayNames: Record = { + title: "Title", + artist: "Artist", score: "Score", difficulty: "Difficulty", lamp: "Rank", diff --git a/frontend/src/components/displays/DancerushScoreDisplay.tsx b/frontend/src/components/displays/DancerushScoreDisplay.tsx index fcdc254..d1350ad 100644 --- a/frontend/src/components/displays/DancerushScoreDisplay.tsx +++ b/frontend/src/components/displays/DancerushScoreDisplay.tsx @@ -37,6 +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: "Level", lamp: "Rank", diff --git a/frontend/src/components/displays/DivaScoreDisplay.tsx b/frontend/src/components/displays/DivaScoreDisplay.tsx index 2646b6b..ddbdf0c 100644 --- a/frontend/src/components/displays/DivaScoreDisplay.tsx +++ b/frontend/src/components/displays/DivaScoreDisplay.tsx @@ -44,11 +44,18 @@ 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", diff_lamp: "Chart Difficulty", timestamp: "Date", + sad: "Sad", + cool: "Cool", + fine: "Fine", + safe: "Safe", + worst: "Worst", judgements: "Judgements", maxCombo: "Max Combo", username: "Username", diff --git a/frontend/src/components/displays/MusicDiverScoreDisplay.tsx b/frontend/src/components/displays/MusicDiverScoreDisplay.tsx index 2b7d186..dcc57e3 100644 --- a/frontend/src/components/displays/MusicDiverScoreDisplay.tsx +++ b/frontend/src/components/displays/MusicDiverScoreDisplay.tsx @@ -37,32 +37,18 @@ const MusicDiverDisplay: React.FC = ({ artist: "Artist", score: "Score", difficulty: "Difficulty", - lamp: "Lamp", diff_lamp: "Lamp", timestamp: "Date", judgements: "Judgements", - maxCombo: "Max Combo", perfect: "Perfect", great: "Great", good: "Good", bad: "Bad", miss: "Miss", - rating: "Rating", - percent: "Percent", - chart: "Chart", - song: "Song", - ranking: "Ranking", - combo: "Combo", - grade: "Grade", + critical: "Critical", level: "Level", - bpm: "BPM", - notes: "Notes", - duration: "Duration", - playcount: "Play Count", date: "Date", - time: "Time", username: "Username", - num_players: "Players" }; const mainStatKeys = [ @@ -76,9 +62,7 @@ const MusicDiverDisplay: React.FC = ({ "grade", ]; const expandableKeys = ["judgements", "optional"]; - const skipKeys = ["user", "username"] - // get ?game= - const internalGameName =new URLSearchParams(window.location.search).get("game") || "dancerush"; + const gameParam = new URLSearchParams(window.location.search).get("game") || "musicdiver"; // eslint-disable-next-line @typescript-eslint/no-explicit-any const formatValue = (value: any, key: string): string => { if (value === null || value === undefined) return "N/A"; @@ -270,11 +254,9 @@ const MusicDiverDisplay: React.FC = ({ return (
{sortedScores.map((score, index) => { - const chartIdHash = SHA1(`${internalGameName}${score.title}${score.artist}`).toString(); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { mainStats, expandable, others: rawOthers, timestamp } = + const chartIdHash = SHA1(`${gameParam}${score.title}${score.artist}`).toString(); + const { mainStats, expandable, others, timestamp } = getScoreEntries(score); - const others = rawOthers.filter(([key]) => !skipKeys.includes(key)); return ( @@ -286,7 +268,7 @@ const MusicDiverDisplay: React.FC = ({
{!hideTitleArtist && ( - +

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

diff --git a/frontend/src/components/displays/NostalgiaScoreDisplay.tsx b/frontend/src/components/displays/NostalgiaScoreDisplay.tsx index bb01379..063d449 100644 --- a/frontend/src/components/displays/NostalgiaScoreDisplay.tsx +++ b/frontend/src/components/displays/NostalgiaScoreDisplay.tsx @@ -38,31 +38,21 @@ const NostalgiaScoreDisplay: React.FC = ({ score: "Score", difficulty: "Difficulty", lamp: "Lamp", - diff_lamp: "Lamp", timestamp: "Date", judgements: "Judgements", maxCombo: "Max Combo", perfect: "Perfect", - great: "Great", + fast: "Fast", + slow: "Slow", good: "Good", - bad: "Bad", + just: "Just", miss: "Miss", - rating: "Rating", - percent: "Percent", - chart: "Chart", - song: "Song", - ranking: "Ranking", - combo: "Combo", - grade: "Grade", + near: "Near", + marvelous: "Marvelous", level: "Level", - bpm: "BPM", notes: "Notes", - duration: "Duration", - playcount: "Play Count", date: "Date", - time: "Time", username: "Username", - num_players: "Players" }; const mainStatKeys = [ @@ -77,9 +67,7 @@ const NostalgiaScoreDisplay: React.FC = ({ "level" ]; const expandableKeys = ["judgements", "optional"]; - const skipKeys = ["user", "username"] - // get ?game= - const internalGameName =new URLSearchParams(window.location.search).get("game") || "dancerush"; + const gameParam = new URLSearchParams(window.location.search).get("game") || "nostalgia"; // 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,11 +260,9 @@ const NostalgiaScoreDisplay: React.FC = ({ return (
{sortedScores.map((score, index) => { - const chartIdHash = SHA1(`${internalGameName}${score.title}${score.artist}`).toString(); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { mainStats, expandable, others: rawOthers, timestamp } = + const chartIdHash = SHA1(`${gameParam}${score.title}${score.artist}`).toString(); + const { mainStats, expandable, others, timestamp } = getScoreEntries(score); - const others = rawOthers.filter(([key]) => !skipKeys.includes(key)); return ( @@ -288,7 +274,7 @@ const NostalgiaScoreDisplay: React.FC = ({
{!hideTitleArtist && ( - +

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

diff --git a/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx b/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx index b11983e..9de1403 100644 --- a/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx +++ b/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx @@ -39,49 +39,28 @@ const ReflecBeatScoreDisplay: React.FC = ({ difficulty: "Difficulty", lifeLeft: "Life Remaining", lamp: "Lamp", - diff_lamp: "Lamp", timestamp: "Date", judgements: "Judgements", - maxCombo: "Max Combo", - perfect: "Perfect", + justreflec: "JustReflec", + just: "Just", great: "Great", good: "Good", - bad: "Bad", miss: "Miss", scorePercent: "Score %", - rating: "Rating", - percent: "Percent", - chart: "Chart", - song: "Song", - ranking: "Ranking", - combo: "Combo", - grade: "Grade", level: "Level", - bpm: "BPM", - notes: "Notes", - duration: "Duration", - playcount: "Play Count", date: "Date", time: "Time", username: "Username", - num_players: "Players" }; const mainStatKeys = [ "score", "difficulty", "lamp", - "rank", - "diff_lamp", - "percent", - "rating", - "grade", "scorePercent" ]; const expandableKeys = ["judgements", "optional"]; - const skipKeys = ["user", "username"] - // get ?game= - const internalGameName =new URLSearchParams(window.location.search).get("game") || "dancerush"; + const gameParam = new URLSearchParams(window.location.search).get("game") || "reflecbeat"; // eslint-disable-next-line @typescript-eslint/no-explicit-any const formatValue = (value: any, key: string): string => { if (value === null || value === undefined) return "N/A"; @@ -278,11 +257,9 @@ const ReflecBeatScoreDisplay: React.FC = ({ return (
{sortedScores.map((score, index) => { - const chartIdHash = SHA1(`${internalGameName}${score.title}${score.artist}`).toString(); - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { mainStats, expandable, others: rawOthers, timestamp } = + const chartIdHash = SHA1(`${gameParam}${score.title}${score.artist}`).toString(); + const { mainStats, expandable, others, timestamp } = getScoreEntries(score); - const others = rawOthers.filter(([key]) => !skipKeys.includes(key)); return ( @@ -294,7 +271,7 @@ const ReflecBeatScoreDisplay: React.FC = ({
{!hideTitleArtist && ( - +

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

-- cgit v1.2.3