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 +++++++++++++----------------- src/index.css | 4 ++++ src/types.ts | 23 ++++++++++++++++++++++- 5 files changed, 65 insertions(+), 23 deletions(-) (limited to 'src') 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
-
+
- { /*
- - -
*/ }
- - + +
- - + +
- - + +
- - + +
- - + +
}/> diff --git a/src/index.css b/src/index.css index 9af3266..72845f6 100644 --- a/src/index.css +++ b/src/index.css @@ -158,3 +158,7 @@ a:hover .contact:first-child + .contact { opacity: 1; } filter: drop-shadow(-10px 5px 4px rgba(0, 0, 0, 0.8)); } } + +pre { + max-width: 50vw; +} diff --git a/src/types.ts b/src/types.ts index f28148b..0437cb4 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,5 +1,26 @@ export type ImageRendering = "auto" | "crisp-edges" | "pixelated"; -export type GameType = { id: number, card_img: string, char_img: string, title_img: string, img_rendering: ImageRendering, titleSlug: string }; +export type Tag = { + id: number, + tag_type: string, + name: string, +}; +export type GameType = { + id: number, + title: string, + titleSlug: string, + description: string, + github_link: string, + img_rendering: ImageRendering, + status: string, + order: number, + created_at: string, + updated_at: string, + user_id: number, + tags: Tag[], + card_img: string, + char_img: string, + title_img: string, +}; export type GameCardProps = { link: string, game: GameType }; -- cgit v1.2.3