From b02b45c17aae711153e99454f1009c84bf742936 Mon Sep 17 00:00:00 2001 From: Kristoffer Longva Eriksen Date: Wed, 23 Mar 2022 09:04:11 +0100 Subject: [PATCH 1/3] Added copy invite link function --- src/client/package-lock.json | 5 +++++ src/client/package.json | 1 + src/client/src/managetournament.js | 21 ++++++++++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/client/package-lock.json b/src/client/package-lock.json index 28abee9..8c98e70 100644 --- a/src/client/package-lock.json +++ b/src/client/package-lock.json @@ -9550,6 +9550,11 @@ "warning": "^4.0.3" } }, + "react-custom-alert": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/react-custom-alert/-/react-custom-alert-0.1.2.tgz", + "integrity": "sha512-VkxPh4loaDzeQ4THauq5qOETr/SL/4L+4k1Ie3C948nSgxCy0CSY7MKrzkFwiwIiYCxib3/60zIqmTLUECHEww==" + }, "react-dev-utils": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.0.tgz", diff --git a/src/client/package.json b/src/client/package.json index 69be55f..ee1147a 100644 --- a/src/client/package.json +++ b/src/client/package.json @@ -14,6 +14,7 @@ "iarn": "0.0.0", "react": "^17.0.2", "react-bootstrap": "^2.2.1", + "react-custom-alert": "^0.1.2", "react-dom": "^17.0.2", "react-router-dom": "^6.2.2", "react-scripts": "5.0.0", diff --git a/src/client/src/managetournament.js b/src/client/src/managetournament.js index 15b3ab5..3f06870 100644 --- a/src/client/src/managetournament.js +++ b/src/client/src/managetournament.js @@ -1,5 +1,6 @@ import * as React from "react"; import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom"; +import { AlertContainer, alert } from "react-custom-alert"; import HomeImage from "./components/homeimage"; import SaveButton from "./components/savebutton"; @@ -39,18 +40,23 @@ function AnnounceButton(props) { } function InviteButton(props) { + function event() { + copy(); + alertSuccess(); + } + const copy = () => { + navigator.clipboard.writeText("discord.gg/asura"); + }; + const alertSuccess = () => + alert({ message: "Copied to clipboard.", type: "success" }); return ( - ); } +//navigator.clipboard.writeText("discord.gg/asura") export default function TournamentManager() { return ( @@ -59,6 +65,7 @@ export default function TournamentManager() { + ); } From a9756fc05120dd946a87f045c10270c4aa0b1ba6 Mon Sep 17 00:00:00 2001 From: Kristoffer Longva Eriksen Date: Wed, 23 Mar 2022 09:25:25 +0100 Subject: [PATCH 2/3] Removed Tournament organizer and format selector from create form --- src/client/src/createtournament.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/client/src/createtournament.js b/src/client/src/createtournament.js index 6a98136..8d240ef 100644 --- a/src/client/src/createtournament.js +++ b/src/client/src/createtournament.js @@ -10,18 +10,6 @@ function CreateButton(props) { ); } -function FormatSelector(props) { - return ( -
- Tournament Format: - -
- ); -} - function ParticipantLimit(props) { return (
@@ -43,9 +31,6 @@ function CreateForm(props) { return (
- - -

@@ -73,7 +58,6 @@ export default function CreateTournament(props) { - From 11b06695525d3c702e7fc81b63fbee24302d69aa Mon Sep 17 00:00:00 2001 From: Kristoffer Longva Eriksen Date: Wed, 23 Mar 2022 10:09:34 +0100 Subject: [PATCH 3/3] trying to fetch API --- src/client/src/frontpage.js | 56 ++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/src/client/src/frontpage.js b/src/client/src/frontpage.js index c422242..18a0572 100644 --- a/src/client/src/frontpage.js +++ b/src/client/src/frontpage.js @@ -15,12 +15,12 @@ import CssBaseline from "@mui/material/CssBaseline"; import AppBar from "@mui/material/AppBar"; import Toolbar from "@mui/material/Toolbar"; import Typography from "@mui/material/Typography"; -import Grid from '@mui/material/Grid' -import Box from '@mui/material/Box' +import Grid from "@mui/material/Grid"; +import Box from "@mui/material/Box"; function CreateButton(props) { return ( - + @@ -30,7 +30,7 @@ function CreateButton(props) { function OverviewButton(props) { return ( - + @@ -58,29 +58,53 @@ function ListElement(props) { ); } +function TournamentList() { + let [data, setData] = React.useState(null); + React.useEffect(() => { + fetch("https://jsonplaceholder.typicode.com/todos/1") + .then((res) => res.json()) + .then((data) => { + console.log(data); + }) + .catch((err) => console.log("oopsie")); + }, []); + return
{data && data.map((id) => console.log(id))}
; +} + function Home() { return ( - + This is an Appbar
- - - - - - - - + + + + + + + + +
-
- -
+
); }