From cd3eac2caadfc6c60350abf672cc6a891dd3321b Mon Sep 17 00:00:00 2001
From: Albin Henriksson <albhe428@student.liu.se>
Date: Sun, 9 May 2021 20:10:29 +0000
Subject: [PATCH] Resolve "Comment misc redux files"

---
 client/src/actions/cities.ts                  |  4 +--
 client/src/actions/competitionLogin.ts        |  4 +--
 client/src/actions/competitions.ts            |  6 ++--
 client/src/actions/editor.ts                  |  8 ++---
 client/src/actions/presentation.ts            | 12 +++++--
 client/src/actions/roles.ts                   |  4 +--
 client/src/actions/searchUser.ts              |  5 +--
 client/src/actions/statistics.ts              |  4 +--
 client/src/actions/types.ts                   | 34 +++++++++++++++----
 client/src/actions/typesAction.ts             |  4 +--
 client/src/actions/user.ts                    |  8 ++---
 client/src/hooks.ts                           |  4 +++
 client/src/reducers/allReducers.ts            |  4 +--
 client/src/reducers/citiesReducer.ts          |  5 +--
 .../src/reducers/competitionLoginReducer.ts   |  9 ++---
 client/src/reducers/competitionsReducer.ts    |  4 ++-
 client/src/reducers/editorReducer.ts          |  3 ++
 client/src/reducers/presentationReducer.ts    |  5 +--
 client/src/reducers/rolesReducer.ts           |  5 +--
 client/src/reducers/searchUserReducer.ts      |  5 +--
 client/src/reducers/statisticsReducer.ts      |  5 +--
 client/src/reducers/typesReducer.ts           |  5 +--
 client/src/reducers/uiReducer.ts              |  7 ++--
 client/src/reducers/userReducer.ts            |  7 ++--
 client/src/store.ts                           |  7 ++--
 25 files changed, 108 insertions(+), 60 deletions(-)

diff --git a/client/src/actions/cities.ts b/client/src/actions/cities.ts
index efdb8c1d..59f8be98 100644
--- a/client/src/actions/cities.ts
+++ b/client/src/actions/cities.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the cities redux state
 */
 
@@ -6,7 +6,7 @@ import axios from 'axios'
 import { AppDispatch } from './../store'
 import Types from './types'
 
-// Action creator to get all cities from api and send appropriate actions to reducer
+/**  Action creator to get all cities from api and send appropriate actions to reducer */
 export const getCities = () => async (dispatch: AppDispatch) => {
   await axios
     .get('/api/misc/cities')
diff --git a/client/src/actions/competitionLogin.ts b/client/src/actions/competitionLogin.ts
index 97dc76e4..d9f28333 100644
--- a/client/src/actions/competitionLogin.ts
+++ b/client/src/actions/competitionLogin.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the competitionLogin redux state
 */
 
@@ -8,7 +8,7 @@ import { AppDispatch, RootState } from '../store'
 import { getPresentationCompetition } from './presentation'
 import Types from './types'
 
-// Action creator to attempt to login with competition code
+/** Action creator to attempt to login with competition code */
 export const loginCompetition = (code: string, history: History, redirect: boolean) => async (
   dispatch: AppDispatch,
   getState: () => RootState
diff --git a/client/src/actions/competitions.ts b/client/src/actions/competitions.ts
index 87b2b26b..bae48138 100644
--- a/client/src/actions/competitions.ts
+++ b/client/src/actions/competitions.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the competitions redux state
 */
 
@@ -7,7 +7,7 @@ import { CompetitionFilterParams } from '../interfaces/FilterParams'
 import { AppDispatch, RootState } from './../store'
 import Types from './types'
 
-// Get all competitions using filterParams from current state
+/** Get all competitions using filterParams from current state */
 export const getCompetitions = () => async (dispatch: AppDispatch, getState: () => RootState) => {
   const currentParams: CompetitionFilterParams = getState().competitions.filterParams
   // Send params in snake-case for api
@@ -40,7 +40,7 @@ export const getCompetitions = () => async (dispatch: AppDispatch, getState: ()
     })
 }
 
-// Dispatch action to set filter params
+/** Dispatch action to set filter params */
 export const setFilterParams = (params: CompetitionFilterParams) => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_COMPETITIONS_FILTER_PARAMS, payload: params })
 }
