Merge branch 'client' of gitlab.stud.idi.ntnu.no:felixalb/dcst1008-2022-group1 into client
This commit is contained in:
commit
7c2a72c285
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -12,18 +12,6 @@ function CreateButton(props) {
|
|||
);
|
||||
}
|
||||
|
||||
function FormatSelector(props) {
|
||||
return (
|
||||
<div>
|
||||
Tournament Format:
|
||||
<select>
|
||||
<option value="Single Elimination">Single Elimination</option>
|
||||
<option value="Double Elimination">Double Elimination</option>
|
||||
</select>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function ParticipantLimit(props) {
|
||||
return (
|
||||
<div>
|
||||
|
@ -45,9 +33,6 @@ function CreateForm(props) {
|
|||
return (
|
||||
<React.Fragment>
|
||||
<form>
|
||||
<label for="organizer">Tournament Organizer:</label>
|
||||
<input type="text" id="organizer" />
|
||||
<br />
|
||||
<label for="name">Tournament Name:</label>
|
||||
<input type="text" id="name" />
|
||||
<br />
|
||||
|
@ -76,7 +61,6 @@ export default function CreateTournament(props) {
|
|||
<CssBaseline />
|
||||
<Appbar />
|
||||
<CreateForm />
|
||||
<FormatSelector />
|
||||
<ParticipantLimit />
|
||||
<CreateButton />
|
||||
</React.Fragment>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import * as React from "react";
|
||||
import { BrowserRouter as Router, Link, Route, Routes } from "react-router-dom";
|
||||
import HomeImage from "./components/homeimage";
|
||||
import ManageButton from "./components/managebutton";
|
||||
import CreateTournament from "./createtournament.js";
|
||||
import TournamentOverview from "./tournamentoverview.js";
|
||||
|
@ -14,12 +13,12 @@ import Button from "@mui/material/Button";
|
|||
import Container from "@mui/material/Container";
|
||||
import CssBaseline from "@mui/material/CssBaseline";
|
||||
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 (
|
||||
<Link to="/create" style={{textDecoration:'none'}}>
|
||||
<Link to="/create" style={{ textDecoration: "none" }}>
|
||||
<Button variant="contained" color="primary">
|
||||
Create Tournament
|
||||
</Button>
|
||||
|
@ -29,7 +28,7 @@ function CreateButton(props) {
|
|||
|
||||
function OverviewButton(props) {
|
||||
return (
|
||||
<Link to="/tournament" style={{textDecoration:'none'}}>
|
||||
<Link to="/tournament" style={{ textDecoration: "none" }}>
|
||||
<Button variant="contained" color="success">
|
||||
View Tournament
|
||||
</Button>
|
||||
|
@ -57,24 +56,48 @@ 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 <div>{data && data.map((id) => console.log(id))}</div>;
|
||||
}
|
||||
|
||||
function Home() {
|
||||
return (
|
||||
<React.StrictMode>
|
||||
<CssBaseline />
|
||||
<Appbar />
|
||||
<main>
|
||||
<Container>
|
||||
<Box>
|
||||
<CreateButton />
|
||||
</Box>
|
||||
<ListElement name="Weekend Warmup" competitors="16" date="29.04.2022" />
|
||||
<ListElement name="Saturday Showdown" competitors="8" date="30.04.2022"/>
|
||||
<ListElement name="Sunday Funday" competitors="64" date="01.05.2022" />
|
||||
</Container>
|
||||
<Container>
|
||||
<Box>
|
||||
<CreateButton />
|
||||
</Box>
|
||||
<ListElement
|
||||
name="Weekend Warmup"
|
||||
competitors="16"
|
||||
date="29.04.2022"
|
||||
/>
|
||||
<ListElement
|
||||
name="Saturday Showdown"
|
||||
competitors="8"
|
||||
date="30.04.2022"
|
||||
/>
|
||||
<ListElement
|
||||
name="Sunday Funday"
|
||||
competitors="64"
|
||||
date="01.05.2022"
|
||||
/>
|
||||
<TournamentList />
|
||||
</Container>
|
||||
</main>
|
||||
<footer className="footer">
|
||||
|
||||
</footer>
|
||||
<footer className="footer"></footer>
|
||||
</React.StrictMode>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
<button
|
||||
id="createInvLink"
|
||||
onClick={() => {
|
||||
return <div>Hei</div>;
|
||||
}}
|
||||
>
|
||||
Create Invite Link
|
||||
<button id="createInvLink" onClick={event}>
|
||||
Copy Invite Link
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
//navigator.clipboard.writeText("discord.gg/asura")
|
||||
export default function TournamentManager() {
|
||||
return (
|
||||
<React.Fragment>
|
||||
|
@ -59,6 +65,7 @@ export default function TournamentManager() {
|
|||
<AnnounceButton />
|
||||
<InviteButton />
|
||||
<SaveButton />
|
||||
<AlertContainer floatingTime={5000} />
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue