Merge pull request #45 from TNG-dev/hotfix-stats-0

This commit is contained in:
zkldi
2021-12-01 11:19:27 +00:00
committed by GitHub
2 changed files with 29 additions and 17 deletions
@@ -72,6 +72,7 @@ export default function UGPTStatContainer({
return (
<StatDisplay
reqUser={reqUser}
game={game}
playtype={playtype}
statData={data.data}
+28 -17
View File
@@ -228,6 +228,7 @@ export default function UGPTStatShowcase({
className="col-12 col-md-4 d-flex align-items-stretch mt-8"
>
<StatDisplay
reqUser={reqUser}
statData={e}
compareData={
data.thisUserData
@@ -368,11 +369,17 @@ export function GetStatName(
export function StatDisplay({
statData,
reqUser,
compareData,
game,
playtype,
}: { statData: UGPTPreferenceStatsReturn; compareData?: UGPTPreferenceStatsReturn } & GamePT) {
}: {
statData: UGPTPreferenceStatsReturn;
compareData?: UGPTPreferenceStatsReturn;
reqUser: PublicUserDocument;
} & GamePT) {
const { stat, result, related } = statData;
const { user } = useContext(UserContext);
if (stat.mode === "chart") {
const { song, chart } = related as { song: SongDocument; chart: ChartDocument };
@@ -388,14 +395,16 @@ export function StatDisplay({
{UppercaseFirst(stat.property)}:{" "}
{FormatPropertyGTE(game, playtype, stat.property, result.value)}
</h4>
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
{user && user.id !== reqUser.id && (
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
)}
</>
</Card>
);
@@ -426,14 +435,16 @@ export function StatDisplay({
<small className="text-muted">/{result.outOf}</small>
</h4>
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
{user && user.id !== reqUser.id && (
<StatDelta
v1={statData.result.value}
v2={compareData?.result.value}
mode={stat.mode}
property={stat.property}
game={game}
playtype={playtype}
/>
)}
</>
</Card>
);