From 72094a0789af96f03e37f15542dcd85faff29b5d Mon Sep 17 00:00:00 2001
From: Luis Felipe Risch <lfr20@inf.ufpr.br>
Date: Tue, 9 Feb 2021 10:20:29 -0300
Subject: [PATCH] Give the correct spacing between lines

---
 src/Components/Header.js | 282 +++++++++++++++++++--------------------
 1 file changed, 141 insertions(+), 141 deletions(-)

diff --git a/src/Components/Header.js b/src/Components/Header.js
index b607b201..f721a372 100644
--- a/src/Components/Header.js
+++ b/src/Components/Header.js
@@ -18,7 +18,7 @@ along with Plataforma Integrada MEC.  If not, see <http://www.gnu.org/licenses/>
 
 import React, { useContext, useState, useEffect } from 'react'
 import axios from 'axios'
-import {apiUrl} from '../env'
+import { apiUrl } from '../env'
 import MenuBar from './MenuBar'
 import SearchBar from './SearchBar'
 import SignUpModal from './SignUpModal'
@@ -27,7 +27,7 @@ import { Store } from '../Store';
 import ColaborarModal from './ColaborarModal.js'
 import Snackbar from '@material-ui/core/Snackbar';
 import MuiAlert from '@material-ui/lab/Alert';
-import {useLocation} from 'react-router-dom'
+import { useLocation } from 'react-router-dom'
 import MenuBarMobile from './MenuBarMobile.js'
 
 //const StyledButton = styled(Button)`
@@ -35,149 +35,149 @@ import MenuBarMobile from './MenuBarMobile.js'
 //    boxShadow :none;
 //`
 function Alert(props) {
-  return <MuiAlert elevation={6} variant="filled" {...props} />;
+    return <MuiAlert elevation={6} variant="filled" {...props} />;
 }
 
 
