From d790ed3df72b902e4db0aba3f768453ee18156c7 Mon Sep 17 00:00:00 2001 From: Kristoffer Juelsen Date: Wed, 6 Apr 2022 17:03:32 +0200 Subject: [PATCH] Added temp date pickers, we love fns --- src/client/package-lock.json | 21 ++++++++++++- src/client/package.json | 4 ++- src/client/src/TournamentCreator.js | 48 +++++++++++++++++------------ 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/src/client/package-lock.json b/src/client/package-lock.json index cb2ea97..dd036ab 100644 --- a/src/client/package-lock.json +++ b/src/client/package-lock.json @@ -8,13 +8,15 @@ "name": "tournament-server", "version": "1.0.0", "dependencies": { + "@date-io/date-fns": "^2.11.0", "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", "@mui/icons-material": "^5.5.1", - "@mui/lab": "^5.0.0-alpha.76", + "@mui/lab": "^5.0.0-alpha.61", "@mui/material": "^5.5.2", "@mui/styled-engine-sc": "^5.5.2", "bootstrap": "^5.1.3", + "date-fns": "^2.27.0", "iarn": "0.0.0", "less": "^4.1.2", "react": "^17.0.2", @@ -5574,6 +5576,18 @@ "node": ">=10" } }, + "node_modules/date-fns": { + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz", + "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==", + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/debug": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", @@ -19441,6 +19455,11 @@ "whatwg-url": "^8.0.0" } }, + "date-fns": { + "version": "2.28.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz", + "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==" + }, "debug": { "version": "4.3.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", diff --git a/src/client/package.json b/src/client/package.json index b260227..50d75ec 100644 --- a/src/client/package.json +++ b/src/client/package.json @@ -6,13 +6,15 @@ "private": true, "homepage": "", "dependencies": { + "@date-io/date-fns": "^2.11.0", "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", "@mui/icons-material": "^5.5.1", - "@mui/lab": "^5.0.0-alpha.76", + "@mui/lab": "^5.0.0-alpha.61", "@mui/material": "^5.5.2", "@mui/styled-engine-sc": "^5.5.2", "bootstrap": "^5.1.3", + "date-fns": "^2.27.0", "iarn": "0.0.0", "less": "^4.1.2", "react": "^17.0.2", diff --git a/src/client/src/TournamentCreator.js b/src/client/src/TournamentCreator.js index 8f585d6..791d25f 100644 --- a/src/client/src/TournamentCreator.js +++ b/src/client/src/TournamentCreator.js @@ -5,6 +5,9 @@ import ErrorSnackbar from "./components/ErrorSnackbar"; import { Button, TextField, Stack, InputLabel, Select, Container, Slider, Paper, Box, Grid, Typography } from '@mui/material'; import FileUploadIcon from '@mui/icons-material/FileUpload'; +import DatePicker from '@mui/lab/DatePicker'; +import AdapterDateFns from '@mui/lab/AdapterDateFns'; +import LocalizationProvider from '@mui/lab/LocalizationProvider'; function postTournament(showError, tournamentName, tournamentDescription, tournamentStartDate, tournamentEndDate, tournamentMaxTeams) { if (!tournamentName || tournamentName === "") { @@ -98,6 +101,8 @@ function TournamentForm(props) { { value: 7, label: "128",} ]; + const [value, setValue] = React.useState([null, null]); + return ( <>
@@ -106,26 +111,31 @@ function TournamentForm(props) { {/* Description: - {/* - - - Edit Image: - - - - - - - - */} - - + + { + setValue(newValue); + }} + renderInput={(params) => } + /> + + + { + setValue(newValue); + }} + renderInput={(params) => } + /> + + {/* + */} Maximum number of teams