diff --git a/client/package.json b/client/package.json index 2341aa898..6e15a70fe 100644 --- a/client/package.json +++ b/client/package.json @@ -80,7 +80,7 @@ "resolve": "1.12.0", "resolve-url-loader": "3.1.0", "socicon": "3.0.5", - "tachi-common": "0.3.6" + "tachi-common": "0.3.8" }, "devDependencies": { "@types/humanize-duration": "3.25.1", diff --git a/client/pnpm-lock.yaml b/client/pnpm-lock.yaml index 93e9f5436..7fdb89bc1 100644 --- a/client/pnpm-lock.yaml +++ b/client/pnpm-lock.yaml @@ -82,7 +82,7 @@ specifiers: serve: 11.2.0 socicon: 3.0.5 style-loader: 1.0.0 - tachi-common: 0.3.6 + tachi-common: 0.3.8 terser-webpack-plugin: 1.4.1 ts-pnp: 1.1.4 typescript: 4.3.5 @@ -152,7 +152,7 @@ dependencies: resolve: 1.12.0 resolve-url-loader: 3.1.0 socicon: 3.0.5 - tachi-common: 0.3.6 + tachi-common: 0.3.8 devDependencies: '@types/humanize-duration': 3.25.1 @@ -11211,8 +11211,8 @@ packages: strip-ansi: 6.0.0 dev: true - /tachi-common/0.3.6: - resolution: {integrity: sha512-Ivo5e9PoFrD+yUhlfVibIGOCDiEnJ45imxADSQpUf3G23u/e0gt+tpIa7J1u/QWE+nCuERMCuozLx2UrAmXFbw==} + /tachi-common/0.3.8: + resolution: {integrity: sha512-qELLS57zTgftvvAuHrojq8myJs2OV6FWMQUXcSZd5tk43jbDZH7tS4N/NExGSw/COAdCR1eLcspYAkM8WTdUaw==} dependencies: monk: 7.3.4 transitivePeerDependencies: 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 9cb140fdd..410f0fd07 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 @@ -7,7 +7,9 @@ import UGPTStatShowcase from "components/user/UGPTStatShowcase"; import AsyncLoader from "components/util/AsyncLoader"; import Divider from "components/util/Divider"; import Icon from "components/util/Icon"; +import Muted from "components/util/Muted"; 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"; @@ -280,13 +282,16 @@ function UserHistory({ const gptConfig = GetGamePTConfig(game, playtype); const [mode, setMode] = useState<"ranking" | "playcount" | "rating">("ranking"); - const [rating, setRating] = useState( - gptConfig.defaultProfileRatingAlg - ); + + const preferredRating = useProfileRatingAlg(game, playtype); + + const [rating, setRating] = useState(preferredRating); const propName = useMemo(() => { if (mode === "rating" && rating) { return UppercaseFirst(rating); + } else if (mode === "ranking") { + return `${UppercaseFirst(rating)} Ranking`; } return UppercaseFirst(mode); @@ -296,7 +301,12 @@ function UserHistory({ if (mode === "rating" && rating) { return data[0].ratings[rating] ? data[0].ratings[rating]!.toFixed(2) : "N/A"; } else if (mode === "ranking") { - return `#${data[0].ranking}`; + return ( + <> + #{data[0].rankings[rating].ranking} + /{data[0].rankings[rating].outOf} + + ); } return data[0].playcount; @@ -337,7 +347,24 @@ function UserHistory({ {mode === "ranking" ? ( - + <> +
+ +
+ + ) : mode === "playcount" ? ( ({ x: d.timestamp, y: d.ranking })), + data: data.map(d => ({ x: d.timestamp, y: d.rankings[rating].ranking })), }, ]} axisBottom={{