From c2bccd64aef48aaf33bfe3da9103c2c5dfd0eb37 Mon Sep 17 00:00:00 2001
From: zkldi <20380519+zkldi@users.noreply.github.com>
Date: Thu, 22 Dec 2022 17:23:37 +0000
Subject: [PATCH] feat: just a bunch of cleanup
- no deduping, ui improvements, general fixups
---
.../users/FervidexIntegrationPage.tsx | 4 +-
.../users/KsHookSV6CIntegrationPage.tsx | 4 +-
.../dashboard/users/UserSettingsPage.tsx | 4 +-
.../_game/_playtype/UGPTSettingsPage.tsx | 49 +++++++++----------
.../subheader/components/Breadcrumbs.tsx | 34 ++++++++-----
.../sessions/SessionRaiseBreakdown.tsx | 48 ++++++++++++++++--
.../tables/components/SelectableRanking.tsx | 7 ++-
.../tables/dropdowns/ImportDropdown.tsx | 2 +-
.../tables/dropdowns/ScoreDropdown.tsx | 12 ++---
.../tables/imports/ImportsTable.tsx | 5 +-
.../util/import/ImportViewerOptions.tsx | 2 +-
client/src/components/util/useBucket.tsx | 3 +-
package.json | 2 +-
server/example/conf.json5 | 2 +-
server/package.json | 2 +-
server/src/lib/setup/config.ts | 15 +++++-
16 files changed, 128 insertions(+), 67 deletions(-)
diff --git a/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx b/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx
index 0ea13aad1..e4f119355 100644
--- a/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx
+++ b/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx
@@ -98,9 +98,7 @@ function FervidexForm({
Warning: You should always import from your network first. Statically
- imported scores have the bare minimum data (Lamp + EX Score + BP), but due
- to score de-duplication rules, future network imports cannot append more
- data (Timestamps, Graphs, etc.) to these scores.
+ imported scores have the bare minimum data (No timestamps!).
diff --git a/client/src/app/pages/dashboard/users/KsHookSV6CIntegrationPage.tsx b/client/src/app/pages/dashboard/users/KsHookSV6CIntegrationPage.tsx
index 1b9a86582..3b41beece 100644
--- a/client/src/app/pages/dashboard/users/KsHookSV6CIntegrationPage.tsx
+++ b/client/src/app/pages/dashboard/users/KsHookSV6CIntegrationPage.tsx
@@ -88,9 +88,7 @@ function KsHookSV6CForm({
Warning: You should always import from your network first. Statically
- imported scores have the bare minimum data (Lamp + EX Score + BP), but due
- to score de-duplication rules, future network imports cannot append more
- data (Timestamps, Graphs, etc.) to these scores.
+ imported scores have the bare minimum data (No timestamps!).
diff --git a/client/src/app/pages/dashboard/users/UserSettingsPage.tsx b/client/src/app/pages/dashboard/users/UserSettingsPage.tsx
index 4f9d1ffab..9c2bef351 100644
--- a/client/src/app/pages/dashboard/users/UserSettingsPage.tsx
+++ b/client/src/app/pages/dashboard/users/UserSettingsPage.tsx
@@ -259,8 +259,8 @@ function ImageForm({ reqUser }: { reqUser: UserDocument }) {
return (
- Remember Rule 6! Do not set inappropriate stuff as your avatar/banner. If you have
- to ask, the answer is probably no.
+ Do not set inappropriate stuff as your avatar/banner. If you have to ask, the answer
+ is probably no.
Profile Picture
diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx
index 290f47e4d..331a4c744 100644
--- a/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx
+++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/UGPTSettingsPage.tsx
@@ -211,38 +211,37 @@ function PreferencesForm({ reqUser, game, playtype }: UGPT) {
)}
- Preferred Score Info
+ Preferred Folder Info
-
-
+
+
- What should {TachiConfig.name} prefer to show you about scores?
-
- Note: This will only affect defaults, such as what graph is shown in the folder
- breakdown. You can still view all the same stats!
-
-
-
- Preferred Ranking
-
-
-
-
-
- What should {TachiConfig.name} default to when showing your score rankings?
+ What should {TachiConfig.name} default to showing you about folders?
+ {settings.rivals.length !== 0 && (
+
+ Preferred Ranking
+
+
+
+
+
+ What should {TachiConfig.name} default to when showing your score rankings?
+
+
+ )}
Preferred Table
- What folders would you like to see when you go to the folders page by default?
+ What folders would you like to see by default?
{game === "iidx" && (
@@ -572,13 +571,13 @@ function ManageAccount({ reqUser, game, playtype }: UGPT) {
Delete Score
If you have an invalid score, you can delete it by going to that score and clicking
- "Manage Score".
+ "Delete Score".
Undo Import
If you messed up an import, you can undo it by going to{" "}
your imports page and click
- "Manage Import".
+ "Revert Import".
Completely Wipe Profile
diff --git a/client/src/components/layout/subheader/components/Breadcrumbs.tsx b/client/src/components/layout/subheader/components/Breadcrumbs.tsx
index a4722bf72..4d02e551c 100644
--- a/client/src/components/layout/subheader/components/Breadcrumbs.tsx
+++ b/client/src/components/layout/subheader/components/Breadcrumbs.tsx
@@ -1,5 +1,6 @@
import React, { Fragment } from "react";
import { Link } from "react-router-dom";
+import { GetGameConfig } from "tachi-common";
export function Breadcrumbs({ items }: { items: string[] }) {
const url = location.pathname;
@@ -12,17 +13,28 @@ export function Breadcrumbs({ items }: { items: string[] }) {
- {items.map((name, index) => (
-
-
-
- {name}
-
-
- ))}
+ {items.map((name, index) => {
+ // Skip playtype in the breadcrumbs if the game only has one playtype.
+ // @hack
+ // this only works if the game has one playtype called "Single".
+ // Some games (like pop'n) have one playtype, but it's called
+ // 9B. They'll just have to cope.
+ if (items[index - 2] === "Games" && name === "Single") {
+ return;
+ }
+
+ return (
+
+
+
+ {name}
+
+
+ );
+ })}
);
}
diff --git a/client/src/components/sessions/SessionRaiseBreakdown.tsx b/client/src/components/sessions/SessionRaiseBreakdown.tsx
index 6cf6c7b18..31da3632d 100644
--- a/client/src/components/sessions/SessionRaiseBreakdown.tsx
+++ b/client/src/components/sessions/SessionRaiseBreakdown.tsx
@@ -129,6 +129,10 @@ function SessionScoreStatBreakdown({
Record
> = {};
+ // dedupe grades/lamps for repeat plays
+ const isBestGradeThisSession = new Map();
+ const isBestLampThisSession = new Map();
+
for (const scoreInfo of sessionData.session.scoreInfo) {
const score = scoreMap.get(scoreInfo.scoreID);
@@ -139,15 +143,51 @@ function SessionScoreStatBreakdown({
continue;
}
+ const g = isBestGradeThisSession.get(score.chartID);
+ const l = isBestLampThisSession.get(score.chartID);
+
+ // if we haven't saw this chart before
+ // or the score we have saw for this chart before had a worse grade
+ if (!g || (g.scoreData.gradeIndex && g < score.scoreData.gradeIndex)) {
+ isBestGradeThisSession.set(score.chartID, score);
+ }
+
+ // same but for lamp
+ if (!l || (l.scoreData.lampIndex && l < score.scoreData.lampIndex)) {
+ isBestLampThisSession.set(score.chartID, score);
+ }
+ }
+
+ for (const scoreInfo of sessionData.session.scoreInfo) {
+ const score = scoreMap.get(scoreInfo.scoreID);
+
+ if (!score) {
+ console.error(
+ `Session score info contains scoreID ${scoreInfo.scoreID}, but no score exists?`
+ );
+ continue;
+ }
+
+ const wasBestLamp = isBestLampThisSession.get(score.chartID)?.scoreID === score.scoreID;
+ const wasBestGrade =
+ isBestGradeThisSession.get(score.chartID)?.scoreID === score.scoreID;
+
if (scoreInfo.isNewScore) {
- PartialArrayRecordAssign(newLamps, score.scoreData.lamp, { score, scoreInfo });
- PartialArrayRecordAssign(newGrades, score.scoreData.grade, { score, scoreInfo });
+ if (wasBestLamp) {
+ PartialArrayRecordAssign(newLamps, score.scoreData.lamp, { score, scoreInfo });
+ }
+ if (wasBestGrade) {
+ PartialArrayRecordAssign(newGrades, score.scoreData.grade, {
+ score,
+ scoreInfo,
+ });
+ }
} else {
- if (scoreInfo.lampDelta > 0) {
+ if (scoreInfo.lampDelta > 0 && wasBestLamp) {
PartialArrayRecordAssign(newLamps, score.scoreData.lamp, { score, scoreInfo });
}
- if (scoreInfo.gradeDelta > 0) {
+ if (scoreInfo.gradeDelta > 0 && wasBestLamp) {
PartialArrayRecordAssign(newGrades, score.scoreData.grade, {
score,
scoreInfo,
diff --git a/client/src/components/tables/components/SelectableRanking.tsx b/client/src/components/tables/components/SelectableRanking.tsx
index 84ddef0da..94a5039b6 100644
--- a/client/src/components/tables/components/SelectableRanking.tsx
+++ b/client/src/components/tables/components/SelectableRanking.tsx
@@ -17,7 +17,12 @@ export default function SelectableRanking({
} & ZTableTHProps) {
const { settings } = useLUGPTSettings();
- if (rankingViewMode === "both-if-self" || rankingViewMode === "global-no-switch" || !settings) {
+ if (
+ rankingViewMode === "both-if-self" ||
+ rankingViewMode === "global-no-switch" ||
+ !settings ||
+ settings.rivals.length === 0
+ ) {
return (
- Manage Import
+ Revert Import
)}
diff --git a/client/src/components/tables/dropdowns/ScoreDropdown.tsx b/client/src/components/tables/dropdowns/ScoreDropdown.tsx
index 17739e2c4..18e9a7f03 100644
--- a/client/src/components/tables/dropdowns/ScoreDropdown.tsx
+++ b/client/src/components/tables/dropdowns/ScoreDropdown.tsx
@@ -166,18 +166,18 @@ export default function ScoreDropdown({
Goals & Quests{targetData && ` (${targetData.goals.length})`}
)}
- {currentUser?.id === user.id && (
-
-
- Manage Score
-
- )}
{currentUser && (
Rivals
)}
+ {currentUser?.id === user.id && (
+
+
+ Delete Score
+
+ )}
diff --git a/client/src/components/tables/imports/ImportsTable.tsx b/client/src/components/tables/imports/ImportsTable.tsx
index d8dda49ac..6f7196c76 100644
--- a/client/src/components/tables/imports/ImportsTable.tsx
+++ b/client/src/components/tables/imports/ImportsTable.tsx
@@ -41,10 +41,7 @@ function Row({ data }: { data: ImportDataset[0] }) {
return (
}>