From c72edf37baf307322b49b7c75c59d077dda9bc83 Mon Sep 17 00:00:00 2001 From: realtradam Date: Sun, 16 Jun 2024 16:49:14 -0400 Subject: updated upload --- src/components/Game.tsx | 29 +++++++++++++++++++++++++---- src/components/Layout.tsx | 2 +- src/components/UploadGame.tsx | 30 +++++++++++++----------------- 3 files changed, 39 insertions(+), 22 deletions(-) (limited to 'src/components') diff --git a/src/components/Game.tsx b/src/components/Game.tsx index 51d5b3e..89c8333 100644 --- a/src/components/Game.tsx +++ b/src/components/Game.tsx @@ -1,18 +1,39 @@ -//import React, { useState, useEffect } from "react"; +import { useState, useEffect } from "react"; import { useParams } from "react-router-dom"; +import { GameType } from "../types"; +import ReactMarkdown from 'react-markdown'; //} /> //export default () => ( export default function Games () { const { game } = useParams(); + const [gameData, setGameData] = useState(); + + useEffect(() => { + const url = `${import.meta.env.VITE_API_TITLE}/api/v1/games/realtradam/${game}`; + fetch(url).then((response) => { + if (response.ok) { + return response.json(); + } + throw new Error("Network response was not ok."); + }).then((response) => setGameData(response)); //.catch(() => navigate("/")); + }, [game]); //http://%{VITE_API_TITLE}/api/v1/game/realtradam/orc-arena-of-time/index.html return( <> -
-
-
{game}
+
+
+
+ +
+
+ +
diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 50a3fd7..6952f1e 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -13,7 +13,7 @@ export default function Layout ({userData}: userData)
{ userData.name ?
Logged in as:
{userData.name}
: Login with Github }
Tradam
-
+
- { /*
- - -
*/ }
- - + +
- - + +
- - + +
- - + +
- - + +
}/> -- cgit v1.2.3