diff --git a/client/src/pages/admin/competitions/CompetitionManager.tsx b/client/src/pages/admin/competitions/CompetitionManager.tsx index affd5c26c192025afb800314a9ce1728c9d31935..7de930dceab457d43e6552bc5db2465a10a9bddd 100644 --- a/client/src/pages/admin/competitions/CompetitionManager.tsx +++ b/client/src/pages/admin/competitions/CompetitionManager.tsx @@ -131,6 +131,7 @@ const CompetitionManager: React.FC = (props: any) => { } } + /** Start the competition by redirecting with URL with Code */ const handleStartCompetition = () => { const operatorCode = codes.find((code) => code.view_type_id === 4)?.code if (operatorCode) { @@ -138,6 +139,7 @@ const CompetitionManager: React.FC = (props: any) => { } } + /** Fetch all the connection codes from the server */ const getCodes = async (id: number) => { await axios .get(`/api/competitions/${id}/codes`) @@ -147,6 +149,7 @@ const CompetitionManager: React.FC = (props: any) => { .catch(console.log) } + /** Fetch all the teams from the server that is connected to a specific competition*/ const getTeams = async (id: number) => { await axios .get(`/api/competitions/${id}/teams`) @@ -159,6 +162,7 @@ const CompetitionManager: React.FC = (props: any) => { }) } + /** Fetch the copetition name from the server */ const getCompetitionName = async () => { await axios .get(`/api/competitions/${activeId}`) @@ -198,16 +202,18 @@ const CompetitionManager: React.FC = (props: any) => { return typeName } + /** Handles the opening of the code dialog box */ const handleOpenDialog = async () => { await getCompetitionName() setDialogIsOpen(true) } - + /** Handles the closing of the code dialog box */ const handleCloseDialog = () => { setDialogIsOpen(false) setAnchorEl(null) } + /** Function that copies an existing competition */ const handleDuplicateCompetition = async () => { if (activeId) { await axios diff --git a/client/src/pages/admin/dashboard/components/CurrentUser.tsx b/client/src/pages/admin/dashboard/components/CurrentUser.tsx index 0dfdf557bff55224f513fb742ba59bdc8c8b1f56..1d6afe732935bb3094ae1068179c7dc6ea58fb17 100644 --- a/client/src/pages/admin/dashboard/components/CurrentUser.tsx +++ b/client/src/pages/admin/dashboard/components/CurrentUser.tsx @@ -2,6 +2,8 @@ import { Box, Typography } from '@material-ui/core' import React from 'react' import { useAppSelector } from '../../../../hooks' +/** This component show information about the currently logged in user */ + const CurrentUser: React.FC = () => { const currentUser = useAppSelector((state: { user: { userInfo: any } }) => state.user.userInfo) return ( diff --git a/client/src/pages/admin/dashboard/components/NumberOfCompetitions.tsx b/client/src/pages/admin/dashboard/components/NumberOfCompetitions.tsx index eb667ebd690f6013c184ac13e2038ce1a7726de9..1ebe9dfba3e888e9bf07b998cff321613ba035d3 100644 --- a/client/src/pages/admin/dashboard/components/NumberOfCompetitions.tsx +++ b/client/src/pages/admin/dashboard/components/NumberOfCompetitions.tsx @@ -2,6 +2,8 @@ import { Box, Typography } from '@material-ui/core' import React from 'react' import { useAppSelector } from '../../../../hooks' +/** Shows how many competitions is on the system */ + const NumberOfCompetitions: React.FC = () => { const competitions = useAppSelector((state) => state.statistics.competitions) diff --git a/client/src/pages/admin/dashboard/components/NumberOfRegions.tsx b/client/src/pages/admin/dashboard/components/NumberOfRegions.tsx index f3195f4c18969ed2ad1e4b185b2125ac2c15f782..5f9ecef5e60ff4fda27d6a42771c043b83e9dc8e 100644 --- a/client/src/pages/admin/dashboard/components/NumberOfRegions.tsx +++ b/client/src/pages/admin/dashboard/components/NumberOfRegions.tsx @@ -3,6 +3,8 @@ import React, { useEffect } from 'react' import { getCities } from '../../../../actions/cities' import { useAppDispatch, useAppSelector } from '../../../../hooks' +/** Shows how many regions is on the system */ + const NumberOfRegions: React.FC = () => { const regions = useAppSelector((state) => state.statistics.regions) const dispatch = useAppDispatch() diff --git a/client/src/pages/admin/dashboard/components/NumberOfUsers.tsx b/client/src/pages/admin/dashboard/components/NumberOfUsers.tsx index 0e75cf1b1069814801fadc010f30ac393dfe3b25..91291e689529c8c65a54ed63c7ae77ce489ebe2f 100644 --- a/client/src/pages/admin/dashboard/components/NumberOfUsers.tsx +++ b/client/src/pages/admin/dashboard/components/NumberOfUsers.tsx @@ -3,6 +3,8 @@ import React, { useEffect } from 'react' import { getSearchUsers } from '../../../../actions/searchUser' import { useAppDispatch, useAppSelector } from '../../../../hooks' +/** Shows how many users are on the system */ + const NumberOfUsers: React.FC = () => { const usersTotal = useAppSelector((state) => state.statistics.users) const dispatch = useAppDispatch() diff --git a/client/src/pages/admin/regions/AddRegion.tsx b/client/src/pages/admin/regions/AddRegion.tsx index b00961384f73246365e60023af04ed7567adf311..8bd5e562d2006962f5366722a207efe23c9cff55 100644 --- a/client/src/pages/admin/regions/AddRegion.tsx +++ b/client/src/pages/admin/regions/AddRegion.tsx @@ -30,6 +30,7 @@ const useStyles = makeStyles((theme: Theme) => type formType = FormModel<AddCityModel> +/** add a region form with some constraints. */ const schema: Yup.SchemaOf<formType> = Yup.object({ model: Yup.object() .shape({ diff --git a/client/src/pages/admin/regions/Regions.tsx b/client/src/pages/admin/regions/Regions.tsx index 436da6f69429ca6711452d7babf477f8da593eee..28a25cadf2cdc5785deb3c7de35f10dc45683939 100644 --- a/client/src/pages/admin/regions/Regions.tsx +++ b/client/src/pages/admin/regions/Regions.tsx @@ -14,6 +14,9 @@ import { getCities } from '../../../actions/cities' import { useAppDispatch, useAppSelector } from '../../../hooks' import { RemoveMenuItem, TopBar } from '../styledComp' import AddRegion from './AddRegion' + +/** shows all the regions in a list */ + const useStyles = makeStyles((theme: Theme) => createStyles({ table: { diff --git a/client/src/pages/admin/users/AddUser.tsx b/client/src/pages/admin/users/AddUser.tsx index 9f1511eac460c661ebd35dc995f6606e66080359..d24bf130785110cb1dd039dde7dbab57107a4e9d 100644 --- a/client/src/pages/admin/users/AddUser.tsx +++ b/client/src/pages/admin/users/AddUser.tsx @@ -1,3 +1,5 @@ +/** Add a user component */ + import { Button, FormControl, InputLabel, MenuItem, Popover, TextField } from '@material-ui/core' import PersonAddIcon from '@material-ui/icons/PersonAdd' import { Alert, AlertTitle } from '@material-ui/lab' @@ -16,6 +18,7 @@ type formType = FormModel<AddUserModel> const noRoleSelected = 'Välj roll' const noCitySelected = 'Välj stad' +/** Form when adding a user with some constraints */ const userSchema: Yup.SchemaOf<formType> = Yup.object({ model: Yup.object() .shape({