From a2dd1a1f29e6513d48bc7f332f9c074e43a34d1a Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sun, 12 Oct 2025 17:31:06 -0700 Subject: add diva.net script instructions to import page --- frontend/src/components/modals/DivaNetModal.tsx | 128 +++++++++++++++++++++ frontend/src/components/modals/EamusementModal.tsx | 49 +++++++- frontend/src/pages/Import.tsx | 83 +++++++------ 3 files changed, 221 insertions(+), 39 deletions(-) create mode 100644 frontend/src/components/modals/DivaNetModal.tsx (limited to 'frontend/src') diff --git a/frontend/src/components/modals/DivaNetModal.tsx b/frontend/src/components/modals/DivaNetModal.tsx new file mode 100644 index 0000000..f38913b --- /dev/null +++ b/frontend/src/components/modals/DivaNetModal.tsx @@ -0,0 +1,128 @@ +import type { SupportedGame } from "../../types/game"; + +interface DivaNetModalProps { + isOpen: boolean; + onClose: () => void; + game: SupportedGame | undefined; + renderAsCard?: () => void; +} + +const DivaNetModal = ({ + isOpen, + onClose, + game, + renderAsCard +}: DivaNetModalProps) => { + if (renderAsCard) { + return ( +
+
+ + + +
+

+ DIVA.NET Play History +

+

+ Import via scraping your playdata from SEGA DIVA.NET +

+ +
+ ); + } + + if (!isOpen) return null; + + const handleClose = () => { + onClose(); + }; + if(game === undefined){ + return "Sorry, due to some extreme error the game you're looking for doesn't seem to exist..." + } + return ( +
+ {/* Backdrop */} +
+ + {/* Modal */} +
+
+ {/* Header */} +
+

+ Import {game.formattedName} Data +

+

+ Follow the instructions below to import your data +

+
+ + {/* Instructions */} +
+

+ Instructions: +

+
    +
  1. Log into your DIVA.NET account
  2. +
  3. + Navigate to the Play History (履歴) Page +
  4. +
  5. + Install the userscript to your browser (use an extension such + as Tampermonkey). +
  6. +
  7. + A button will appear on the page that you can click to start the scraping process. +
  8. +
  9. Upload the resulting JSON file into Mirage using the Batch-Manual Upload functionality
  10. +
  11. Verify that all data has been imported correctly
  12. +
+
+ + {/* Additional Info */} + + + {/* Actions */} +
+ +
+
+
+
+ ); +}; + +export default DivaNetModal; diff --git a/frontend/src/components/modals/EamusementModal.tsx b/frontend/src/components/modals/EamusementModal.tsx index a861315..cb5c542 100644 --- a/frontend/src/components/modals/EamusementModal.tsx +++ b/frontend/src/components/modals/EamusementModal.tsx @@ -5,13 +5,54 @@ interface EamusementUploadModalProps { isOpen: boolean; onClose: () => void; game: SupportedGame | undefined; + renderAsCard?: () => void; +} + +const scriptLinkMap = { + "dancerush": "https://github.com/pinapelz/Mirage/raw/refs/heads/main/scripts/dancerush/dancerush_play_history.user.js", + "dancearound": "https://github.com/pinapelz/Mirage/raw/refs/heads/main/scripts/dancearound/dancearound_play_history.user.js", } const EamusementUploadModal = ({ isOpen, onClose, game, + renderAsCard }: EamusementUploadModalProps) => { + if (renderAsCard) { + return ( +
+
+ + + +
+

+ e-amusement Play History +

+

+ Import via scraping your playdata from KONAMI e-amusement +

+ +
+ ); + } + if (!isOpen) return null; const handleClose = () => { @@ -92,8 +133,12 @@ const EamusementUploadModal = ({ {/* Additional Info */}

- This feature is currently under development. Please check back - later for the full implementation. + + {game.formattedName} Userscript Download +

diff --git a/frontend/src/pages/Import.tsx b/frontend/src/pages/Import.tsx index 08976c7..dc88ab4 100644 --- a/frontend/src/pages/Import.tsx +++ b/frontend/src/pages/Import.tsx @@ -7,6 +7,7 @@ import SessionExpiredPopup from "../components/SessionExpiredPopup"; import type { SupportedGame } from "../types/game"; import { uploadScore } from "../utils/scoreUpload"; import { NavBar } from "../components/NavBar"; +import DivaNetModal from "../components/modals/DivaNetModal"; const Import = () => { const { user, isLoading, logout } = useAuth(); @@ -14,6 +15,7 @@ const Import = () => { const [selectedGame, setSelectedGame] = useState(""); const [isJsonModalOpen, setIsJsonModalOpen] = useState(false); const [isEamusementModalOpen, setIsEamusementModalOpen] = useState(false); + const [isDivaNetModalOpen, setIsDivaNetModalOpen] = useState(false); const [supportedGames, setSupportedGames] = useState([]); const [gamesLoading, setGamesLoading] = useState(true); const [uploadStatus, setUploadStatus] = useState<{ @@ -121,52 +123,49 @@ const Import = () => {
); - const EamusementScrapeUploadCard = () => ( - <> - {/* e-amusement Card */} -
-
- - - -
-

- e-amusement Play History -

-

- Import via scraping your playdata from KONAMI e-amusement -

- -
- - ); + // Component removed - moved to EamusementModal.tsx const renderImportOptions = () => { switch (selectedGame) { case "dancerush": return ( <> - {/* JSON Upload Card */} - + {}} + game={supportedGames.find((g) => g.internalName === selectedGame)} + renderAsCard={() => setIsEamusementModalOpen(true)} + /> ); - + break; + case "dancearound": + return ( + <> + + {}} + game={supportedGames.find((g) => g.internalName === selectedGame)} + renderAsCard={() => setIsEamusementModalOpen(true)} + /> + + ); + break; + case "diva": + return ( + <> + + {}} + game={supportedGames.find((g) => g.internalName === selectedGame)} + renderAsCard={() => setIsDivaNetModalOpen(true)} + /> + + ); + break; default: return ; } @@ -293,6 +292,16 @@ const Import = () => { undefined } /> + + {/* DivaNet Modal */} + setIsDivaNetModalOpen(false)} + game={ + supportedGames.find((g) => g.internalName === selectedGame) || + undefined + } + /> ); }; -- cgit v1.2.3