-export default function Header(props){
-  const { state, dispatch } = useContext(Store)
-  const [signUpOpen, setSignUp] = useState(false)
-  const [loginOpen, setLogin] = useState(false)
-  const [successfulLoginOpen, handleSuccessfulLogin] = useState(false)
-  const [modalColaborar, setModalColaborar] = useState(false)
-
-  const validateToken = (config) => {
-      axios.get(`${apiUrl}/auth/validate_token/`, config).then(
-           (response) => {
-              console.log(response.data)
-              if ( response.headers['access-token'] ) {
-                  sessionStorage.setItem('@portalmec/accessToken', response.headers['access-token'])
-              }
-              dispatch ({
-                  type: "USER_LOGGED_IN",
-                  userLoggedIn: !state.userIsLoggedIn,
-                  login: response.data.data
-                  }
-              )
-
-              sessionStorage.setItem('@portalmec/id', response.data.data.id)
-              sessionStorage.setItem('@portalmec/username', response.data.data.name)
-              sessionStorage.setItem('@portalmec/uid', response.data.data.uid)
-
-
-              let headers = {
-                  client:response.headers.client,
-                  "access-token":response.headers['access-token'],
-                  "token-type": "Bearer",
-                  expiry:response.headers.expiry,
-                  uid:response.data.data.uid
-              }
-              sessionStorage.setItem('@portalmec/auth_headers', JSON.stringify(headers))
-          },
-          (err) => {
-              console.log(err)
-          }
-       )
-  }
-
-  useEffect( () => {
-      if (sessionStorage.getItem('@portalmec/auth_headers')) {
-          let config = { headers : JSON.parse(sessionStorage.getItem('@portalmec/auth_headers'))}
-
-          validateToken(config)
-      }
-  }, [])
-
-  useEffect ( () => {
-      if (state.currentUser.askTeacherQuestion === true) {
-          dispatch({
-            type: "TOGGLE_MODAL_COLABORAR_PLATAFORMA",
-            modalColaborarPlataformaOpen: true
-          });
-      }
-  }, [state.currentUser.askTeacherQuestion])
-
-  const redirect = () => {
-      props.history.push('/')
-  }
-
-  let loc = useLocation()
-  useEffect(() => {
-      let query = new URLSearchParams(loc.search)
-
-      if(query.get("auth_token")) {
-  	       let config = {
-  		           headers : {
-  			                  "access-token" : query.get("auth_token"),
-  			                  "client" : query.get("client_id"),
-  			                  "uid" : query.get("uid"),
-  			                  "expiry" : query.get("expiry"),
-  			                  "token-type" : 'Bearer'
-  		           }
-                  }
-  	       validateToken(config)
-           redirect()
-      }
-      
-  }, [loc])
-
-  const toggleSnackbar = (event, reason) => {
-      if (reason === 'clickaway') {
-          return;
-      }
-
-      handleSuccessfulLogin(false);
-  }
-
-  const handleSignUp = () => {
-      setSignUp(!signUpOpen)
-  }
-
-  const handleLogin = () => {
-      setLogin(!loginOpen)
-  }
-
-  const handleClickSearch = (open) => {
-    dispatch({
-      type: "HANDLE_SEARCH_BAR",
-      opened: !state.searchOpen
-    })
-  }
-
-  let windowWidth = window.innerWidth
-
-  return (
-    <React.Fragment>
-       {/*
+export default function Header(props) {
+    const { state, dispatch } = useContext(Store)
+    const [signUpOpen, setSignUp] = useState(false)
+    const [loginOpen, setLogin] = useState(false)
+    const [successfulLoginOpen, handleSuccessfulLogin] = useState(false)
+    const [modalColaborar, setModalColaborar] = useState(false)
+
+    const validateToken = (config) => {
+        axios.get(`${apiUrl}/auth/validate_token/`, config).then(
+            (response) => {
+                console.log(response.data)
+                if (response.headers['access-token']) {
+                    sessionStorage.setItem('@portalmec/accessToken', response.headers['access-token'])
+                }
+                dispatch({
+                    type: "USER_LOGGED_IN",
+                    userLoggedIn: !state.userIsLoggedIn,
+                    login: response.data.data
+                }
+                )
+
+                sessionStorage.setItem('@portalmec/id', response.data.data.id)
+                sessionStorage.setItem('@portalmec/username', response.data.data.name)
+                sessionStorage.setItem('@portalmec/uid', response.data.data.uid)
+
+
+                let headers = {
+                    client: response.headers.client,
+                    "access-token": response.headers['access-token'],
+                    "token-type": "Bearer",
+                    expiry: response.headers.expiry,
+                    uid: response.data.data.uid
+                }
+                sessionStorage.setItem('@portalmec/auth_headers', JSON.stringify(headers))
+            },
+            (err) => {
+                console.log(err)
+            }
+        )
+    }
+
+    useEffect(() => {
+        if (sessionStorage.getItem('@portalmec/auth_headers')) {
+            let config = { headers: JSON.parse(sessionStorage.getItem('@portalmec/auth_headers')) }
+
+            validateToken(config)
+        }
+    }, [])
+
+    useEffect(() => {
+        if (state.currentUser.askTeacherQuestion === true) {
+            dispatch({
+                type: "TOGGLE_MODAL_COLABORAR_PLATAFORMA",
+                modalColaborarPlataformaOpen: true
+            });
+        }
+    }, [state.currentUser.askTeacherQuestion])
+
+    const redirect = () => {
+        props.history.push('/')
+    }
+
+    let loc = useLocation()
+    useEffect(() => {
+        let query = new URLSearchParams(loc.search)
+
+        if (query.get("auth_token")) {
+            let config = {
+                headers: {
+                    "access-token": query.get("auth_token"),
+                    "client": query.get("client_id"),
+                    "uid": query.get("uid"),
+                    "expiry": query.get("expiry"),
+                    "token-type": 'Bearer'
+                }
+            }
+            validateToken(config)
+            redirect()
+        }
+
+    }, [loc])
+
+    const toggleSnackbar = (event, reason) => {
+        if (reason === 'clickaway') {
+            return;
+        }
+
+        handleSuccessfulLogin(false);
+    }
+
+    const handleSignUp = () => {
+        setSignUp(!signUpOpen)
+    }
+
+    const handleLogin = () => {
+        setLogin(!loginOpen)
+    }
+
+    const handleClickSearch = (open) => {
+        dispatch({
+            type: "HANDLE_SEARCH_BAR",
+            opened: !state.searchOpen
+        })
+    }
+
+    let windowWidth = window.innerWidth
+
+    return (
+        <React.Fragment>
+            {/*
            windowWidth > 990 &&
            <AcessibilityBar/>
        */}
-        <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleSnackbar}
-                  anchorOrigin = {{ vertical:'top', horizontal:'center' }}
-              >
-              <Alert severity="success" style={{backgroundColor:"#00acc1"}}>Você está conectado(a)!</Alert>
-        </Snackbar>
-        {
-            windowWidth > 990 ?
-            (
-                <React.Fragment>
-                    <MenuBar openSearchBar={handleClickSearch} openSignUp = {handleSignUp} openLogin = {handleLogin}/>
-                    {
-                    state.searchOpen &&
-                    <SearchBar/>
-                    }
-                </React.Fragment>
-
-            )
-            :
-            (
-                <MenuBarMobile openSignUp = {handleSignUp} openLogin = {handleLogin}/>
-            )
-        }
-      <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin}/>
-      <LoginModal open={loginOpen} handleClose={() => setLogin(false)}      openSignUp={handleSignUp}
-                  openSnackbar={() => {handleSuccessfulLogin(true)}}/>
-      <ColaborarModal open={modalColaborar} handleClose={() => {setModalColaborar(!modalColaborar)}} />
-    </React.Fragment>
-  )
+            <Snackbar open={successfulLoginOpen} autoHideDuration={1000} onClose={toggleSnackbar}
+                anchorOrigin={{ vertical: 'top', horizontal: 'center' }}
+            >
+                <Alert severity="success" style={{ backgroundColor: "#00acc1" }}>Você está conectado(a)!</Alert>
+            </Snackbar>
+            {
+                windowWidth > 990 ?
+                    (
+                        <React.Fragment>
+                            <MenuBar openSearchBar={handleClickSearch} openSignUp={handleSignUp} openLogin={handleLogin} />
+                            {
+                                state.searchOpen &&
+                                <SearchBar />
+                            }
+                        </React.Fragment>
+
+                    )
+                    :
+                    (
+                        <MenuBarMobile openSignUp={handleSignUp} openLogin={handleLogin} />
+                    )
+            }
+            <SignUpModal open={signUpOpen} handleClose={handleSignUp} openLogin={handleLogin} />
+            <LoginModal open={loginOpen} handleClose={() => setLogin(false)} openSignUp={handleSignUp}
+                openSnackbar={() => { handleSuccessfulLogin(true) }} />
+            <ColaborarModal open={modalColaborar} handleClose={() => { setModalColaborar(!modalColaborar) }} />
+        </React.Fragment>
+    )
 }
-- 
GitLab