aboutsummaryrefslogtreecommitdiffstats
path: root/frontend
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-11-07 12:56:30 -0800
committerPinapelz <yukais@pinapelz.com>2025-11-07 12:56:30 -0800
commitce0227d3ad947253031122a2e7e2807ec7f96fa4 (patch)
tree12ff91b19fb82d90bca16bb10fe23a1a0f953951 /frontend
parentbd525aaba017deb95415c28ea6725ddc1dae7890 (diff)
chore: change ScoreDisplayProps and Score to be shared types
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/components/displays/DancearoundScoreDisplay.tsx19
-rw-r--r--frontend/src/components/displays/DancerushScoreDisplay.tsx18
-rw-r--r--frontend/src/components/displays/DivaScoreDisplay.tsx19
-rw-r--r--frontend/src/components/displays/GenericScoreDisplay.tsx19
-rw-r--r--frontend/src/components/displays/MusicDiverScoreDisplay.tsx18
-rw-r--r--frontend/src/components/displays/NostalgiaScoreDisplay.tsx19
-rw-r--r--frontend/src/components/displays/ReflecBeatScoreDisplay.tsx19
-rw-r--r--frontend/src/types/game.ts18
8 files changed, 25 insertions, 124 deletions
diff --git a/frontend/src/components/displays/DancearoundScoreDisplay.tsx b/frontend/src/components/displays/DancearoundScoreDisplay.tsx
index 28ba9ed..b426d96 100644
--- a/frontend/src/components/displays/DancearoundScoreDisplay.tsx
+++ b/frontend/src/components/displays/DancearoundScoreDisplay.tsx
@@ -1,30 +1,13 @@
import React from "react";
import {Link} from "react-router";
import { globalSkipKeys } from "../../types/constants";
+import type {Score, ScoreDisplayProps} from "../../types/game";
import lampExcellent from "../../assets/games/dancearound/grade_excellent.webp";
import lampFullcombo from "../../assets/games/dancearound/grade_fullcombo.webp";
import lampClear from "../../assets/games/dancearound/grade_clear.webp";
import lampFailure from "../../assets/games/dancearound/grade_failed.webp";
import SHA1 from "crypto-js/sha1";
-interface Score {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [key: string]: any;
- timestamp: string | number;
- username?: string;
-}
-
-interface ScoreDisplayProps {
- scores: Score[];
- viewMode: "cards" | "table";
- sortField: string;
- sortDirection: "asc" | "desc";
- onSort: (field: string) => void;
- onDelete?: (scoreId: number) => void;
- showUsername?: boolean;
- hideTitleArtist?: boolean;
-}
-
const DancearoundScoreDisplay: React.FC<ScoreDisplayProps> = ({
scores,
viewMode,
diff --git a/frontend/src/components/displays/DancerushScoreDisplay.tsx b/frontend/src/components/displays/DancerushScoreDisplay.tsx
index d1350ad..2aaebf4 100644
--- a/frontend/src/components/displays/DancerushScoreDisplay.tsx
+++ b/frontend/src/components/displays/DancerushScoreDisplay.tsx
@@ -1,29 +1,13 @@
import React from "react";
import {Link} from "react-router";
import { globalSkipKeys } from "../../types/constants";
+import type {Score, ScoreDisplayProps} from "../../types/game";
import dancerushEasyImg from "../../assets/games/dancerush/easy.webp";
import dancerushNormalImg from "../../assets/games/dancerush/normal.webp";
import p1_img from "../../assets/games/dancerush/1_p.webp";
import p2_img from "../../assets/games/dancerush/2_p.webp";
import SHA1 from "crypto-js/sha1";
-interface Score {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [key: string]: any;
- timestamp: string | number;
- username?: string;
-}
-
-interface ScoreDisplayProps {
- scores: Score[];
- viewMode: "cards" | "table";
- sortField: string;
- sortDirection: "asc" | "desc";
- onSort: (field: string) => void;
- onDelete?: (scoreId: number) => void;
- showUsername?: boolean;
- hideTitleArtist?: boolean;
-}
const DancerushScoreDisplay: React.FC<ScoreDisplayProps> = ({
scores,
diff --git a/frontend/src/components/displays/DivaScoreDisplay.tsx b/frontend/src/components/displays/DivaScoreDisplay.tsx
index ddbdf0c..a7b4824 100644
--- a/frontend/src/components/displays/DivaScoreDisplay.tsx
+++ b/frontend/src/components/displays/DivaScoreDisplay.tsx
@@ -1,6 +1,7 @@
import React from "react";
import {Link} from "react-router";
import { globalSkipKeys } from "../../types/constants";
+import type {Score, ScoreDisplayProps} from "../../types/game";
import SHA1 from "crypto-js/sha1";
import easyImg from "../../assets/games/diva/easy.webp";
import normalImg from "../../assets/games/diva/normal.webp";
@@ -14,24 +15,6 @@ import greatImg from "../../assets/games/diva/great.webp";
import excellentImg from "../../assets/games/diva/excellent.webp";
-interface Score {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [key: string]: any;
- timestamp: string | number;
- username?: string;
-}
-
-interface ScoreDisplayProps {
- scores: Score[];
- viewMode: "cards" | "table";
- sortField: string;
- sortDirection: "asc" | "desc";
- onSort: (field: string) => void;
- onDelete?: (scoreId: number) => void;
- showUsername?: boolean;
- hideTitleArtist?: boolean;
-}
-
const DivaScoreDisplay: React.FC<ScoreDisplayProps> = ({
scores,
viewMode,
diff --git a/frontend/src/components/displays/GenericScoreDisplay.tsx b/frontend/src/components/displays/GenericScoreDisplay.tsx
index 6132a19..defeb82 100644
--- a/frontend/src/components/displays/GenericScoreDisplay.tsx
+++ b/frontend/src/components/displays/GenericScoreDisplay.tsx
@@ -2,24 +2,7 @@ import React from "react";
import SHA1 from "crypto-js/sha1";
import { Link } from "react-router";
import { globalSkipKeys } from "../../types/constants";
-
-interface Score {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [key: string]: any;
- timestamp: string | number;
- username?: string;
-}
-
-interface ScoreDisplayProps {
- scores: Score[];
- viewMode: "cards" | "table";
- sortField: string;
- sortDirection: "asc" | "desc";
- onSort: (field: string) => void;
- onDelete?: (scoreId: number) => void;
- showUsername?: boolean;
- hideTitleArtist?: boolean;
-}
+import type {Score, ScoreDisplayProps} from "../../types/game";
const ScoreDisplay: React.FC<ScoreDisplayProps> = ({
scores,
diff --git a/frontend/src/components/displays/MusicDiverScoreDisplay.tsx b/frontend/src/components/displays/MusicDiverScoreDisplay.tsx
index dcc57e3..282268a 100644
--- a/frontend/src/components/displays/MusicDiverScoreDisplay.tsx
+++ b/frontend/src/components/displays/MusicDiverScoreDisplay.tsx
@@ -2,24 +2,8 @@ import React from "react";
import SHA1 from "crypto-js/sha1";
import { Link } from "react-router";
import { globalSkipKeys } from "../../types/constants";
+import type {Score, ScoreDisplayProps} from "../../types/game";
-interface Score {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [key: string]: any;
- timestamp: string | number;
- username?: string;
-}
-
-interface ScoreDisplayProps {
- scores: Score[];
- viewMode: "cards" | "table";
- sortField: string;
- sortDirection: "asc" | "desc";
- onSort: (field: string) => void;
- onDelete?: (scoreId: number) => void;
- showUsername?: boolean;
- hideTitleArtist?: boolean;
-}
const MusicDiverDisplay: React.FC<ScoreDisplayProps> = ({
scores,
diff --git a/frontend/src/components/displays/NostalgiaScoreDisplay.tsx b/frontend/src/components/displays/NostalgiaScoreDisplay.tsx
index 063d449..370aa8e 100644
--- a/frontend/src/components/displays/NostalgiaScoreDisplay.tsx
+++ b/frontend/src/components/displays/NostalgiaScoreDisplay.tsx
@@ -1,26 +1,9 @@
import React from "react";
import SHA1 from "crypto-js/sha1";
import { Link } from "react-router";
+import type {Score, ScoreDisplayProps} from "../../types/game";
import { globalSkipKeys } from "../../types/constants";
-interface Score {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [key: string]: any;
- timestamp: string | number;
- username?: string;
-}
-
-interface ScoreDisplayProps {
- scores: Score[];
- viewMode: "cards" | "table";
- sortField: string;
- sortDirection: "asc" | "desc";
- onSort: (field: string) => void;
- onDelete?: (scoreId: number) => void;
- showUsername?: boolean;
- hideTitleArtist?: boolean;
-}
-
const NostalgiaScoreDisplay: React.FC<ScoreDisplayProps> = ({
scores,
viewMode,
diff --git a/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx b/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx
index 9de1403..63aa2a9 100644
--- a/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx
+++ b/frontend/src/components/displays/ReflecBeatScoreDisplay.tsx
@@ -2,24 +2,7 @@ import React from "react";
import SHA1 from "crypto-js/sha1";
import { Link } from "react-router";
import { globalSkipKeys } from "../../types/constants";
-
-interface Score {
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- [key: string]: any;
- timestamp: string | number;
- username?: string;
-}
-
-interface ScoreDisplayProps {
- scores: Score[];
- viewMode: "cards" | "table";
- sortField: string;
- sortDirection: "asc" | "desc";
- onSort: (field: string) => void;
- onDelete?: (scoreId: number) => void;
- showUsername?: boolean;
- hideTitleArtist?: boolean;
-}
+import type {Score, ScoreDisplayProps} from "../../types/game";
const ReflecBeatScoreDisplay: React.FC<ScoreDisplayProps> = ({
scores,
diff --git a/frontend/src/types/game.ts b/frontend/src/types/game.ts
index 3c595ea..1f46fea 100644
--- a/frontend/src/types/game.ts
+++ b/frontend/src/types/game.ts
@@ -3,3 +3,21 @@ export interface SupportedGame {
formattedName: string;
description: string;
}
+
+export interface Score {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ [key: string]: any;
+ timestamp: string | number;
+ username?: string;
+}
+
+export interface ScoreDisplayProps {
+ scores: Score[];
+ viewMode: "cards" | "table";
+ sortField: string;
+ sortDirection: "asc" | "desc";
+ onSort: (field: string) => void;
+ onDelete?: (scoreId: number) => void;
+ showUsername?: boolean;
+ hideTitleArtist?: boolean;
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage