aboutsummaryrefslogtreecommitdiffstats
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/README.md54
-rw-r--r--frontend/src/pages/Score.tsx19
2 files changed, 18 insertions, 55 deletions
diff --git a/frontend/README.md b/frontend/README.md
deleted file mode 100644
index da98444..0000000
--- a/frontend/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# React + TypeScript + Vite
-
-This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
-
-Currently, two official plugins are available:
-
-- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
-- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
-
-## Expanding the ESLint configuration
-
-If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
-
-```js
-export default tseslint.config({
- extends: [
- // Remove ...tseslint.configs.recommended and replace with this
- ...tseslint.configs.recommendedTypeChecked,
- // Alternatively, use this for stricter rules
- ...tseslint.configs.strictTypeChecked,
- // Optionally, add this for stylistic rules
- ...tseslint.configs.stylisticTypeChecked,
- ],
- languageOptions: {
- // other options...
- parserOptions: {
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
- tsconfigRootDir: import.meta.dirname,
- },
- },
-})
-```
-
-You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
-
-```js
-// eslint.config.js
-import reactX from 'eslint-plugin-react-x'
-import reactDom from 'eslint-plugin-react-dom'
-
-export default tseslint.config({
- plugins: {
- // Add the react-x and react-dom plugins
- 'react-x': reactX,
- 'react-dom': reactDom,
- },
- rules: {
- // other rules...
- // Enable its recommended typescript rules
- ...reactX.configs['recommended-typescript'].rules,
- ...reactDom.configs.recommended.rules,
- },
-})
-```
diff --git a/frontend/src/pages/Score.tsx b/frontend/src/pages/Score.tsx
index 5214f5b..ae2c794 100644
--- a/frontend/src/pages/Score.tsx
+++ b/frontend/src/pages/Score.tsx
@@ -2,6 +2,7 @@ import { useEffect, useState, useCallback } from "react";
import { useAuth } from "../contexts/AuthContext";
import { useNavigate } from "react-router";
import { NavBar } from "../components/NavBar";
+import type { SupportedGame} from "../types/game";
import SessionExpiredPopup from "../components/SessionExpiredPopup";
import ScoreDisplay from "../components/displays/GenericScoreDisplay";
import DancerushScoreDisplay from "../components/displays/DancerushScoreDisplay";
@@ -14,6 +15,7 @@ import { getFilterOptions } from "../types/constants";
const Score = () => {
const { user, isLoading, logout } = useAuth();
const navigate = useNavigate();
+ const [formattedGameName, setFormattedGameName] = useState("");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [scores, setScores] = useState<any[]>([]);
const [loading, setLoading] = useState(true);
@@ -37,6 +39,21 @@ const Score = () => {
}
};
+ useEffect(() => {
+ try{
+ fetch(import.meta.env.VITE_API_URL + `/supportedGames`)
+ .then(response => response.json())
+ .then(data => {
+ const game = data.find((game: SupportedGame) => game.internalName === gameName);
+ setFormattedGameName(game ? game.formattedName : gameName);
+ })
+ .catch(error => console.error(error));
+ } catch (error) {
+ console.error("Error:", error);
+ alert("Network error. Please try again.");
+ }
+ }, [gameName]);
+
const renderRequestFilterMenu = () => {
const filterOptions = getFilterOptions(gameName);
return (
@@ -158,7 +175,7 @@ const Score = () => {
<div className="mb-6 sm:mb-12">
<div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4">
<h1 className="text-2xl sm:text-3xl md:text-4xl font-bold bg-linear-to-r from-violet-400 to-violet-600 bg-clip-text text-transparent">
- Your Scores
+ Your Scores for {formattedGameName}
</h1>
<div className="flex items-center space-x-1 sm:space-x-2 bg-slate-900/50 backdrop-blur-sm rounded-xl p-1 border border-slate-800/50">
<button
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage