From 7ccfb9a52cc78a95a4533ab4b971d959bdeecc1c Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Fri, 4 Jul 2025 22:37:36 -0700 Subject: add score json upload functionality --- frontend/src/components/modals/EamusementModal.tsx | 115 +++++++++++++++++++++ frontend/src/components/modals/JsonUploadModal.tsx | 2 + 2 files changed, 117 insertions(+) create mode 100644 frontend/src/components/modals/EamusementModal.tsx (limited to 'frontend/src/components') diff --git a/frontend/src/components/modals/EamusementModal.tsx b/frontend/src/components/modals/EamusementModal.tsx new file mode 100644 index 0000000..a861315 --- /dev/null +++ b/frontend/src/components/modals/EamusementModal.tsx @@ -0,0 +1,115 @@ +import type { SupportedGame } from "../../types/game"; +import { EamuseImportInfo } from "../../types/constants"; + +interface EamusementUploadModalProps { + isOpen: boolean; + onClose: () => void; + game: SupportedGame | undefined; +} + +const EamusementUploadModal = ({ + isOpen, + onClose, + game, +}: EamusementUploadModalProps) => { + 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 +

+
+ + {/* Warning */} +
+

+ You may or may need to be subscribed to{" "} + + KONAMI's e-amusement Basic and/or Premium course + {" "} + to view a exportable playdata history for certain games. +

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

+ Instructions: +

+
    +
  1. Log into your e-amusement account
  2. + {EamuseImportInfo[game.internalName] ? ( +
  3. + Navigate to your{" "} + + {game.formattedName} score data page + {" "} + {game.formattedName} score data page +
  4. + ) : ( +
  5. Navigate to your {game.formattedName} score data page
  6. + )} + {EamuseImportInfo[game.internalName] ? ( +
  7. + Install the userscript to your browser (use an extension such + as Tampermonkey) +
  8. + ) : ( +
  9. + Scrape the data using any method of your choice and translate + it into a Mirage {game.formattedName} compatible JSON format +
  10. + )} +
  11. Upload the resulting JSON file into Mirage using the Batch-Manual Upload functionality
  12. +
  13. Verify that all data has been imported correctly
  14. +
+
+ + {/* Additional Info */} +
+

+ This feature is currently under development. Please check back + later for the full implementation. +

+
+ + {/* Actions */} +
+ +
+
+
+
+ ); +}; + +export default EamusementUploadModal; diff --git a/frontend/src/components/modals/JsonUploadModal.tsx b/frontend/src/components/modals/JsonUploadModal.tsx index 1cb541b..7d8f838 100644 --- a/frontend/src/components/modals/JsonUploadModal.tsx +++ b/frontend/src/components/modals/JsonUploadModal.tsx @@ -3,6 +3,8 @@ import { useState, useRef } from 'react'; interface JsonUploadModalProps { isOpen: boolean; onClose: () => void; + // has to be any as this is a dynamic trackerm with dynamic score formats + // eslint-disable-next-line @typescript-eslint/no-explicit-any onUpload: (data: any) => void; game: string; } -- cgit v1.2.3