From 9e36c81867e39767673d8f445402bface10135fa Mon Sep 17 00:00:00 2001 From: zkldi Date: Sat, 3 Sep 2022 14:29:18 +0100 Subject: [PATCH] feat: use colourconfig better, patch LUGPTStats --- client/src/app/App.tsx | 6 +++--- client/src/app/pages/dashboard/DashboardPage.tsx | 5 ++--- .../pages/dashboard/games/_game/_playtype/GPTMainPage.tsx | 4 ++-- client/src/context/AllLUGPTStatsContext.tsx | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/client/src/app/App.tsx b/client/src/app/App.tsx index 57b068bc7..6f4a73a85 100644 --- a/client/src/app/App.tsx +++ b/client/src/app/App.tsx @@ -3,7 +3,7 @@ import { LoadingScreen } from "components/layout/screens/LoadingScreen"; import { BannedContextProvider } from "context/BannedContext"; import { SubheaderContextProvider } from "context/SubheaderContext"; import { UserContextProvider } from "context/UserContext"; -import { UserGameStatsContextProvider } from "context/UserGameStatsContext"; +import { AllLUGPTStatsContextProvider } from "context/AllLUGPTStatsContext"; import { UserSettingsContextProvider } from "context/UserSettingsContext"; import React from "react"; import { Toaster } from "react-hot-toast"; @@ -22,7 +22,7 @@ export default function App({ basename }: { basename: string }) { - + @@ -33,7 +33,7 @@ export default function App({ basename }: { basename: string }) { - + diff --git a/client/src/app/pages/dashboard/DashboardPage.tsx b/client/src/app/pages/dashboard/DashboardPage.tsx index afe20ad7a..8cb8eda96 100644 --- a/client/src/app/pages/dashboard/DashboardPage.tsx +++ b/client/src/app/pages/dashboard/DashboardPage.tsx @@ -16,7 +16,7 @@ import useApiQuery from "components/util/query/useApiQuery"; import { UserContext } from "context/UserContext"; import { AllLUGPTStatsContext } from "context/AllLUGPTStatsContext"; import { UserSettingsContext } from "context/UserSettingsContext"; -import { TachiConfig } from "lib/config"; +import { ColourConfig, TachiConfig } from "lib/config"; import React, { useContext } from "react"; import { Alert } from "react-bootstrap"; import { Link } from "react-router-dom"; @@ -88,8 +88,7 @@ function RecentInfo({ user }: { user: PublicUserDocument }) { <> diff --git a/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx b/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx index c4aa32108..37b74b3bc 100644 --- a/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx +++ b/client/src/app/pages/dashboard/games/_game/_playtype/GPTMainPage.tsx @@ -16,7 +16,7 @@ import Divider from "components/util/Divider"; import Icon from "components/util/Icon"; import Loading from "components/util/Loading"; import useApiQuery from "components/util/query/useApiQuery"; -import { TachiConfig } from "lib/config"; +import { ColourConfig, TachiConfig } from "lib/config"; import React, { useEffect, useState } from "react"; import { Col, Form, Row } from "react-bootstrap"; import { Link } from "react-router-dom"; @@ -353,7 +353,7 @@ function ClassDistChart({ indexBy="id" layout="horizontal" margin={{ left: 80, bottom: 40, top: 20, right: 20 }} - colors={(v) => "#cc527a"} + colors={() => ColourConfig.primary} axisLeft={{ format: (v) => gptConfig.classHumanisedFormat[className][v]?.display, }} diff --git a/client/src/context/AllLUGPTStatsContext.tsx b/client/src/context/AllLUGPTStatsContext.tsx index f3cf402b9..fd2cd549e 100644 --- a/client/src/context/AllLUGPTStatsContext.tsx +++ b/client/src/context/AllLUGPTStatsContext.tsx @@ -14,7 +14,7 @@ export const AllLUGPTStatsContext = createContext<{ }>({ ugs: null, setUGS: () => void 0 }); AllLUGPTStatsContext.displayName = "AllLUGPTStatsContext"; -export function UserGameStatsContextProvider({ children }: JustChildren) { +export function AllLUGPTStatsContextProvider({ children }: JustChildren) { const [ugs, setUGS] = useState(null); return (