From 2c91f4867cef841f00bdcdacdf51c6616539ee30 Mon Sep 17 00:00:00 2001
From: zkldi <20380519+zkldi@users.noreply.github.com>
Date: Fri, 22 Jul 2022 01:02:42 +0100
Subject: [PATCH] fix(client): move breakdown to the main session view
---
.../_game/_playtype/SpecificSessionPage.tsx | 11 +--
.../components/sessions/SessionOverview.tsx | 67 +++++++++++--------
2 files changed, 41 insertions(+), 37 deletions(-)
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 eab5d3880..39d832117 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 { DelayedPageReload } from "util/misc";
import useSetSubheader from "components/layout/header/useSetSubheader";
import SessionOverview from "components/sessions/SessionOverview";
-import SessionRaiseBreakdown from "components/sessions/SessionRaiseBreakdown";
import ScoreTable from "components/tables/scores/ScoreTable";
import ApiError from "components/util/ApiError";
import Divider from "components/util/Divider";
@@ -69,7 +68,7 @@ function SessionPage({ data, game, playtype }: Props & { data: SessionReturns })
`${user.username}: ${session.name}`
);
- const [view, setView] = useState<"raises" | "overview" | "scores">("overview");
+ const [view, setView] = useState<"overview" | "scores">("overview");
const songMap = CreateSongMap(songs);
const chartMap = CreateChartMap(charts);
@@ -204,10 +203,6 @@ function SessionPage({ data, game, playtype }: Props & { data: SessionReturns })
>
)}
-
-
- Raises
-
Overview
@@ -219,9 +214,7 @@ function SessionPage({ data, game, playtype }: Props & { data: SessionReturns })
- {view === "raises" ? (
-
- ) : view === "overview" ? (
+ {view === "overview" ? (
) : (
diff --git a/client/src/components/sessions/SessionOverview.tsx b/client/src/components/sessions/SessionOverview.tsx
index 9953ab58a..f5d9ebe25 100644
--- a/client/src/components/sessions/SessionOverview.tsx
+++ b/client/src/components/sessions/SessionOverview.tsx
@@ -4,10 +4,11 @@ import Card from "components/layout/page/Card";
import ScoreTable from "components/tables/scores/ScoreTable";
import Divider from "components/util/Divider";
import React from "react";
-import { Col } from "react-bootstrap";
-import { GetGamePTConfig } from "tachi-common";
+import { Col, Row } from "react-bootstrap";
+import { GetGamePTConfig, SessionDocument } from "tachi-common";
import { SessionReturns } from "types/api-returns";
import { ScoreDataset } from "types/tables";
+import SessionRaiseBreakdown from "./SessionRaiseBreakdown";
export default function SessionOverview({
sessionData,
@@ -18,8 +19,6 @@ export default function SessionOverview({
}) {
const { scores, session } = sessionData;
- const gptConfig = GetGamePTConfig(session.game, session.playtype);
-
return (
<>
@@ -30,30 +29,12 @@ export default function SessionOverview({
e.highlight).length} />
-
-
-
Ratings
-
-
- {gptConfig.sessionRatingAlgs.map((e) => (
-
-
{UppercaseFirst(e)}
-
- {FormatSessionRating(
- session.game,
- session.playtype,
- e,
- session.calculatedData[e]
- )}
-
-
- ))}
-
-
-
+
+
+
+
+
+
@@ -65,10 +46,40 @@ export default function SessionOverview({
/>
+
>
);
}
+// Temporarily shoved to the bottom, as it needs to be significantly improved,
+// but we can't really just remove it lol.
+function RatingsOverview({ session }: { session: SessionDocument }) {
+ const gptConfig = GetGamePTConfig(session.game, session.playtype);
+
+ return (
+
+
+
+
+ {gptConfig.sessionRatingAlgs.map((e) => (
+
+
{UppercaseFirst(e)}
+
+ {FormatSessionRating(
+ session.game,
+ session.playtype,
+ e,
+ session.calculatedData[e]
+ )}
+
+
+ ))}
+
+
+
+ );
+}
+
function StatThing({
value,
name,