From 432d2d6517d7c32d34210b4fab230885e8bf5590 Mon Sep 17 00:00:00 2001 From: Maxim Velesyuk Date: Thu, 12 Sep 2024 23:24:09 +0200 Subject: [PATCH 1/2] Add scroll restoration --- src/components/MainScreen.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/MainScreen.tsx b/src/components/MainScreen.tsx index b893ff6b..d6ec87f7 100644 --- a/src/components/MainScreen.tsx +++ b/src/components/MainScreen.tsx @@ -1,17 +1,19 @@ -import { Box } from "@mui/material"; -import { Page } from "utils/types"; -import MainMenu from "./MainMenu"; +import { Box } from '@mui/material' +import { ScrollRestoration } from 'react-router-dom' +import { Page } from 'utils/types' +import MainMenu from './MainMenu' type Props = { - currentPage: Page; - children?: React.ReactNode; -}; + currentPage: Page + children?: React.ReactNode +} export default function MainScreen({ children, currentPage }: Props) { return ( {children} + - ); + ) } From 6bfa1fd2186ff7c2342f735857dc8b6abd5d9ec3 Mon Sep 17 00:00:00 2001 From: Maxim Velesyuk Date: Fri, 13 Sep 2024 13:18:30 +0200 Subject: [PATCH 2/2] Add stats page --- src/App.tsx | 9 ++++ src/components/MainMenu.tsx | 2 +- src/pages/stats/StatsPage.tsx | 87 +++++++++++++++++++++++++++++++++++ src/utils/api.ts | 28 ++++++++++- src/utils/mocks.ts | 17 ++++++- 5 files changed, 140 insertions(+), 3 deletions(-) create mode 100644 src/pages/stats/StatsPage.tsx diff --git a/src/App.tsx b/src/App.tsx index da972b4d..28235262 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,6 +2,7 @@ import { createTheme, CssBaseline, ThemeProvider } from '@mui/material' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import AboutPage from 'pages/about/AboutPage' import RulesPage from 'pages/rules/RulesPage' +import StatsPage from 'pages/stats/StatsPage' import React from 'react' import { createBrowserRouter, RouterProvider } from 'react-router-dom' import './App.css' @@ -52,6 +53,14 @@ const router = createBrowserRouter( ), }, + { + path: '/stats', + element: ( + + + + ), + }, ], { basename: '/' } ) diff --git a/src/components/MainMenu.tsx b/src/components/MainMenu.tsx index ac25124b..96e03310 100644 --- a/src/components/MainMenu.tsx +++ b/src/components/MainMenu.tsx @@ -78,7 +78,7 @@ export default function MainMenu({ currentPage }: Props) { - +