From e0df9ed858d65d8e913b01f62257bfd65f409b98 Mon Sep 17 00:00:00 2001 From: isaconantonis Date: Fri, 28 Jul 2023 15:33:57 +0200 Subject: [PATCH] pages --- components/Layout/Layout.tsx | 4 +-- components/Navbar/Navbar.tsx | 32 +++++++++++++++++------- pages/api/events.ts | 15 ++++++++++++ pages/api/games.ts | 15 ++++++++++++ pages/api/players.ts | 9 +++---- pages/api/teams.ts | 15 ++++++++++++ pages/calendar.tsx | 47 ++++++++++++++++++++++++++++++++++++ pages/dashboard.tsx | 16 ++++++++++++ pages/index.tsx | 20 +-------------- pages/projects.tsx | 34 ++++++++++++++++++++++++++ pages/team.tsx | 34 ++++++++++++++++++++++++++ 11 files changed, 206 insertions(+), 35 deletions(-) create mode 100644 pages/api/events.ts create mode 100644 pages/api/games.ts create mode 100644 pages/api/teams.ts create mode 100644 pages/calendar.tsx create mode 100644 pages/dashboard.tsx create mode 100644 pages/projects.tsx create mode 100644 pages/team.tsx diff --git a/components/Layout/Layout.tsx b/components/Layout/Layout.tsx index bc66007..e10f680 100644 --- a/components/Layout/Layout.tsx +++ b/components/Layout/Layout.tsx @@ -13,9 +13,9 @@ export default function Layout({ children }) { IsaCon -
+
-
{children}
+
{children}
diff --git a/components/Navbar/Navbar.tsx b/components/Navbar/Navbar.tsx index 636272c..fcc180c 100644 --- a/components/Navbar/Navbar.tsx +++ b/components/Navbar/Navbar.tsx @@ -1,6 +1,8 @@ +import Link from "next/link" + export default function Navbar() { return ( -
diff --git a/pages/projects.tsx b/pages/projects.tsx new file mode 100644 index 0000000..5dacea1 --- /dev/null +++ b/pages/projects.tsx @@ -0,0 +1,34 @@ +export async function getServerSideProps({ res }) { + res.setHeader("Cache-Control", "public, s-maxage=10, stale-while-revalidate=59") + const eventsResponse = await fetch("http://localhost:3000/api/events", { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + }) + const allEvents = await eventsResponse.json() + + return { + props: { allEvents }, + } +} + +export default function Dashboard({ allEvents }) { + return ( + <> +
+
+
+

+ IsaCon +

+

Events

+ {allEvents.data.map((event) => ( +
{event.name}
+ ))} +
+
+
+ + ) +} diff --git a/pages/team.tsx b/pages/team.tsx new file mode 100644 index 0000000..dd48b5e --- /dev/null +++ b/pages/team.tsx @@ -0,0 +1,34 @@ +export async function getServerSideProps({ res }) { + res.setHeader("Cache-Control", "public, s-maxage=10, stale-while-revalidate=59") + const playersResponse = await fetch("http://localhost:3000/api/players", { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + }) + const allPlayers = await playersResponse.json() + + return { + props: { allPlayers }, + } +} + +export default function Dashboard({ allPlayers }) { + return ( + <> +
+
+
+

+ IsaCon +

+

Players

+ {allPlayers.data.map((player) => ( +
{player.name}
+ ))} +
+
+
+ + ) +}