From 1f1843391b81b3bb51e389d706bb55a172f9558e Mon Sep 17 00:00:00 2001
From: bmodee <bjomo323@student.liu.se>
Date: Thu, 20 May 2021 09:31:54 +0200
Subject: [PATCH] Add comments

---
 client/src/pages/views/OperatorViewPage.tsx | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/client/src/pages/views/OperatorViewPage.tsx b/client/src/pages/views/OperatorViewPage.tsx
index e0544902..9dab453b 100644
--- a/client/src/pages/views/OperatorViewPage.tsx
+++ b/client/src/pages/views/OperatorViewPage.tsx
@@ -122,6 +122,7 @@ const OperatorViewPage: React.FC = () => {
     endCompetition()
   }
 
+  /** Handles the closing of popup*/
   const handleClose = () => {
     setOpen(false)
     setOpenCode(false)
@@ -133,17 +134,20 @@ const OperatorViewPage: React.FC = () => {
     setOpen(true)
   }
 
+  /** Handles opening the code popup */
   const handleOpenCodes = async () => {
     await getCodes()
     setOpenCode(true)
   }
 
+  /** Function that runs when the operator closes the competition */
   const endCompetition = () => {
     setOpen(false)
     socketEndPresentation()
     dispatch(logoutCompetition('Operator'))
   }
 
+  /** Retrives the codes from the server */
   const getCodes = async () => {
     await axios
       .get(`/api/competitions/${activeId}/codes`)
@@ -179,6 +183,7 @@ const OperatorViewPage: React.FC = () => {
     return typeName
   }
 
+  /** Starting the timer */
   const handleStartTimer = () => {
     if (!slideTimer) return
 
@@ -186,11 +191,13 @@ const OperatorViewPage: React.FC = () => {
     else socketSync({ timer: { ...timer, enabled: false } })
   }
 
+  /** Function that runs when operator presses the next slide button */
   const handleSetNextSlide = () => {
     if (activeSlideOrder !== undefined)
       socketSync({ slide_order: activeSlideOrder + 1, timer: { value: null, enabled: false } })
   }
 
+  /** Function that runs when operator presses the previous slide button */
   const handleSetPrevSlide = () => {
     if (activeSlideOrder !== undefined)
       socketSync({ slide_order: activeSlideOrder - 1, timer: { value: null, enabled: false } })
@@ -205,7 +212,7 @@ const OperatorViewPage: React.FC = () => {
           </DialogTitle>
         </Center>
         <DialogContent>
-          {/* <DialogContentText>Här visas tävlingskoderna till den valda tävlingen.</DialogContentText> */}
+          {/** competition codes popup */}
           {codes &&
             codes.map((code) => (
               <ListItem key={code.id} style={{ display: 'flex' }}>
@@ -246,6 +253,8 @@ const OperatorViewPage: React.FC = () => {
           </Button>
         </DialogActions>
       </Dialog>
+
+      {/* Verify exit popup */}
       <OperatorHeader color="primary" position="fixed">
         <Tooltip title="Avsluta tävling" arrow>
           <OperatorQuitButton onClick={handleVerifyExit} variant="contained" color="secondary">
@@ -279,12 +288,16 @@ const OperatorViewPage: React.FC = () => {
         </OperatorHeaderItem>
       </OperatorHeader>
       {<div style={{ minHeight: 64 }} />}
+
+      {/* Show the correct slide */}
       <OperatorContent>
         <OperatorInnerContent>
           {activeViewTypeId && <SlideDisplay variant="presentation" activeViewTypeId={activeViewTypeId} />}
         </OperatorInnerContent>
       </OperatorContent>
       {<div style={{ minHeight: 128 }} />}
+
+      {/* Show the operator buttons */}
       <OperatorFooter position="fixed">
         <Tooltip title="Föregående sida" arrow>
           <div>
@@ -332,6 +345,7 @@ const OperatorViewPage: React.FC = () => {
         </Tooltip>
       </OperatorFooter>
 
+      {/* Show the user that they have joined the competition */}
       <Snackbar
         open={successMessageOpen && Boolean(competitionName)}
         autoHideDuration={4000}
-- 
GitLab