From 2ebe9f95444d29e40b9efaaa0e58661b4acd25a3 Mon Sep 17 00:00:00 2001 From: zkldi Date: Wed, 5 Jun 2024 01:49:51 +0100 Subject: [PATCH] feat: things (#1098) * feat: clean up this disgusting filter directive thing * fix: THIS FIX WAS THIS EASY FOR THIS LONG??? * fix: version is obsolete * feat: much prettier... * feat: big import warnings * feat: sour times --- bot/src/version.ts | 13 +- .../app/pages/dashboard/import/ImportPage.tsx | 85 +++++++ .../app/pages/dashboard/import/USCIRPage.tsx | 19 +- .../_game/_playtype/SpecificSessionPage.tsx | 22 +- .../sessions/SessionFolderRaiseBreakdown.tsx | 25 +- .../components/sessions/SessionOverview.tsx | 220 ++++++++++++++---- .../tables/components/DropdownRow.tsx | 2 +- .../components/FilterDirectivesIndicator.tsx | 181 ++++++-------- .../tables/components/TachiTable.tsx | 68 +++--- .../src/components/util/SelectLinkButton.tsx | 13 +- client/src/lib/game-implementations.tsx | 10 +- client/src/lib/games/arcaea.tsx | 1 + client/src/lib/games/bms-pms.tsx | 1 + client/src/lib/games/gitadora.tsx | 4 +- client/src/lib/games/iidx.tsx | 2 + client/src/lib/games/sdvx-usc.tsx | 4 +- client/src/lib/types.ts | 7 + docker-compose-dev.yml | 1 - package.json | 2 +- server/src/lib/constants/version.ts | 44 +--- 20 files changed, 427 insertions(+), 297 deletions(-) diff --git a/bot/src/version.ts b/bot/src/version.ts index 1679e5544..e17d9a6b9 100644 --- a/bot/src/version.ts +++ b/bot/src/version.ts @@ -2,23 +2,12 @@ const MAJOR = 2; const MINOR = 2; const PATCH = 0; -const TOKYO_SHOEGAZER_MOONDIVER = [ - "Into the Deep Sky", - "Your Relief", - "In Full Bloom", - "Night Dance", - "Bedtime Story", - "Moondive", - "Stay White", -]; - export const VERSION_INFO = { major: MAJOR, minor: MINOR, patch: PATCH, - name: TOKYO_SHOEGAZER_MOONDIVER[MINOR], }; export const VERSION_STR = `${MAJOR}.${MINOR}.${PATCH}`; -export const VERSION_PRETTY = `v${VERSION_STR} (${VERSION_INFO.name})`; +export const VERSION_PRETTY = `v${VERSION_STR}`; diff --git a/client/src/app/pages/dashboard/import/ImportPage.tsx b/client/src/app/pages/dashboard/import/ImportPage.tsx index 21db9576e..ca4479bc9 100644 --- a/client/src/app/pages/dashboard/import/ImportPage.tsx +++ b/client/src/app/pages/dashboard/import/ImportPage.tsx @@ -23,6 +23,8 @@ import { UserDocument, } from "tachi-common"; import Col from "react-bootstrap/Col"; +import { Alert } from "react-bootstrap"; +import Icon from "components/util/Icon"; export default function ImportPage({ user }: { user: UserDocument }) { useSetSubheader(["Import Scores"]); @@ -369,6 +371,11 @@ function ImportInfoDisplayer({ game }: { game: Game }) {

{gameConfig.name}

+ + + + + {Content} @@ -376,6 +383,84 @@ function ImportInfoDisplayer({ game }: { game: Game }) { ); } +function InputAlert({ game }: { game: Game }) { + function doit(game: Game): JSX.Element | null { + switch (game) { + case "jubeat": + case "maimai": + case "iidx": + case "museca": + case "chunithm": + case "gitadora": + case "maimaidx": + case "popn": + case "wacca": + case "ongeki": + return ( + <> + Scores must be achieved on an arcade-size controller! +
+ Playing on other input devices (like a keyboard) will get you in trouble. + + ); + case "sdvx": + return ( + <> + Scores must be achieved on an arcade-size controller! +
+ Playing on other input devices (like a keyboard) will get you in trouble. +
+ + A Pocket-Voltex DOES NOT count as an ARCADE SIZE controller! + + + ); + + case "usc": + return ( + <> + Please use the right leaderboard for your controller! +
+
+ Arcade-sized controllers should go on the controller + leaderboards. +
+ Keyboards and anything else go on the Keyboard/Other + leaderboards. +
+
+ + A Pocket-Voltex DOES NOT count as an ARCADE SIZE controller! + + + ); + + case "itg": + case "arcaea": + case "bms": + case "pms": + return null; + } + } + + const ct = doit(game); + + if (!ct) { + return <>; + } + + return ( + +
+
+ +
+
{ct}
+
+
+ ); +} + function ImportTypeInfoCard({ importType, }: { diff --git a/client/src/app/pages/dashboard/import/USCIRPage.tsx b/client/src/app/pages/dashboard/import/USCIRPage.tsx index 66af04053..5a769a71c 100644 --- a/client/src/app/pages/dashboard/import/USCIRPage.tsx +++ b/client/src/app/pages/dashboard/import/USCIRPage.tsx @@ -33,10 +33,17 @@ export default function USCIRPage() { Fill out IR Base URL with {ToServerURL("/ir/usc/Keyboard")}. - You MUST select the right IR! These leaderboards are separated because it - is unfair to compare the two input devices. + You MUST select the right IR! These leaderboards are separated because + it's unfair to compare controller and keyboard scores.
- DELIBERATELY SELECTING THE WRONG IR WILL RESULT IN A PERMANENT BAN! + Ignoring this will get you in trouble, please don't! +
+
+ Arcade-sized controllers should go on the controller + leaderboards. +
+ Keyboards and anything else go on the Keyboard/Other + leaderboards.
  • @@ -46,12 +53,6 @@ export default function USCIRPage() {
  • That's it! Your scores will now automatically upload to the server.
  • - - - Note: If you submit a score on a chart that {TachiConfig.NAME} doesn't recognise, - you'll need to wait until atleast 2 other players submit scores for that chart - before it'll show up. This is to combat accidental IR spam. - ); } diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx index 0e16e03b8..6d00d701d 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/SpecificSessionPage.tsx @@ -3,7 +3,6 @@ import { CreateChartMap, CreateScoreIDMap, CreateSongMap } from "util/data"; import useSetSubheader from "components/layout/header/useSetSubheader"; import Card from "components/layout/page/Card"; import SessionOverview from "components/sessions/SessionOverview"; -import ScoreTable from "components/tables/scores/ScoreTable"; import ApiError from "components/util/ApiError"; import DebugContent from "components/util/DebugContent"; import Divider from "components/util/Divider"; @@ -250,27 +249,8 @@ function SessionPage({ data, game, playtype }: UGPT & { data: SessionReturns }) scoreDataset={scoreDataset} sessionData={sessionData} setSessionData={setSessionData} + reqUser={data.user} /> - - - - { - const newScores = [ - ...sessionData.scores.filter((e) => e.scoreID !== sc.scoreID), - sc, - ]; - - setSessionData({ - ...sessionData, - scores: newScores, - }); - }} - /> - {settings?.preferences.developerMode && ( diff --git a/client/src/components/sessions/SessionFolderRaiseBreakdown.tsx b/client/src/components/sessions/SessionFolderRaiseBreakdown.tsx index 6d9293413..3f40ece0a 100644 --- a/client/src/components/sessions/SessionFolderRaiseBreakdown.tsx +++ b/client/src/components/sessions/SessionFolderRaiseBreakdown.tsx @@ -7,7 +7,6 @@ import DropdownIndicatorCell from "components/tables/cells/DropdownIndicatorCell import DropdownRow from "components/tables/components/DropdownRow"; import MiniTable from "components/tables/components/MiniTable"; import ApiError from "components/util/ApiError"; -import Divider from "components/util/Divider"; import Loading from "components/util/Loading"; import Muted from "components/util/Muted"; import useApiQuery from "components/util/query/useApiQuery"; @@ -48,7 +47,6 @@ export default function SessionFolderRaiseBreakdown({ const gptConfig = GetGamePTConfig(game, playtype); const [selectedTable, setSelectedTable] = useState<"LOADING" | null | TableDocument>("LOADING"); - const [shouldLimit, setShouldLimit] = useState(true); const { data, error } = useApiQuery>( `/sessions/${sessionData.session.sessionID}/folder-raises` @@ -139,16 +137,14 @@ export default function SessionFolderRaiseBreakdown({ } return ( - - - + <>

    Folder Raises

    - {filteredTables.length > 1 && ( + {filteredTables.length > 1 && selectedTable !== null && (
    ztable.setPageLen(Number(e))} - > - - - - - + {dataset.length > 10 && ( + + )}
    {settings?.preferences.developerMode && ( @@ -199,23 +203,25 @@ export default function TachiTable({ )}
    -
    - - - -
    + {dataset.length > 10 && ( +
    + + + +
    + )}
    diff --git a/client/src/components/util/SelectLinkButton.tsx b/client/src/components/util/SelectLinkButton.tsx index 7e8332d67..e1df15a9c 100644 --- a/client/src/components/util/SelectLinkButton.tsx +++ b/client/src/components/util/SelectLinkButton.tsx @@ -19,17 +19,26 @@ export default function SelectLinkButton({ } & LinkButtonProps) { const match = DoesMatchRoute(window.location.href, to, !matchIfStartsWith); const variant = match ? onVariant : offVariant; - const classNames = `${match ? "" : "text-body text-light-hover text-light-focus"} ${className}`; + const classNames = `${ + match ? "" : "text-body text-light-hover text-light-focus" + } ${className} text-wrap`; return ( match} variant={variant} {...props} className={classNames} > - {children} +
    {children}
    +
    + {children} +
    ); } diff --git a/client/src/lib/game-implementations.tsx b/client/src/lib/game-implementations.tsx index b2bc23bd0..0e7017250 100644 --- a/client/src/lib/game-implementations.tsx +++ b/client/src/lib/game-implementations.tsx @@ -1,6 +1,5 @@ import { NumericSOV } from "util/sorts"; import { ChangeOpacity } from "util/color-opacity"; -import { FormatMillions } from "util/misc"; import { COLOUR_SET, GPTString, GetGPTString, PBScoreDocument, ScoreDocument } from "tachi-common"; import CHUNITHMJudgementCell from "components/tables/cells/CHUNITHMJudgementCell"; import ITGJudgementCell from "components/tables/cells/ITGJudgementCell"; @@ -42,6 +41,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { "iidx:SP": IIDX_SP_IMPL, "iidx:DP": IIDX_DP_IMPL, "chunithm:Single": { + sessionImportantScoreCount: 30, enumIcons: defaultEnumIcons, classColours: { colour: { @@ -129,6 +129,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ratingCell: ({ sc, rating }) => , }, "jubeat:Single": { + sessionImportantScoreCount: 30, enumIcons: defaultEnumIcons, enumColours: { lamp: { @@ -187,6 +188,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ratingCell: ({ sc }) => , }, "maimai:Single": { + sessionImportantScoreCount: 30, enumIcons: defaultEnumIcons, enumColours: { lamp: { @@ -287,6 +289,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ratingCell: ({ sc, rating }) => , }, "maimaidx:Single": { + sessionImportantScoreCount: 30, enumIcons: defaultEnumIcons, enumColours: { lamp: { @@ -429,6 +432,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ratingCell: ({ sc, rating }) => , }, "museca:Single": { + sessionImportantScoreCount: 20, enumIcons: defaultEnumIcons, enumColours: { grade: { @@ -476,6 +480,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ratingCell: ({ sc, rating }) => , }, "popn:9B": { + sessionImportantScoreCount: 20, enumIcons: { grade: "sort-alpha-up", lamp: "lightbulb", @@ -551,6 +556,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ratingCell: ({ sc, rating }) => , }, "wacca:Single": { + sessionImportantScoreCount: 50, enumIcons: defaultEnumIcons, enumColours: { grade: { @@ -635,6 +641,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ratingCell: ({ sc, rating }) => , }, "itg:Stamina": { + sessionImportantScoreCount: 10, enumIcons: defaultEnumIcons, enumColours: { grade: { @@ -722,6 +729,7 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { ), }, "ongeki:Single": { + sessionImportantScoreCount: 45, enumIcons: { grade: "sort-alpha-up", noteLamp: "lightbulb", diff --git a/client/src/lib/games/arcaea.tsx b/client/src/lib/games/arcaea.tsx index 802c7d817..731dc6734 100644 --- a/client/src/lib/games/arcaea.tsx +++ b/client/src/lib/games/arcaea.tsx @@ -89,6 +89,7 @@ const ArcaeaRatingCell: GPTClientImplementation["ratingCel }) => ; export const ARCAEA_TOUCH_IMPL: GPTClientImplementation<"arcaea:Touch"> = { + sessionImportantScoreCount: 30, ratingSystems: [], enumIcons: { grade: "sort-alpha-up", diff --git a/client/src/lib/games/bms-pms.tsx b/client/src/lib/games/bms-pms.tsx index 1969a0ca6..177fecd04 100644 --- a/client/src/lib/games/bms-pms.tsx +++ b/client/src/lib/games/bms-pms.tsx @@ -12,6 +12,7 @@ import { GetEnumColour } from "lib/game-implementations"; import { CreateRatingSys, bgc } from "./_util"; const BASE_IMPL: GPTClientImplementation = { + sessionImportantScoreCount: 20, difficultyColours: { CHART: COLOUR_SET.gray, // lol }, diff --git a/client/src/lib/games/gitadora.tsx b/client/src/lib/games/gitadora.tsx index 7c0eb11ce..e772230f7 100644 --- a/client/src/lib/games/gitadora.tsx +++ b/client/src/lib/games/gitadora.tsx @@ -7,7 +7,7 @@ import ScoreCell from "components/tables/cells/ScoreCell"; import { GetEnumColour } from "lib/game-implementations"; import React from "react"; import RatingCell from "components/tables/cells/RatingCell"; -import { bg, bgc } from "./_util"; +import { bgc } from "./_util"; const GITADORA_ENUM_COLOURS: GPTClientImplementation< "gitadora:Dora" | "gitadora:Gita" @@ -82,6 +82,7 @@ const GITADORARatingCell: GPTClientImplementation["ratin }) => ; export const GITADORA_GITA_IMPL: GPTClientImplementation<"gitadora:Gita"> = { + sessionImportantScoreCount: 50, enumIcons: { grade: "sort-alpha-up", lamp: "lightbulb", @@ -105,6 +106,7 @@ export const GITADORA_GITA_IMPL: GPTClientImplementation<"gitadora:Gita"> = { }; export const GITADORA_DORA_IMPL: GPTClientImplementation<"gitadora:Dora"> = { + sessionImportantScoreCount: 50, enumIcons: { grade: "sort-alpha-up", lamp: "lightbulb", diff --git a/client/src/lib/games/iidx.tsx b/client/src/lib/games/iidx.tsx index dc217e364..5f9b086b8 100644 --- a/client/src/lib/games/iidx.tsx +++ b/client/src/lib/games/iidx.tsx @@ -128,6 +128,7 @@ const IIDXRatingCell: GPTClientImplementation["ratingCell"] ); export const IIDX_SP_IMPL: GPTClientImplementation<"iidx:SP"> = { + sessionImportantScoreCount: 20, difficultyColours: IIDX_DIFF_COLOURS, enumColours: IIDX_ENUM_COLOURS, enumIcons: { @@ -167,6 +168,7 @@ export const IIDX_SP_IMPL: GPTClientImplementation<"iidx:SP"> = { }; export const IIDX_DP_IMPL: GPTClientImplementation<"iidx:DP"> = { + sessionImportantScoreCount: 20, difficultyColours: IIDX_DIFF_COLOURS, enumColours: IIDX_ENUM_COLOURS, enumIcons: { diff --git a/client/src/lib/games/sdvx-usc.tsx b/client/src/lib/games/sdvx-usc.tsx index 11a1ca4dc..8ad0d0077 100644 --- a/client/src/lib/games/sdvx-usc.tsx +++ b/client/src/lib/games/sdvx-usc.tsx @@ -9,7 +9,7 @@ import SDVXLampCell from "components/tables/cells/SDVXLampCell"; import { GetEnumColour } from "lib/game-implementations"; import React from "react"; import VF6Cell from "components/tables/cells/VF6Cell"; -import { CreateRatingSys, bg, bgc } from "./_util"; +import { CreateRatingSys, bgc } from "./_util"; type SDVXLikes = GPTStrings["usc" | "sdvx"]; @@ -75,6 +75,7 @@ const SDVXRatingCell: GPTClientImplementation["ratingCell"] = ({ sc, ); export const SDVX_IMPL: GPTClientImplementation<"sdvx:Single"> = { + sessionImportantScoreCount: 50, enumColours: SDVXLIKE_ENUM_COLOURS, enumIcons: { grade: "sort-alpha-up", @@ -168,6 +169,7 @@ export const SDVX_IMPL: GPTClientImplementation<"sdvx:Single"> = { ratingCell: SDVXRatingCell, }; export const USC_IMPL: GPTClientImplementation = { + sessionImportantScoreCount: 50, enumColours: SDVXLIKE_ENUM_COLOURS, enumIcons: { grade: "sort-alpha-up", diff --git a/client/src/lib/types.ts b/client/src/lib/types.ts index bdf936d3e..20108346d 100644 --- a/client/src/lib/types.ts +++ b/client/src/lib/types.ts @@ -8,6 +8,7 @@ import { Difficulties, ExtractedClasses, GPTString, + integer, PBScoreDocument, ScoreDocument, ScoreRatingAlgorithms, @@ -124,4 +125,10 @@ export interface GPTClientImplementation { chart: ChartDocument; rating: ScoreRatingAlgorithms[GPT]; }) => JSX.Element; + + /** + * How many scores should we consider for the topX in the session important scores + * display? + */ + sessionImportantScoreCount: integer; } diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 25f42be9a..327c99512 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -1,4 +1,3 @@ -version: "3.9" services: mongo: container_name: mongo diff --git a/package.json b/package.json index a759a224e..8fff272c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tachi", - "version": "2.5.1", + "version": "2.5.2", "private": true, "description": "The root of the Tachi monorepo. Contains common utils like linters.", "scripts": { diff --git a/server/src/lib/constants/version.ts b/server/src/lib/constants/version.ts index 3de160a87..284ef38ff 100644 --- a/server/src/lib/constants/version.ts +++ b/server/src/lib/constants/version.ts @@ -8,47 +8,6 @@ import { execSync } from "child_process"; import fs from "fs"; import path from "path"; -// As is with all front-facing zkldi projects, the version names for tachi-server -// are from an album I like. In this case, the al(bum is Portishead - Dummy. -// The fact that this album is very similar to Mezzanine -// - the album used for Kamaitachi v1 - is deliberate. :) - zkldi -const PORTISHEAD_DUMMY = [ - // v2.0.0 - "Mysterons", - - // v2.1.0 - "Sour Times", - - // v2.2.0 - "Strangers", - - // v2.3.0 - "It Could Be Sweet", - - // v2.4.0 - "Wandering Star", - - // v2.5.0 - "It's a Fire", - - // v2.6.0 - "Numb", - - // v2.7.0 - "Roads", - - // v2.8.0 - "Pedestal", - - // v2.9.0 - "Biscuit", - - // v2.10.0 - "Glory Box", - - // v2.11+ onwards are not expected to occur, but if they do, we'll figure something out. -]; - const logger = CreateLogCtx(__filename); // we want to read the monorepo root package.json. @@ -85,9 +44,8 @@ export const VERSION_INFO = { minor: semverInfo?.minor ?? 0, patch: semverInfo?.patch ?? 0, commit, - name: PORTISHEAD_DUMMY[semverInfo?.minor ?? 0] ?? "No Version Name", }; export const VERSION_STR = semverInfo?.raw ?? "0.0.0-unknown"; -export const VERSION_PRETTY = `v${VERSION_STR} (${VERSION_INFO.name}) [${commit}]`; +export const VERSION_PRETTY = `v${VERSION_STR} [${commit}]`;