Skip to content
Snippets Groups Projects
Commit d34e1a73 authored by Björn Modée's avatar Björn Modée
Browse files

add comments

parent 9ea369c4
No related branches found
No related tags found
No related merge requests found
Pipeline #44346 passed with warnings
......@@ -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
......
......@@ -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 (
......
......@@ -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)
......
......@@ -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()
......
......@@ -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()
......
......@@ -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({
......
......@@ -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: {
......
/** 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({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment