From a5b15484423f9c9c9518a7be49845f018a8ff46f Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Wed, 16 Apr 2025 23:55:00 -0700 Subject: feat: add support for DDR World --- site/src/components/TitleBar.tsx | 221 +++++++++++++++++++++------------------ site/src/utils.ts | 1 + 2 files changed, 120 insertions(+), 102 deletions(-) (limited to 'site') diff --git a/site/src/components/TitleBar.tsx b/site/src/components/TitleBar.tsx index 8d4ca31..2f7e3c1 100644 --- a/site/src/components/TitleBar.tsx +++ b/site/src/components/TitleBar.tsx @@ -1,123 +1,140 @@ -import { Link } from 'react-router-dom'; -import { useState, useEffect, useRef } from 'react'; +import { Link } from "react-router-dom"; +import { useState, useEffect, useRef } from "react"; interface GameCategory { - name: string; - games: { id: string; title: string }[]; + name: string; + games: { id: string; title: string }[]; } const TitleBar: React.FC = () => { - const [dropdownOpen, setDropdownOpen] = useState(false); - const dropdownRef = useRef(null); + const [dropdownOpen, setDropdownOpen] = useState(false); + const dropdownRef = useRef(null); - const gameCategories: GameCategory[] = [ - { - name: "KONAMI", - games: [ - { id: "iidx", title: "beatmania IIDX" }, - { id: "sdvx", title: "SOUND VOLTEX" }, - ] - }, - { - name: "SEGA", - games: [ - { id: "chunithm_jp", title: "CHUNITHM (JAPAN)" }, - { id: "chunithm_intl", title: "CHUNITHM (INTERNATIONAL)" }, - { id: "maimaidx_jp", title: "maimai DX (JAPAN)" }, - { id: "maimaidx_intl", title: "maimai DX (INTERNATIONAL)"}, - { id: "ongeki_jp", title: "O.N.G.E.K.I"}, - ] - } - ]; + const gameCategories: GameCategory[] = [ + { + name: "KONAMI", + games: [ + { id: "iidx", title: "beatmania IIDX" }, + { id: "sdvx", title: "SOUND VOLTEX" }, + { id: "ddr", title: "DanceDanceRevolution"} + ], + }, + { + name: "SEGA", + games: [ + { id: "chunithm_jp", title: "CHUNITHM (JAPAN)" }, + { id: "chunithm_intl", title: "CHUNITHM (INTL)" }, + { id: "maimaidx_jp", title: "maimai DX (JAPAN)" }, + { id: "maimaidx_intl", title: "maimai DX (INTL)" }, + { id: "ongeki_jp", title: "O.N.G.E.K.I" }, + ], + }, + ]; - useEffect(() => { - const handleClickOutside = (event: MouseEvent) => { - if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) { - setDropdownOpen(false); - } - }; + useEffect(() => { + const handleClickOutside = (event: MouseEvent) => { + if ( + dropdownRef.current && + !dropdownRef.current.contains(event.target as Node) + ) { + setDropdownOpen(false); + } + }; - if (dropdownOpen) { - document.addEventListener('mousedown', handleClickOutside); - } + if (dropdownOpen) { + document.addEventListener("mousedown", handleClickOutside); + } - return () => { - document.removeEventListener('mousedown', handleClickOutside); - }; - }, [dropdownOpen]); + return () => { + document.removeEventListener("mousedown", handleClickOutside); + }; + }, [dropdownOpen]); - return ( -
-
-
-
- 573 Updates Logo -
- 573 -
+ return ( +
+
+
+
+ 573 Updates Logo +
+ 573 +
- {/* Site Title */} - - UPDATES - -
+ {/* Site Title */} + + UPDATES + +
- {/* Navigation Section */} -
- - All Games - + {/* Navigation Section */} +
+ + All Games + - {/* Dropdown Menu */} -
- + {/* Dropdown Menu */} +
+ - {dropdownOpen && ( -
-
- {gameCategories.map((category, index) => ( -
-
- {category.name} -
-
- {category.games.map((game) => ( - setDropdownOpen(false)} - > - {game.title} - - ))} -
-
- ))} -
-
- )} + {dropdownOpen && ( +
+
+ {gameCategories.map((category, index) => ( +
+
+ {category.name} +
+
3 + ? "grid grid-cols-1 sm:grid-cols-2 gap-x-2 gap-y-0.5" + : "space-y-0.5" + }`} + > + {category.games.map((game) => ( + setDropdownOpen(false)} + > + {game.title} + + ))}
-
+
+ ))} +
+ )}
+
- ); +
+
+ ); }; export default TitleBar; diff --git a/site/src/utils.ts b/site/src/utils.ts index 802d364..4984c58 100644 --- a/site/src/utils.ts +++ b/site/src/utils.ts @@ -10,6 +10,7 @@ export const getGameTitle = (gameId: string) => { if (lowerCaseGameId.startsWith("maimaidx_intl")) return "maimai DX (INTERNATIONAL)"; if (lowerCaseGameId.startsWith("ongeki_jp")) return "O.N.G.E.K.I" if (lowerCaseGameId.startsWith("chunithm_intl")) return "CHUNITHM (INTERNATIONAL)" + if (lowerCaseGameId.startsWIth("ddr")) return "DanceDanceRevolution" return gameId.toUpperCase(); }; -- cgit v1.2.3