Add imgScore button, sdvx csv support and remove mer-iidx/kshook

This commit is contained in:
zkldi
2021-11-23 02:43:29 +00:00
parent 04e98a5c30
commit c8df11163a
5 changed files with 90 additions and 14 deletions
@@ -109,13 +109,13 @@ function ImportInfoDisplayer({ game }: { game: Game }) {
moreInfo="Note: All networks are reduced to their first three letters for anonymity reasons. ARC has a serious problem where it only stores one score per chart. This results in broken timestamps, and technically false score imports. I highly recommend using Fervidex instead, and only importing this once to synchronise things up."
key="ARC Integration"
/>,
<ImportInfoCard
name="MER .json"
href="iidx-mer"
desc="Use a MER-exported .json file to synchronise scores."
moreInfo="Note: Scores that do not match an existing song on the site will be orphaned, and anyone can see your orphaned scores. Don't be an idiot. I highly recommend using Fervidex instead."
key="MER .json"
/>,
// <ImportInfoCard
// name="MER .json"
// href="iidx-mer"
// desc="Use a MER-exported .json file to synchronise scores."
// moreInfo="Note: Scores that do not match an existing song on the site will be orphaned, and anyone can see your orphaned scores. Don't be an idiot. I highly recommend using Fervidex instead."
// key="MER .json"
// />,
<ImportInfoCard
name="SOLID STATE SQUAD .xml"
href="sss-xml"
@@ -140,11 +140,18 @@ function ImportInfoDisplayer({ game }: { game: Game }) {
moreInfo="This is the recommended way to import SDVX scores, as it provides high quality data in real-time."
key="Barbatos"
/>,
// <ImportInfoCard
// name="Konaste Hook"
// href="ks-hook"
// desc="Automatically import scores from SDVX 3 Konaste!"
// key="Konaste Hook"
// />,
<ImportInfoCard
name="Konaste Hook"
href="ks-hook"
desc="Automatically import scores from SDVX 3 Konaste!"
key="Konaste Hook"
name="E-Amusement CSV"
href="sdvx-eam-csv"
desc="Use the official E-Amusement CSV to import scores."
moreInfo="Note: This format doesn't support timestamps, which means sessions cannot be generated from it."
key="SDVX E-Amusement CSV"
/>,
<ImportInfoCard
name="FLO Integration"
@@ -0,0 +1,49 @@
import ImportFileInfo, { MoreDataForm } from "components/imports/ImportFileInfo";
import useSetSubheader from "components/layout/header/useSetSubheader";
import React, { useEffect, useState } from "react";
import { Form } from "react-bootstrap";
import { FileUploadImportTypes } from "tachi-common";
export default function SDVXEamCSVPage({
name,
importType,
}: {
name: string;
importType: FileUploadImportTypes;
}) {
useSetSubheader(["Import Scores", name]);
return (
<ImportFileInfo
acceptMime="text/csv"
importType={importType}
name={name}
parseFunction={ParseFunction}
/>
);
}
function ParseFunction(data: string) {
const lines: string[] = data.split("\n");
const headers = lines[0].split(",");
if (headers.length !== 11) {
throw new Error(
`Unexpected amount of headers in the file -- Expected 11. Is this an eamusement CSV?`
);
}
if (lines.length === 1) {
throw new Error(`This CSV has no scores? Only found headers.`);
}
const linesWithScores = lines.filter(e => e !== "");
return {
valid: true,
info: {
Scores: linesWithScores.length - 1,
},
};
}
+7
View File
@@ -9,6 +9,7 @@ import ImportPage from "app/pages/dashboard/import/ImportPage";
import KsHookPage from "app/pages/dashboard/import/KsHookPage";
import LR2DBPage from "app/pages/dashboard/import/LR2DBPage";
import MerJSONPage from "app/pages/dashboard/import/MerJSONPage";
import SDVXEamCSVPage from "app/pages/dashboard/import/SDVXEamCSVPage";
import SSSXMLPage from "app/pages/dashboard/import/SSSXMLPage";
import USCDBPage from "app/pages/dashboard/import/USCDBPage";
import USCIRPage from "app/pages/dashboard/import/USCIRPage";
@@ -72,6 +73,12 @@ export default function ImportRoutes() {
importType="file/pli-iidx-csv"
/>
</Route>
<Route exact path="/dashboard/import/sdvx-eam-csv">
<SDVXEamCSVPage
name="SDVX e-amusement CSV"
importType="file/eamusement-sdvx-csv"
/>
</Route>
<Route exact path="/dashboard/import/iidx-mer">
<MerJSONPage />
</Route>
@@ -2,10 +2,14 @@ import QuickTooltip from "components/layout/misc/QuickTooltip";
import Icon from "components/util/Icon";
import { UserContext } from "context/UserContext";
import React, { useContext, useState } from "react";
import { ScoreDocument } from "tachi-common";
import { Game, ScoreDocument } from "tachi-common";
import { Button, Modal, Form } from "react-bootstrap";
import { SetState } from "types/react";
import { APIFetchV1 } from "util/api";
import LinkButton from "components/util/LinkButton";
import ExternalLink from "components/util/ExternalLink";
const SUPPORTED_IMG_SCORES: Game[] = ["usc"];
export default function ScoreEditButtons({
score,
@@ -81,6 +85,16 @@ export default function ScoreEditButtons({
</Button>
</QuickTooltip>
)}
{SUPPORTED_IMG_SCORES.includes(score.game) && (
<QuickTooltip tooltipContent="Get an image for this score!">
<ExternalLink
className="btn btn-outline-secondary"
href={`${process.env.REACT_APP_IMGSCORE_URL}/${score.scoreID}`}
>
<Icon noPad type="camera" />
</ExternalLink>
</QuickTooltip>
)}
</div>
<CommentModal
show={show}
+1 -2
View File
@@ -32,10 +32,9 @@ if (mode === "ktchi") {
"ir/fervidex",
"ir/fervidex-static",
"file/eamusement-iidx-csv",
"file/eamusement-sdvx-csv",
"file/solid-state-squad",
"file/mer-iidx",
"file/pli-iidx-csv",
"ir/kshook-sv3c",
],
};
colourConf = {