From 57363db5bce014b2462a176f1426e055b578630d Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Wed, 17 Aug 2022 15:17:03 +0100 Subject: [PATCH 1/3] feat: ugpt overview show raises, improve raises ui on mobile --- .../games/_game/_playtype/OverviewPage.tsx | 152 +++++++++--------- .../components/sessions/SessionOverview.tsx | 2 +- .../sessions/SessionRaiseBreakdown.tsx | 4 +- 3 files changed, 77 insertions(+), 81 deletions(-) diff --git a/client/src/app/pages/dashboard/users/games/_game/_playtype/OverviewPage.tsx b/client/src/app/pages/dashboard/users/games/_game/_playtype/OverviewPage.tsx index 0ff734736..461835099 100644 --- a/client/src/app/pages/dashboard/users/games/_game/_playtype/OverviewPage.tsx +++ b/client/src/app/pages/dashboard/users/games/_game/_playtype/OverviewPage.tsx @@ -18,7 +18,7 @@ import SelectButton from "components/util/SelectButton"; import { useProfileRatingAlg } from "components/util/useScoreRatingAlg"; import { DateTime } from "luxon"; import React, { useMemo, useState } from "react"; -import { Badge } from "react-bootstrap"; +import { Badge, Row } from "react-bootstrap"; import { FormatGame, GetGameConfig, @@ -31,6 +31,7 @@ import { import { SessionReturns, UGPTHistory } from "types/api-returns"; import { GamePT } from "types/react"; import { ScoreDataset } from "types/tables"; +import SessionRaiseBreakdown from "components/sessions/SessionRaiseBreakdown"; export default function OverviewPage({ reqUser, @@ -84,81 +85,76 @@ function LastSession({ reqUser, game, playtype }: { reqUser: PublicUserDocument data && (
- { - <> -
-

{data.session.name}

- {data.session.desc} - -
+
+

{data.session.name}

+ {data.session.desc} + +
-
- - - Started - {FormatTime(data.session.timeStarted)} - - - {/* If session ended less than 2 hours ago, it can still be appended to. */} - {/* Kinda - time is a bit nonlinear wrt. importing scores, as scores don't have to have */} - {/* happened at the same time they were imported. */} - {/* that doesn't matter though - this is just a UI thing */} - - {Date.now() - data.session.timeEnded < - ONE_HOUR * 2 - ? "Last Score" - : "Ended At"} - - - {FormatTime(data.session.timeEnded)} - {/* if the last score was less than 10 mins ago, this session is probably still being populated */} - {Date.now() - data.session.timeEnded < - ONE_MINUTE * 10 && ( - <> -
- - Ongoing! - - - )} - - - - Duration - - {FormatDuration( - data.session.timeEnded - - data.session.timeStarted - )} - - - - Scores - {data.session.scoreInfo.length} - - - PBs - {GetPBs(data.session.scoreInfo).length} - -
-
-
- -
- - } +
+ + + Started + {FormatTime(data.session.timeStarted)} + + + {/* If session ended less than 2 hours ago, it can still be appended to. */} + {/* Kinda - time is a bit nonlinear wrt. importing scores, as scores don't have to have */} + {/* happened at the same time they were imported. */} + {/* that doesn't matter though - this is just a UI thing */} + + {Date.now() - data.session.timeEnded < ONE_HOUR * 2 + ? "Last Score" + : "Ended At"} + + + {FormatTime(data.session.timeEnded)} + {/* if the last score was less than 10 mins ago, this session is probably still being populated */} + {Date.now() - data.session.timeEnded < + ONE_MINUTE * 10 && ( + <> +
+ + Ongoing! + + + )} + + + + Duration + + {FormatDuration( + data.session.timeEnded - data.session.timeStarted + )} + + + + Scores + {data.session.scoreInfo.length} + + + PBs + {GetPBs(data.session.scoreInfo).length} + +
+
+
+ + void 0} + /> + +
+
+ + +
) @@ -170,14 +166,14 @@ function LastSession({ reqUser, game, playtype }: { reqUser: PublicUserDocument function RecentSessionScoreInfo({ session, sessionData, - game, - playtype, reqUser, }: { session: SessionDocument; sessionData: SessionReturns; reqUser: PublicUserDocument; -} & GamePT) { +}) { + const { game, playtype } = session; + const highlightedScores = sessionData.scores.filter((e) => e.highlight); const [mode, setMode] = useState<"highlight" | "best" | "recent">( diff --git a/client/src/components/sessions/SessionOverview.tsx b/client/src/components/sessions/SessionOverview.tsx index 4ce8034ed..fe93be0ce 100644 --- a/client/src/components/sessions/SessionOverview.tsx +++ b/client/src/components/sessions/SessionOverview.tsx @@ -40,7 +40,7 @@ export default function SessionOverview({ - + diff --git a/client/src/components/sessions/SessionRaiseBreakdown.tsx b/client/src/components/sessions/SessionRaiseBreakdown.tsx index feccdbc57..cafb0cbd5 100644 --- a/client/src/components/sessions/SessionRaiseBreakdown.tsx +++ b/client/src/components/sessions/SessionRaiseBreakdown.tsx @@ -117,7 +117,7 @@ export default function SessionRaiseBreakdown({ <>
-
+
@@ -138,7 +138,7 @@ export default function SessionRaiseBreakdown({
-
+
setInnerComment(e.target.value)} /> +
- {comment !== null && ( + {initialComment !== null && (