diff --git a/client/src/actions/editor.ts b/client/src/actions/editor.ts
index 526ad9ff..aaee21a8 100644
--- a/client/src/actions/editor.ts
+++ b/client/src/actions/editor.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the editor redux state
 */
 
@@ -6,7 +6,7 @@ import axios from 'axios'
 import { AppDispatch, RootState } from './../store'
 import Types from './types'
 
-// Save competition in editor state from input id
+/** Save competition in editor state from input id */
 export const getEditorCompetition = (id: string) => async (dispatch: AppDispatch, getState: () => RootState) => {
   await axios
     .get(`/api/competitions/${id}`)
@@ -28,7 +28,7 @@ export const getEditorCompetition = (id: string) => async (dispatch: AppDispatch
     })
 }
 
-// Set activeSlideId in editor state
+/** Set activeSlideId in editor state */
 export const setEditorSlideId = (id: number) => (dispatch: AppDispatch) => {
   dispatch({
     type: Types.SET_EDITOR_SLIDE_ID,
@@ -36,7 +36,7 @@ export const setEditorSlideId = (id: number) => (dispatch: AppDispatch) => {
   })
 }
 
-// Set activeViewTypeId in editor state
+/** Set activeViewTypeId in editor state */
 export const setEditorViewId = (id: number) => (dispatch: AppDispatch) => {
   dispatch({
     type: Types.SET_EDITOR_VIEW_ID,
diff --git a/client/src/actions/presentation.ts b/client/src/actions/presentation.ts
index 32e4d0a4..07536b21 100644
--- a/client/src/actions/presentation.ts
+++ b/client/src/actions/presentation.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the presentation redux state
 */
 
@@ -8,7 +8,7 @@ import { Timer } from '../interfaces/Timer'
 import store, { AppDispatch, RootState } from './../store'
 import Types from './types'
 
-// Save competition in presentation state from input id
+/** Save competition in presentation state from input id */
 export const getPresentationCompetition = (id: string) => async (dispatch: AppDispatch, getState: () => RootState) => {
   await axios
     .get(`/api/competitions/${id}`)
@@ -26,30 +26,36 @@ export const getPresentationCompetition = (id: string) => async (dispatch: AppDi
     })
 }
 
+/** Set presentation slide using input slide id */
 export const setCurrentSlide = (slide: Slide) => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_PRESENTATION_SLIDE, payload: slide })
 }
 
+/** Set presentation slide to previous slide in list */
 export const setCurrentSlidePrevious = () => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_PRESENTATION_SLIDE_PREVIOUS })
 }
 
+/** Set presentation slide to next slide in list */
 export const setCurrentSlideNext = () => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_PRESENTATION_SLIDE_NEXT })
 }
 
+/** Set presentation slide using input order */
 export const setCurrentSlideByOrder = (order: number) => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_PRESENTATION_SLIDE_BY_ORDER, payload: order })
 }
 
+/** Set code of presentation */
 export const setPresentationCode = (code: string) => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_PRESENTATION_CODE, payload: code })
 }
-
+/** Set timer to input value */
 export const setPresentationTimer = (timer: Timer) => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_PRESENTATION_TIMER, payload: timer })
 }
 
