diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-11-07 12:56:30 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-11-07 12:56:30 -0800 |
| commit | ce0227d3ad947253031122a2e7e2807ec7f96fa4 (patch) | |
| tree | 12ff91b19fb82d90bca16bb10fe23a1a0f953951 /frontend/src/components | |
| parent | bd525aaba017deb95415c28ea6725ddc1dae7890 (diff) | |
chore: change ScoreDisplayProps and Score to be shared types
Diffstat (limited to 'frontend/src/components')
7 files changed, 7 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, |
