diff --git a/client/src/components/activity/Activity.tsx b/client/src/components/activity/Activity.tsx index 98b85ca27..286dc7e99 100644 --- a/client/src/components/activity/Activity.tsx +++ b/client/src/components/activity/Activity.tsx @@ -1,7 +1,7 @@ import { ClumpActivity, GetUsers } from "util/activity"; import { APIFetchV1 } from "util/api"; import { ONE_HOUR } from "util/constants/time"; -import { CreateUserMap } from "util/data"; +import { CreateScoreIDMap, CreateUserMap } from "util/data"; import { NO_OP, TruncateString } from "util/misc"; import { FormatTime, MillisToSince } from "util/time"; import ClassBadge from "components/game/ClassBadge"; @@ -17,7 +17,7 @@ import useApiQuery from "components/util/query/useApiQuery"; import React, { useContext, useEffect, useState } from "react"; import { Button, Col, Row } from "react-bootstrap"; import { Link } from "react-router-dom"; -import { FormatChart, FormatGame, UserDocument } from "tachi-common"; +import { FormatChart, FormatGame, GetGamePTConfig, UserDocument } from "tachi-common"; import { ActivityReturn, RecordActivityReturn, SessionReturns } from "types/api-returns"; import { UGPT } from "types/react"; import { ScoreDataset } from "types/tables"; @@ -393,6 +393,47 @@ function SessionShower({ sessionID }: { sessionID: string }) { return ; } + const scoreMap = CreateScoreIDMap(data.scores); + + const gptConfig = GetGamePTConfig(data.session.game, data.session.playtype); + + const raises = data.session.scoreInfo.filter((e) => { + const score = scoreMap.get(e.scoreID); + + // shouldnt happen, but whatever + if (!score) { + return false; + } + + if (e.isNewScore) { + return ( + score.scoreData.lampIndex > gptConfig.lamps.indexOf(gptConfig.clearLamp) || + score.scoreData.gradeIndex > gptConfig.grades.indexOf(gptConfig.clearGrade) + ); + } else if (e.gradeDelta > 0) { + return score.scoreData.gradeIndex > gptConfig.grades.indexOf(gptConfig.clearGrade); + } else if (e.lampDelta > 0) { + return score.scoreData.lampIndex > gptConfig.lamps.indexOf(gptConfig.clearLamp); + } + + return false; + }); + + if (raises.length === 0) { + return ( + +
+ + View Full Session + +
+
+ ); + } + return ( diff --git a/client/src/components/sessions/SessionRaiseBreakdown.tsx b/client/src/components/sessions/SessionRaiseBreakdown.tsx index 1346c1762..b5e2afaba 100644 --- a/client/src/components/sessions/SessionRaiseBreakdown.tsx +++ b/client/src/components/sessions/SessionRaiseBreakdown.tsx @@ -330,7 +330,7 @@ function ElementStatTable({ if (tableContents.length === 0) { return ( - Nothing... + No Raises... ); }