feat: use colourconfig better, patch LUGPTStats

This commit is contained in:
zkldi
2022-09-03 14:29:18 +01:00
parent cbaa9570d5
commit 9e36c81867
4 changed files with 8 additions and 9 deletions
+3 -3
View File
@@ -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 }) {
<BannedContextProvider>
<UserContextProvider>
<UserSettingsContextProvider>
<UserGameStatsContextProvider>
<AllLUGPTStatsContextProvider>
<LoadingScreen>
<BrowserRouter basename={basename}>
<MaterialThemeProvider>
@@ -33,7 +33,7 @@ export default function App({ basename }: { basename: string }) {
</MaterialThemeProvider>
</BrowserRouter>
</LoadingScreen>
</UserGameStatsContextProvider>
</AllLUGPTStatsContextProvider>
</UserSettingsContextProvider>
</UserContextProvider>
</BannedContextProvider>
@@ -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 }) {
<>
<Alert
style={{
backgroundColor:
TachiConfig.type === "ktchi" ? "#e61c6e44" : "#527acc44",
backgroundColor: `${ColourConfig.primary}44`,
color: "white",
}}
>
@@ -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,
}}
+1 -1
View File
@@ -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<UserGameStats[] | null>(null);
return (