+/** Decrement timer */
 export const setPresentationTimerDecrement = () => (dispatch: AppDispatch) => {
   dispatch({
     type: Types.SET_PRESENTATION_TIMER,
diff --git a/client/src/actions/roles.ts b/client/src/actions/roles.ts
index 3f27d3a8..68b86b30 100644
--- a/client/src/actions/roles.ts
+++ b/client/src/actions/roles.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the roles redux state
 */
 
@@ -6,7 +6,7 @@ import axios from 'axios'
 import { AppDispatch } from './../store'
 import Types from './types'
 
-// Get all roles and dispatch action to save them to roles state
+/** Get all roles and dispatch action to save them to roles state */
 export const getRoles = () => async (dispatch: AppDispatch) => {
   await axios
     .get('/api/misc/roles')
diff --git a/client/src/actions/searchUser.ts b/client/src/actions/searchUser.ts
index c47ee9f3..d47d4dd0 100644
--- a/client/src/actions/searchUser.ts
+++ b/client/src/actions/searchUser.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the searchUser redux state
 */
 
@@ -7,7 +7,7 @@ import { UserFilterParams } from '../interfaces/FilterParams'
 import { AppDispatch, RootState } from './../store'
 import Types from './types'
 
-// Get all users using current filterParams in searchUser state
+/** Get all users using current filterParams in searchUser state */
 export const getSearchUsers = () => async (dispatch: AppDispatch, getState: () => RootState) => {
   const currentParams: UserFilterParams = getState().searchUsers.filterParams
   // Send params in snake-case for api
@@ -40,6 +40,7 @@ export const getSearchUsers = () => async (dispatch: AppDispatch, getState: () =
     })
 }
 
+/** Set filterParams in searchUser state */
 export const setFilterParams = (params: UserFilterParams) => (dispatch: AppDispatch) => {
   dispatch({ type: Types.SET_SEARCH_USERS_FILTER_PARAMS, payload: params })
 }
diff --git a/client/src/actions/statistics.ts b/client/src/actions/statistics.ts
index acde4316..304099b2 100644
--- a/client/src/actions/statistics.ts
+++ b/client/src/actions/statistics.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the statistics redux state
 */
 
@@ -6,7 +6,7 @@ import axios from 'axios'
 import { AppDispatch } from './../store'
 import Types from './types'
 
-// Get all statistics and dispatch actions to save them to statistics state
+/**  Get all statistics and dispatch actions to save them to statistics state */
 export const getStatistics = () => async (dispatch: AppDispatch) => {
   await axios
     .get('/api/misc/statistics')
diff --git a/client/src/actions/types.ts b/client/src/actions/types.ts
index 0ca8a02f..c73179c1 100644
--- a/client/src/actions/types.ts
+++ b/client/src/actions/types.ts
@@ -1,32 +1,44 @@
-/*
-This file includes all redux action types 
+/**
+This file includes all redux action action types 
 */
 
+/** Includes all actions types */
 export default {
+  // User login action types
   LOADING_UI: 'LOADING_UI',
   LOADING_USER: 'LOADING_USER',
-  LOADING_COMPETITION_LOGIN: 'LOADING_COMPETITION_LOGIN',
+  SET_ERRORS: 'SET_ERRORS',
+  CLEAR_ERRORS: 'CLEAR_ERRORS',
   SET_ROLES: 'SET_ROLES',
   SET_USER: 'SET_USER',
+  SET_UNAUTHENTICATED: 'SET_UNAUTHENTICATED',
+  SET_AUTHENTICATED: 'SET_AUTHENTICATED',
+
+  // Search user action types
   SET_SEARCH_USERS: 'SET_SEARCH_USERS',
   SET_SEARCH_USERS_FILTER_PARAMS: 'SET_SEARCH_USERS_FILTER_PARAMS',
   SET_SEARCH_USERS_COUNT: 'SET_SEARCH_USERS_COUNT',
   SET_SEARCH_USERS_TOTAL_COUNT: 'SET_SEARCH_USERS_TOTAL_COUNT',
-  SET_ERRORS: 'SET_ERRORS',
-  CLEAR_ERRORS: 'CLEAR_ERRORS',
+
+  // Competition login action types
+  LOADING_COMPETITION_LOGIN: 'LOADING_COMPETITION_LOGIN',
   SET_COMPETITION_LOGIN_DATA: 'SET_COMPETITION_LOGIN_DATA',
   SET_COMPETITION_LOGIN_UNAUTHENTICATED: 'SET_COMPETITION_LOGIN_UNAUTHENTICATED',
   SET_COMPETITION_LOGIN_ERRORS: 'SET_COMPETITION_LOGIN_ERRORS',
   CLEAR_COMPETITION_LOGIN_ERRORS: 'CLEAR_COMPETITION_LOGIN_ERRORS',
-  SET_UNAUTHENTICATED: 'SET_UNAUTHENTICATED',
-  SET_AUTHENTICATED: 'SET_AUTHENTICATED',
+
+  // Competitions action types
   SET_COMPETITIONS: 'SET_COMPETITIONS',
   SET_COMPETITIONS_FILTER_PARAMS: 'SET_COMPETITIONS_FILTER_PARAMS',
   SET_COMPETITIONS_TOTAL: 'SET_COMPETITIONS_TOTAL',
   SET_COMPETITIONS_COUNT: 'SET_COMPETITIONS_COUNT',
+
+  // Editor action types
   SET_EDITOR_COMPETITION: 'SET_EDITOR_COMPETITION',
   SET_EDITOR_SLIDE_ID: 'SET_EDITOR_SLIDE_ID',
   SET_EDITOR_VIEW_ID: 'SET_EDITOR_VIEW_ID',
+
+  // Presentation action types
   SET_PRESENTATION_COMPETITION: 'SET_PRESENTATION_COMPETITION',
   SET_PRESENTATION_SLIDE: 'SET_PRESENTATION_SLIDE',
   SET_PRESENTATION_SLIDE_PREVIOUS: 'SET_PRESENTATION_SLIDE_PREVIOUS',
@@ -34,13 +46,21 @@ export default {
   SET_PRESENTATION_SLIDE_BY_ORDER: 'SET_PRESENTATION_SLIDE_BY_ORDER',
   SET_PRESENTATION_CODE: 'SET_PRESENTATION_CODE',
   SET_PRESENTATION_TIMER: 'SET_PRESENTATION_TIMER',
+
+  // Cities action types
   SET_CITIES: 'SET_CITIES',
   SET_CITIES_TOTAL: 'SET_CITIES_TOTAL',
   SET_CITIES_COUNT: 'SET_CITIES_COUNT',
+
+  // Types action types
   SET_TYPES: 'SET_TYPES',
+
+  // Media action types
   SET_MEDIA_ID: 'SET_MEDIA_ID',
   SET_MEDIA_FILENAME: 'SET_MEDIA_ID',
   SET_MEDIA_TYPE_ID: 'SET_MEDIA_TYPE_ID',
   SET_MEDIA_USER_ID: 'SET_MEDIA_USER_ID',
+
+  // Statistics action types
   SET_STATISTICS: 'SET_STATISTICS',
 }
diff --git a/client/src/actions/typesAction.ts b/client/src/actions/typesAction.ts
index b6e9c98a..06519257 100644
--- a/client/src/actions/typesAction.ts
+++ b/client/src/actions/typesAction.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the types redux state
 */
 
@@ -6,7 +6,7 @@ import axios from 'axios'
 import { AppDispatch } from './../store'
 import Types from './types'
 
-// Get all types and save them to types state
+/** Get all types and save them to types state */
 export const getTypes = () => async (dispatch: AppDispatch) => {
   await axios
     .get('/api/misc/types')
diff --git a/client/src/actions/user.ts b/client/src/actions/user.ts
index 3448fa99..a94730fa 100644
--- a/client/src/actions/user.ts
+++ b/client/src/actions/user.ts
@@ -1,4 +1,4 @@
-/*
+/**
 This file handles actions for the user redux state
 */
 
@@ -8,7 +8,7 @@ import { AppDispatch } from '../store'
 import { AccountLoginModel } from './../interfaces/FormModels'
 import Types from './types'
 
-// Attempt to log in user, dispatch correct actions and save jwt token to localStorage and axios auth header
+/** Attempt to log in user, dispatch correct actions and save jwt token to localStorage and axios auth header */
 export const loginUser = (userData: AccountLoginModel, history: History) => async (dispatch: AppDispatch) => {
   dispatch({ type: Types.LOADING_UI })
   await axios
@@ -30,7 +30,7 @@ export const loginUser = (userData: AccountLoginModel, history: History) => asyn
     })
 }
 
-// Get data for user and save to user state
+/** Get data for user and save to user state */
 export const getUserData = () => async (dispatch: AppDispatch) => {
   dispatch({ type: Types.LOADING_USER })
   await axios
@@ -46,7 +46,7 @@ export const getUserData = () => async (dispatch: AppDispatch) => {
     })
 }
 
-// Log out user and remove jwt token from local storage and axios
+/** Log out user and remove jwt token from local storage and axios */
 export const logoutUser = () => async (dispatch: AppDispatch) => {
   localStorage.removeItem('token')
   await axios.post('/api/auth/logout').then(() => {
diff --git a/client/src/hooks.ts b/client/src/hooks.ts
index 597f2813..914e9aa8 100644
--- a/client/src/hooks.ts
+++ b/client/src/hooks.ts
@@ -1,5 +1,9 @@
+/** This file includes typed versions of redux hooks */
+
 import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'
 import type { AppDispatch, RootState } from './store'
 
+/** Typed version of useDispatch, this should be used every single time instead of useDispatch  */
 export const useAppDispatch = () => useDispatch<AppDispatch>()
+/** Typed version of useSelector, this should be used every single time instead of useSelector  */
 export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector
diff --git a/client/src/reducers/allReducers.ts b/client/src/reducers/allReducers.ts
index 038b172e..29b8d2c4 100644
--- a/client/src/reducers/allReducers.ts
+++ b/client/src/reducers/allReducers.ts
@@ -1,4 +1,4 @@
-// Combines all the reducers so that we only have to pass "one" reducer to the store in src/index.tsx
+/** Combines all the reducers so that we only have to pass "one" reducer to the store in src/index.tsx */
 
 import { combineReducers } from 'redux'
 import citiesReducer from './citiesReducer'
@@ -13,8 +13,8 @@ import typesReducer from './typesReducer'
 import uiReducer from './uiReducer'
 import userReducer from './userReducer'
 
+/** All reducers combined */
 const allReducers = combineReducers({
-  // name: state
   user: userReducer,
   UI: uiReducer,
   competitions: competitionsReducer,
diff --git a/client/src/reducers/citiesReducer.ts b/client/src/reducers/citiesReducer.ts
index 4fbc5a1c..22cf54f8 100644
--- a/client/src/reducers/citiesReducer.ts
+++ b/client/src/reducers/citiesReducer.ts
@@ -2,20 +2,21 @@ import { AnyAction } from 'redux'
 import Types from '../actions/types'
 import { City } from '../interfaces/ApiModels'
 
-// Define a type for the city state
+/** Define a type for the city state */
 interface CityState {
   cities: City[]
   total: number
   count: number
 }
 
-// Define initial values for the city state
+/** Define initial values for the city state */
 const initialState: CityState = {
   cities: [],
   total: 0,
   count: 0,
 }
 
+/** Intercept actions for cities state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_CITIES:
diff --git a/client/src/reducers/competitionLoginReducer.ts b/client/src/reducers/competitionLoginReducer.ts
index d06f8e30..f3ca764c 100644
--- a/client/src/reducers/competitionLoginReducer.ts
+++ b/client/src/reducers/competitionLoginReducer.ts
@@ -1,18 +1,18 @@
 import { AnyAction } from 'redux'
 import Types from '../actions/types'
 
-// Define a type for the competition login data
+/** 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
+/** Define a type for UI error */
 interface UIError {
   message: string
 }
 
-// Define a type for the competition login state
+/** Define a type for the competition login state */
 interface CompetitionLoginState {
   loading: boolean
   errors: null | UIError
@@ -21,7 +21,7 @@ interface CompetitionLoginState {
   initialized: boolean
 }
 
-// Define the initial values for the competition login state
+/** Define the initial values for the competition login state */
 const initialState: CompetitionLoginState = {
   loading: false,
   errors: null,
@@ -30,6 +30,7 @@ const initialState: CompetitionLoginState = {
   initialized: false,
 }
 
+/** Intercept actions for competitionLogin state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_COMPETITION_LOGIN_DATA:
diff --git a/client/src/reducers/competitionsReducer.ts b/client/src/reducers/competitionsReducer.ts
index 8a99b29b..62b7006e 100644
--- a/client/src/reducers/competitionsReducer.ts
+++ b/client/src/reducers/competitionsReducer.ts
@@ -3,6 +3,7 @@ import Types from '../actions/types'
 import { Competition } from '../interfaces/ApiModels'
 import { CompetitionFilterParams } from './../interfaces/FilterParams'
 
+/** Define a type for competitions state */
 interface CompetitionState {
   competitions: Competition[]
   total: number
@@ -10,7 +11,7 @@ interface CompetitionState {
   filterParams: CompetitionFilterParams
 }
 
-// Define the initial values for the competition state
+/** Define the initial values for the competition state */
 const initialState: CompetitionState = {
   competitions: [],
   total: 0,
@@ -18,6 +19,7 @@ const initialState: CompetitionState = {
   filterParams: { pageSize: 10, page: 0 },
 }
 
+/** Intercept actions for competitions state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_COMPETITIONS:
diff --git a/client/src/reducers/editorReducer.ts b/client/src/reducers/editorReducer.ts
index 4f245d1d..8aa14592 100644
--- a/client/src/reducers/editorReducer.ts
+++ b/client/src/reducers/editorReducer.ts
@@ -2,6 +2,7 @@ import { AnyAction } from 'redux'
 import Types from '../actions/types'
 import { RichCompetition } from '../interfaces/ApiRichModels'
 
+/** Define a type for editor state */
 interface EditorState {
   competition: RichCompetition
   activeSlideId: number
@@ -9,6 +10,7 @@ interface EditorState {
   loading: boolean
 }
 
+/** Define initial values for the editor state */
 const initialState: EditorState = {
   competition: {
     name: '',
@@ -24,6 +26,7 @@ const initialState: EditorState = {
   loading: true,
 }
 
+/** Intercept actions for editor state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_EDITOR_COMPETITION:
diff --git a/client/src/reducers/presentationReducer.ts b/client/src/reducers/presentationReducer.ts
index 578b0a27..374baf32 100644
--- a/client/src/reducers/presentationReducer.ts
+++ b/client/src/reducers/presentationReducer.ts
@@ -4,7 +4,7 @@ import { Slide } from '../interfaces/ApiModels'
 import { Timer } from '../interfaces/Timer'
 import { RichCompetition } from './../interfaces/ApiRichModels'
 
-// Define a type for the presentation state
+/** Define a type for the presentation state */
 interface PresentationState {
   competition: RichCompetition
   slide: Slide
@@ -12,7 +12,7 @@ interface PresentationState {
   timer: Timer
 }
 
-// Define the initial values for the presentation state
+/** Define the initial values for the presentation state */
 const initialState: PresentationState = {
   competition: {
     name: '',
@@ -38,6 +38,7 @@ const initialState: PresentationState = {
   },
 }
 
+/** Intercept actions for presentation state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_PRESENTATION_COMPETITION:
diff --git a/client/src/reducers/rolesReducer.ts b/client/src/reducers/rolesReducer.ts
index 8fc1465a..994ebb1e 100644
--- a/client/src/reducers/rolesReducer.ts
+++ b/client/src/reducers/rolesReducer.ts
@@ -2,16 +2,17 @@ import { AnyAction } from 'redux'
 import Types from '../actions/types'
 import { Role } from '../interfaces/ApiModels'
 
-// Define a type for the role state
+/** Define a type for the role state */
 interface RoleState {
   roles: Role[]
 }
 
-// Define the initial values for the role state
+/** Define the initial values for the role state */
 const initialState: RoleState = {
   roles: [],
 }
 
+/** Intercept actions for roles state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_ROLES:
diff --git a/client/src/reducers/searchUserReducer.ts b/client/src/reducers/searchUserReducer.ts
index 38269dfb..1e78f896 100644
--- a/client/src/reducers/searchUserReducer.ts
+++ b/client/src/reducers/searchUserReducer.ts
@@ -3,7 +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
+/** Define a type for the search user state */
 interface SearchUserState {
   users: User[]
   total: number
@@ -11,7 +11,7 @@ interface SearchUserState {
   filterParams: UserFilterParams
 }
 
-// Define the initial values for the search user state
+/** Define the initial values for the search user state */
 const initialState: SearchUserState = {
   users: [],
   total: 0,
@@ -19,6 +19,7 @@ const initialState: SearchUserState = {
   filterParams: { pageSize: 10, page: 0 },
 }
 
+/** Intercept actions for searchUser state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_SEARCH_USERS:
diff --git a/client/src/reducers/statisticsReducer.ts b/client/src/reducers/statisticsReducer.ts
index bc957ccb..4975bd7f 100644
--- a/client/src/reducers/statisticsReducer.ts
+++ b/client/src/reducers/statisticsReducer.ts
@@ -1,20 +1,21 @@
 import { AnyAction } from 'redux'
 import Types from '../actions/types'
 
-// Define a type for the statistics state
+/** Define a type for the statistics state */
 interface StatisticsState {
   users: number
   competitions: number
   regions: number
 }
 
-// Define the initial values for the statistics state
+/** Define the initial values for the statistics state */
 const initialState: StatisticsState = {
   users: 0,
   competitions: 0,
   regions: 0,
 }
 
+/** Intercept actions for statistics state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_STATISTICS:
diff --git a/client/src/reducers/typesReducer.ts b/client/src/reducers/typesReducer.ts
index 10ea1c63..92707743 100644
--- a/client/src/reducers/typesReducer.ts
+++ b/client/src/reducers/typesReducer.ts
@@ -2,14 +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
+/** 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
+/** Define the initial values for the types state */
 const initialState: TypesState = {
   componentTypes: [],
   viewTypes: [],
@@ -17,6 +17,7 @@ const initialState: TypesState = {
   mediaTypes: [],
 }
 
+/** Intercept actions for types state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_TYPES:
diff --git a/client/src/reducers/uiReducer.ts b/client/src/reducers/uiReducer.ts
index 350f7b8e..0b650683 100644
--- a/client/src/reducers/uiReducer.ts
+++ b/client/src/reducers/uiReducer.ts
@@ -1,23 +1,24 @@
 import { AnyAction } from 'redux'
 import Types from '../actions/types'
 
-// Define a type for the UI error
+/** Define a type for the UI error */
 interface UIError {
   message: string
 }
 
-// Define a type for the UI state
+/** Define a type for the UI state */
 interface UIState {
   loading: boolean
   errors: null | UIError
 }
 
-// Define the initial values for the UI state
+/** Define the initial values for the UI state */
 const initialState: UIState = {
   loading: false,
   errors: null,
 }
 
+/** Intercept actions for ui state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_ERRORS:
diff --git a/client/src/reducers/userReducer.ts b/client/src/reducers/userReducer.ts
index 6b4f985b..155cf2a8 100644
--- a/client/src/reducers/userReducer.ts
+++ b/client/src/reducers/userReducer.ts
@@ -1,7 +1,7 @@
 import { AnyAction } from 'redux'
 import Types from '../actions/types'
 
-// Define a type for users info
+/** Define a type for users info */
 interface UserInfo {
   name: string
   email: string
@@ -10,20 +10,21 @@ interface UserInfo {
   id: number
 }
 
-// Define a type for the users state
+/** Define a type for the users state */
 interface UserState {
   authenticated: boolean
   userInfo: UserInfo | null
   loading: boolean
 }
 
-// Define the initial values for the users state
+/** Define the initial values for the users state */
 const initialState: UserState = {
   authenticated: false,
   loading: false,
   userInfo: null,
 }
 
+/** Intercept actions for user state and update the state */
 export default function (state = initialState, action: AnyAction) {
   switch (action.type) {
     case Types.SET_AUTHENTICATED:
diff --git a/client/src/store.ts b/client/src/store.ts
index 8eec0a48..66e384d3 100644
--- a/client/src/store.ts
+++ b/client/src/store.ts
@@ -2,7 +2,7 @@ import { AnyAction, applyMiddleware, compose, createStore } from 'redux'
 import { composeWithDevTools } from 'redux-devtools-extension'
 import thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'
 import allReducers from './reducers/allReducers'
-/*
+/**
   TypeScript does not know the type of the property. 
   Therefore, you will get the error; Property ‘__REDUX_DEVTOOLS_EXTENSION_COMPOSE__’ 
   does not exist on type ‘Window’. Hence, you need to add the property to the global window as below.
@@ -19,10 +19,13 @@ const middleware = [thunk]
 // const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose // allows Mozilla plugin to view state in a GUI, https://github.com/zalmoxisus/redux-devtools-extension#13-use-redux-devtools-extension-package-from-npm
 // const store = createStore(allReducers, composeEnhancers(applyMiddleware()))
 
-// simple store with plugin
+/** Simple store with plugins and middleware */
 const store = createStore(allReducers, initialState, composeWithDevTools(applyMiddleware(...middleware)))
+/** Type of thunk */
 export type AppThunk<ReturnType = void> = ThunkAction<ReturnType, RootState, unknown, AnyAction>
+/** Type of state */
 export type RootState = ReturnType<typeof store.getState>
+/** Type of dispatch */
 export type AppDispatch = ThunkDispatch<RootState, void, AnyAction>
 
 export default store
-- 
GitLab