diff --git a/frontend/src/pages/Score.tsx b/frontend/src/pages/Score.tsx
index 2bf1a2b..e32f001 100644
--- a/frontend/src/pages/Score.tsx
+++ b/frontend/src/pages/Score.tsx
@@ -9,6 +9,8 @@ import DancerushScoreDisplay from "../components/displays/DancerushScoreDisplay"
type SortField = string;
type SortDirection = "asc" | "desc";
+import { getFilterOptions } from "../types/constants";
+
const Score = () => {
const { user, isLoading, logout } = useAuth();
const navigate = useNavigate();
@@ -36,33 +38,24 @@ const Score = () => {
};
const renderRequestFilterMenu = () => {
- if (gameName === "dancerush") {
- const filterOptions = [
- { value: "timestamp", label: "Recent" },
- { value: "score", label: "Score" },
- { value: "lamp", label: "Rank" },
- { value: "lamo_diff", label: "Difficulty" },
- ];
-
- return (
-
- {filterOptions.map((option) => (
-
- ))}
-
- );
- }
- return null;
+ const filterOptions = getFilterOptions(gameName);
+ return (
+
+ {filterOptions.map((option) => (
+
+ ))}
+
+ );
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -167,9 +160,6 @@ const Score = () => {
{/* Filter Menu */}
-
- Sort by:
-
{renderRequestFilterMenu()}
diff --git a/frontend/src/types/constants.ts b/frontend/src/types/constants.ts
index 3f2c97b..1e44b21 100644
--- a/frontend/src/types/constants.ts
+++ b/frontend/src/types/constants.ts
@@ -3,3 +3,20 @@ export const EamuseImportInfo: Record = {
scorePage: "https://p.eagate.573.jp/game/dan/1st/playdata/entrance.html#music_data",
},
};
+
+export function getFilterOptions(game: string): { value: string; label: string }[] {
+ switch (game) {
+ case "dancerush":
+ return [
+ { value: "timestamp", label: "Recent" },
+ { value: "score", label: "Score" },
+ { value: "lamp", label: "Rank" },
+ { value: "lamp_diff", label: "Difficulty"}
+ ];
+ default:
+ return [
+ { value: "timestamp", label: "Recent" },
+ { value: "score", label: "Score" },
+ ];
+ }
+}