From cff3e7f9a22f340f378ced3b0d37eec510cbfde9 Mon Sep 17 00:00:00 2001 From: bmodee <bjomo323@student.liu.se> Date: Thu, 6 May 2021 15:20:49 +0200 Subject: [PATCH] docs: Add comments --- client/src/pages/views/OperatorViewPage.tsx | 25 ------------------- client/src/reducers/citiesReducer.ts | 3 +++ .../src/reducers/competitionLoginReducer.ts | 5 +++- client/src/reducers/competitionsReducer.ts | 1 + client/src/reducers/mediaReducer.ts | 2 ++ client/src/reducers/presentationReducer.ts | 4 ++- client/src/reducers/rolesReducer.ts | 3 +++ client/src/reducers/searchUserReducer.ts | 2 ++ client/src/reducers/statisticsReducer.ts | 2 ++ client/src/reducers/typesReducer.ts | 2 ++ client/src/reducers/uiReducer.ts | 3 +++ client/src/reducers/userReducer.ts | 3 +++ 12 files changed, 28 insertions(+), 27 deletions(-) diff --git a/client/src/pages/views/OperatorViewPage.tsx b/client/src/pages/views/OperatorViewPage.tsx index a2979945..36aa64d2 100644 --- a/client/src/pages/views/OperatorViewPage.tsx +++ b/client/src/pages/views/OperatorViewPage.tsx @@ -305,31 +305,6 @@ const OperatorViewPage: React.FC = () => { </OperatorButton> </Tooltip> - {/* - // Manual start button - <Tooltip title="Start Presentation" arrow> - <OperatorButton onClick={startCompetition} variant="contained"> - start - </OperatorButton> - </Tooltip> - - - // This creates a join button, but Operator should not join others, others should join Operator - <Tooltip title="Join Presentation" arrow> - <OperatorButton onClick={socketJoinPresentation} variant="contained"> - <GroupAddIcon fontSize="large" /> - </OperatorButton> - </Tooltip> - - - // This creates another end button, it might not be needed since we already have one - <Tooltip title="End Presentation" arrow> - <OperatorButton onClick={socketEndPresentation} variant="contained"> - <CancelIcon fontSize="large" /> - </OperatorButton> - </Tooltip> - */} - <Tooltip title="Starta Timer" arrow> <OperatorButton onClick={socketStartTimer} variant="contained"> <TimerIcon fontSize="large" /> diff --git a/client/src/reducers/citiesReducer.ts b/client/src/reducers/citiesReducer.ts index 7f5555b3..4fbc5a1c 100644 --- a/client/src/reducers/citiesReducer.ts +++ b/client/src/reducers/citiesReducer.ts @@ -2,11 +2,14 @@ import { AnyAction } from 'redux' import Types from '../actions/types' import { City } from '../interfaces/ApiModels' +// Define a type for the city state interface CityState { cities: City[] total: number count: number } + +// Define initial values for the city state const initialState: CityState = { cities: [], total: 0, diff --git a/client/src/reducers/competitionLoginReducer.ts b/client/src/reducers/competitionLoginReducer.ts index 72e5e22e..d06f8e30 100644 --- a/client/src/reducers/competitionLoginReducer.ts +++ b/client/src/reducers/competitionLoginReducer.ts @@ -1,16 +1,18 @@ import { AnyAction } from 'redux' import Types from '../actions/types' +// Define a type for the competition login data interface CompetitionLoginData { competition_id: number team_id: number | null view: string } - +// Define a type for UI error interface UIError { message: string } +// Define a type for the competition login state interface CompetitionLoginState { loading: boolean errors: null | UIError @@ -19,6 +21,7 @@ interface CompetitionLoginState { initialized: boolean } +// Define the initial values for the competition login state const initialState: CompetitionLoginState = { loading: false, errors: null, diff --git a/client/src/reducers/competitionsReducer.ts b/client/src/reducers/competitionsReducer.ts index bb788da5..8a99b29b 100644 --- a/client/src/reducers/competitionsReducer.ts +++ b/client/src/reducers/competitionsReducer.ts @@ -10,6 +10,7 @@ interface CompetitionState { filterParams: CompetitionFilterParams } +// Define the initial values for the competition state const initialState: CompetitionState = { competitions: [], total: 0, diff --git a/client/src/reducers/mediaReducer.ts b/client/src/reducers/mediaReducer.ts index ad5f3b46..1d6f4ce5 100644 --- a/client/src/reducers/mediaReducer.ts +++ b/client/src/reducers/mediaReducer.ts @@ -7,6 +7,8 @@ interface MediaState { mediatype_id: number user_id: number } + +// Define the initial values for the media state const initialState: MediaState = { id: 0, filename: '', diff --git a/client/src/reducers/presentationReducer.ts b/client/src/reducers/presentationReducer.ts index b0c4791e..578b0a27 100644 --- a/client/src/reducers/presentationReducer.ts +++ b/client/src/reducers/presentationReducer.ts @@ -1,9 +1,10 @@ import { AnyAction } from 'redux' import Types from '../actions/types' -import { Slide, Team } from '../interfaces/ApiModels' +import { Slide } from '../interfaces/ApiModels' import { Timer } from '../interfaces/Timer' import { RichCompetition } from './../interfaces/ApiRichModels' +// Define a type for the presentation state interface PresentationState { competition: RichCompetition slide: Slide @@ -11,6 +12,7 @@ interface PresentationState { timer: Timer } +// Define the initial values for the presentation state const initialState: PresentationState = { competition: { name: '', diff --git a/client/src/reducers/rolesReducer.ts b/client/src/reducers/rolesReducer.ts index 5028ae04..8fc1465a 100644 --- a/client/src/reducers/rolesReducer.ts +++ b/client/src/reducers/rolesReducer.ts @@ -2,9 +2,12 @@ import { AnyAction } from 'redux' import Types from '../actions/types' import { Role } from '../interfaces/ApiModels' +// Define a type for the role state interface RoleState { roles: Role[] } + +// Define the initial values for the role state const initialState: RoleState = { roles: [], } diff --git a/client/src/reducers/searchUserReducer.ts b/client/src/reducers/searchUserReducer.ts index e0c12506..38269dfb 100644 --- a/client/src/reducers/searchUserReducer.ts +++ b/client/src/reducers/searchUserReducer.ts @@ -3,6 +3,7 @@ import Types from '../actions/types' import { User } from '../interfaces/ApiModels' import { UserFilterParams } from '../interfaces/FilterParams' +// Define a type for the search user state interface SearchUserState { users: User[] total: number @@ -10,6 +11,7 @@ interface SearchUserState { filterParams: UserFilterParams } +// Define the initial values for the search user state const initialState: SearchUserState = { users: [], total: 0, diff --git a/client/src/reducers/statisticsReducer.ts b/client/src/reducers/statisticsReducer.ts index 78a06e11..bc957ccb 100644 --- a/client/src/reducers/statisticsReducer.ts +++ b/client/src/reducers/statisticsReducer.ts @@ -1,12 +1,14 @@ import { AnyAction } from 'redux' import Types from '../actions/types' +// Define a type for the statistics state interface StatisticsState { users: number competitions: number regions: number } +// Define the initial values for the statistics state const initialState: StatisticsState = { users: 0, competitions: 0, diff --git a/client/src/reducers/typesReducer.ts b/client/src/reducers/typesReducer.ts index 3540ef86..10ea1c63 100644 --- a/client/src/reducers/typesReducer.ts +++ b/client/src/reducers/typesReducer.ts @@ -2,12 +2,14 @@ import { AnyAction } from 'redux' import Types from '../actions/types' import { ComponentType, MediaType, QuestionType, ViewType } from '../interfaces/ApiModels' +// Define a type for the Types state interface TypesState { componentTypes: ComponentType[] viewTypes: ViewType[] questionTypes: QuestionType[] mediaTypes: MediaType[] } +// Define the initial values for the types state const initialState: TypesState = { componentTypes: [], viewTypes: [], diff --git a/client/src/reducers/uiReducer.ts b/client/src/reducers/uiReducer.ts index 4d06d1e2..350f7b8e 100644 --- a/client/src/reducers/uiReducer.ts +++ b/client/src/reducers/uiReducer.ts @@ -1,15 +1,18 @@ import { AnyAction } from 'redux' import Types from '../actions/types' +// Define a type for the UI error interface UIError { message: string } +// Define a type for the UI state interface UIState { loading: boolean errors: null | UIError } +// Define the initial values for the UI state const initialState: UIState = { loading: false, errors: null, diff --git a/client/src/reducers/userReducer.ts b/client/src/reducers/userReducer.ts index 91c056d3..6b4f985b 100644 --- a/client/src/reducers/userReducer.ts +++ b/client/src/reducers/userReducer.ts @@ -1,6 +1,7 @@ import { AnyAction } from 'redux' import Types from '../actions/types' +// Define a type for users info interface UserInfo { name: string email: string @@ -9,12 +10,14 @@ interface UserInfo { id: number } +// Define a type for the users state interface UserState { authenticated: boolean userInfo: UserInfo | null loading: boolean } +// Define the initial values for the users state const initialState: UserState = { authenticated: false, loading: false, -- GitLab