From c8df11163ad84d6fdd74a00d7ea6fcb5065ed2d7 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Tue, 23 Nov 2021 02:43:29 +0000 Subject: [PATCH] Add imgScore button, sdvx csv support and remove mer-iidx/kshook --- .../app/pages/dashboard/import/ImportPage.tsx | 29 ++++++----- .../pages/dashboard/import/SDVXEamCSVPage.tsx | 49 +++++++++++++++++++ client/src/app/routes/ImportRoutes.tsx | 7 +++ .../dropdowns/components/ScoreEditButtons.tsx | 16 +++++- client/src/lib/config.ts | 3 +- 5 files changed, 90 insertions(+), 14 deletions(-) create mode 100644 client/src/app/pages/dashboard/import/SDVXEamCSVPage.tsx diff --git a/client/src/app/pages/dashboard/import/ImportPage.tsx b/client/src/app/pages/dashboard/import/ImportPage.tsx index 9ed97a350..065e75a49 100644 --- a/client/src/app/pages/dashboard/import/ImportPage.tsx +++ b/client/src/app/pages/dashboard/import/ImportPage.tsx @@ -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" />, - , + // , , + // , , + ); +} + +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, + }, + }; +} diff --git a/client/src/app/routes/ImportRoutes.tsx b/client/src/app/routes/ImportRoutes.tsx index 6710d1d23..db695fcb9 100644 --- a/client/src/app/routes/ImportRoutes.tsx +++ b/client/src/app/routes/ImportRoutes.tsx @@ -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" /> + + + diff --git a/client/src/components/tables/dropdowns/components/ScoreEditButtons.tsx b/client/src/components/tables/dropdowns/components/ScoreEditButtons.tsx index d6b3bd2f7..98ffa2df9 100644 --- a/client/src/components/tables/dropdowns/components/ScoreEditButtons.tsx +++ b/client/src/components/tables/dropdowns/components/ScoreEditButtons.tsx @@ -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({ )} + {SUPPORTED_IMG_SCORES.includes(score.game) && ( + + + + + + )}