seperate dancerush and dancearound eamuse import modals

This commit is contained in:
Pinapelz
2025-10-20 16:01:47 -07:00
parent e158c575f5
commit acb0dc5483
3 changed files with 193 additions and 31 deletions
@@ -1,24 +1,19 @@
import type { SupportedGame } from "../../types/game";
import { EamuseImportInfo } from "../../types/constants";
interface EamusementUploadModalProps {
interface DanceAroundModalProps {
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 = ({
const DanceAroundModal = ({
isOpen,
onClose,
game,
renderAsCard
}: EamusementUploadModalProps) => {
}: DanceAroundModalProps) => {
if (renderAsCard) {
return (
<div className="bg-slate-800 rounded-lg border border-slate-700 p-6 hover:border-violet-500 transition-colors">
@@ -38,10 +33,10 @@ const EamusementUploadModal = ({
</svg>
</div>
<h4 className="text-white font-semibold mb-2">
e-amusement Play History
Dance aROUND e-amusement Play History
</h4>
<p className="text-slate-400 text-sm mb-4">
Import via scraping your playdata from KONAMI e-amusement
Import via scraping your Dance aROUND playdata from KONAMI e-amusement
</p>
<button
onClick={renderAsCard}
@@ -75,7 +70,7 @@ const EamusementUploadModal = ({
{/* Header */}
<div className="mb-6">
<h3 className="text-xl font-bold text-white mb-2">
Import {game.formattedName} Data
Import Dance aROUND Data
</h3>
<p className="text-slate-400 text-sm">
Follow the instructions below to import your data
@@ -103,18 +98,18 @@ const EamusementUploadModal = ({
</h4>
<ol className="text-sm text-slate-400 space-y-1 list-decimal list-inside">
<li>Log into your e-amusement account</li>
{EamuseImportInfo[game.internalName] ? (
{EamuseImportInfo["dancearound"] ? (
<li>
Navigate to your{" "}
<a href={EamuseImportInfo[game.internalName]?.scorePage}>
{game.formattedName} score data page
<a href={EamuseImportInfo["dancearound"]?.scorePage}>
Dance aROUND score data page
</a>{" "}
{game.formattedName} score data page
Dance aROUND score data page
</li>
) : (
<li>Navigate to your {game.formattedName} score data page</li>
<li>Navigate to your Dance aROUND score data page</li>
)}
{EamuseImportInfo[game.internalName] ? (
{EamuseImportInfo["dancearound"] ? (
<li>
Install the userscript to your browser (use an extension such
as Tampermonkey)
@@ -122,7 +117,7 @@ const EamusementUploadModal = ({
) : (
<li>
Scrape the data using any method of your choice and translate
it into a Mirage {game.formattedName} compatible JSON format
it into a Mirage Dance aROUND compatible JSON format
</li>
)}
<li>Upload the resulting JSON file into Mirage using the Batch-Manual Upload functionality</li>
@@ -134,10 +129,10 @@ const EamusementUploadModal = ({
<div className="mb-6 rounded-md bg-blue-500/10 border border-blue-500/20 p-3">
<p className="text-sm text-blue-400">
<a
href={scriptLinkMap[game.internalName as keyof typeof scriptLinkMap]}
href="https://github.com/pinapelz/Mirage/raw/refs/heads/main/scripts/dancearound/dancearound_play_history.user.js"
className="underline"
>
{game.formattedName} Userscript Download
e-amusement Recently Played Score Export Userscript (Last 30 Played)
</a>
</p>
</div>
@@ -157,4 +152,4 @@ const EamusementUploadModal = ({
);
};
export default EamusementUploadModal;
export default DanceAroundModal;
@@ -0,0 +1,155 @@
import type { SupportedGame } from "../../types/game";
import { EamuseImportInfo } from "../../types/constants";
interface DancerushModalProps {
isOpen: boolean;
onClose: () => void;
game: SupportedGame | undefined;
renderAsCard?: () => void;
}
const DancerushModal = ({
isOpen,
onClose,
game,
renderAsCard
}: DancerushModalProps) => {
if (renderAsCard) {
return (
<div className="bg-slate-800 rounded-lg border border-slate-700 p-6 hover:border-violet-500 transition-colors">
<div className="w-12 h-12 bg-blue-600/20 rounded-lg flex items-center justify-center mb-4">
<svg
className="w-6 h-6 text-blue-400"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
/>
</svg>
</div>
<h4 className="text-white font-semibold mb-2">
DANCERUSH e-amusement Play History
</h4>
<p className="text-slate-400 text-sm mb-4">
Import via scraping your DANCERUSH playdata from KONAMI e-amusement
</p>
<button
onClick={renderAsCard}
className="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-3 sm:px-4 rounded-md text-sm sm:text-base font-medium transition-colors"
>
Export e-amusement
</button>
</div>
);
}
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 (
<div className="fixed inset-0 z-50 overflow-y-auto">
{/* Backdrop */}
<div
className="fixed inset-0 bg-black/50 backdrop-blur-sm transition-opacity"
onClick={handleClose}
/>
{/* Modal */}
<div className="flex min-h-full items-center justify-center p-4">
<div className="relative bg-slate-900 rounded-lg border border-slate-700 w-full max-w-xl p-6 shadow-xl">
{/* Header */}
<div className="mb-6">
<h3 className="text-xl font-bold text-white mb-2">
Import DANCERUSH Data
</h3>
<p className="text-slate-400 text-sm">
Follow the instructions below to import your data
</p>
</div>
{/* Warning */}
<div className="mb-6 rounded-md bg-blue-500/10 border border-blue-500/20 p-3">
<p className="text-sm text-blue-400">
You may or may need to be subscribed to{" "}
<a
className="font-bold hover:underline"
href="https://p.eagate.573.jp/payment/p/ex_select_course.html"
>
KONAMI's e-amusement Basic and/or Premium course
</a>{" "}
to view a exportable playdata history for certain games.
</p>
</div>
{/* Instructions */}
<div className="mb-4 rounded-md bg-slate-800 border border-slate-700 p-4">
<h4 className="text-sm font-semibold text-slate-300 mb-2">
Instructions:
</h4>
<ol className="text-sm text-slate-400 space-y-1 list-decimal list-inside">
<li>Log into your e-amusement account</li>
{EamuseImportInfo["dancerush"] ? (
<li>
Navigate to your{" "}
<a href={EamuseImportInfo["dancerush"]?.scorePage}>
DANCERUSH score data page
</a>{" "}
DANCERUSH score data page
</li>
) : (
<li>Navigate to your DANCERUSH score data page</li>
)}
{EamuseImportInfo["dancerush"] ? (
<li>
Install the userscript to your browser (use an extension such
as Tampermonkey)
</li>
) : (
<li>
Scrape the data using any method of your choice and translate
it into a Mirage DANCERUSH compatible JSON format
</li>
)}
<li>Upload the resulting JSON file into Mirage using the Batch-Manual Upload functionality</li>
<li>Verify that all data has been imported correctly</li>
</ol>
</div>
{/* Additional Info */}
<div className="mb-6 rounded-md bg-blue-500/10 border border-blue-500/20 p-3">
<p className="text-sm text-blue-400">
<a
href="https://github.com/pinapelz/Mirage/raw/refs/heads/main/scripts/dancerush/dancerush_play_history.user.js"
className="underline"
>
e-amusement Recently Played Score Export Userscript (Last 20 Played)
</a>
</p>
</div>
{/* Actions */}
<div className="flex justify-center">
<button
onClick={handleClose}
className="px-6 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-md font-medium transition-colors"
>
Got it
</button>
</div>
</div>
</div>
</div>
);
};
export default DancerushModal;
+22 -10
View File
@@ -7,7 +7,8 @@ import { uploadScore } from "../utils/scoreUpload";
import { NavBar } from "../components/NavBar";
const JsonUploadModal = lazy(() => import("../components/modals/JsonUploadModal"));
const EamusementModal = lazy(() => import("../components/modals/EamusementModal"));
const DancerushModal = lazy(() => import("../components/modals/DancerushModal"));
const DanceAroundModal = lazy(() => import("../components/modals/DanceAroundModal"));
const DivaNetModal = lazy(() => import("../components/modals/DivaNetModal"));
const Import = () => {
@@ -15,7 +16,8 @@ const Import = () => {
const navigate = useNavigate();
const [selectedGame, setSelectedGame] = useState("");
const [isJsonModalOpen, setIsJsonModalOpen] = useState(false);
const [isEamusementModalOpen, setIsEamusementModalOpen] = useState(false);
const [isDancerushModalOpen, setIsDancerushModalOpen] = useState(false);
const [isDanceAroundModalOpen, setIsDanceAroundModalOpen] = useState(false);
const [isDivaNetModalOpen, setIsDivaNetModalOpen] = useState(false);
const [supportedGames, setSupportedGames] = useState<SupportedGame[]>([]);
const [gamesLoading, setGamesLoading] = useState(true);
@@ -132,11 +134,11 @@ const Import = () => {
return (
<>
<JsonUploadCard />
<EamusementModal
<DancerushModal
isOpen={false}
onClose={() => {}}
game={supportedGames.find((g) => g.internalName === selectedGame)}
renderAsCard={() => setIsEamusementModalOpen(true)}
renderAsCard={() => setIsDancerushModalOpen(true)}
/>
</>
);
@@ -145,11 +147,11 @@ const Import = () => {
return (
<>
<JsonUploadCard />
<EamusementModal
<DanceAroundModal
isOpen={false}
onClose={() => {}}
game={supportedGames.find((g) => g.internalName === selectedGame)}
renderAsCard={() => setIsEamusementModalOpen(true)}
renderAsCard={() => setIsDanceAroundModalOpen(true)}
/>
</>
);
@@ -286,10 +288,20 @@ const Import = () => {
}
/>
)}
{isEamusementModalOpen && (
<EamusementModal
isOpen={isEamusementModalOpen}
onClose={() => setIsEamusementModalOpen(false)}
{isDancerushModalOpen && (
<DancerushModal
isOpen={isDancerushModalOpen}
onClose={() => setIsDancerushModalOpen(false)}
game={
supportedGames.find((g) => g.internalName === selectedGame) ||
undefined
}
/>
)}
{isDanceAroundModalOpen && (
<DanceAroundModal
isOpen={isDanceAroundModalOpen}
onClose={() => setIsDanceAroundModalOpen(false)}
game={
supportedGames.find((g) => g.internalName === selectedGame) ||
undefined