Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4917 | Rev 5173 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4917 Rev 5128
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React, { useEffect, useState } from "react";
2
import React, { useEffect, useState } from 'react'
3
import NavLinks from "./nav-links/NavLinks";
3
import NavLinks from './nav-links/NavLinks'
4
import ChatHelper from "../../../chat/chatHelper/ChatHelper";
4
import ChatHelper from '../../../chat/chatHelper/ChatHelper'
5
import UserImageDropdown from "./user-dropdown/UserImageDropdown";
5
import UserImageDropdown from './user-dropdown/UserImageDropdown'
6
import SearchInput from "./searchbox/SearchInput";
6
import SearchInput from './searchbox/SearchInput'
7
import ResponsiveNavbar from "./responsive-navbar/ResponsiveNavbar";
7
import ResponsiveNavbar from './responsive-navbar/ResponsiveNavbar'
Línea 8... Línea 8...
8
 
8
 
9
const Navbar = ({ navbarVars }) => {
-
 
10
 
9
const Navbar = ({ navbarVars }) => {
11
  const {
10
  const {
12
    image,
11
    image,
13
    fullName,
12
    fullName,
14
    companyVars,
13
    companyVars,
15
    isChatPage,
14
    isChatPage,
16
    linkAdmin,
15
    linkAdmin,
17
    linkImpersonate,
16
    linkImpersonate,
18
    routeCheckSession,
17
    routeCheckSession,
19
    logoForNavbar,
18
    logoForNavbar,
20
    menu: menuProps
19
    menu: menuProps
Línea 21... Línea 20...
21
  } = navbarVars;
20
  } = navbarVars
22
 
21
 
23
  const [navbarOpen, setNavbarOpen] = useState(false);
22
  const [navbarOpen, setNavbarOpen] = useState(false)
Línea 24... Línea 23...
24
  const [sessionImage, setSessionImage] = useState(null)
23
  const [sessionImage, setSessionImage] = useState(null)
25
  const [loading, setLoading] = useState(false);
24
  const [loading, setLoading] = useState(false)
26
 
25
 
27
  useEffect(() => {
26
  useEffect(() => {
28
    let timer;
27
    let timer
29
    if (!loading) {
28
    if (!loading) {
30
      timer = setTimeout(() => checkSessionImage(), 1000);
29
      timer = setTimeout(() => checkSessionImage(), 1000)
31
    }
30
    }
32
    return () => {
31
    return () => {
Línea 33... Línea 32...
33
      clearTimeout(timer);
32
      clearTimeout(timer)
34
    };
33
    }
35
  }, [loading])
34
  }, [loading])
36
 
35
 
37
  const checkSessionImage = async () => {
36
  const checkSessionImage = async () => {
38
    setLoading(true);
37
    setLoading(true)
39
    const session_image = sessionStorage.getItem('user_session_image')
38
    const session_image = sessionStorage.getItem('user_session_image')
40
    if (session_image) {
39
    if (session_image) {
41
      await setSessionImage(session_image)
40
      await setSessionImage(session_image)
Línea 42... Línea 41...
42
      sessionStorage.removeItem('user_session_image')
41
      sessionStorage.removeItem('user_session_image')
43
    }
42
    }
44
    setLoading(false);
43
    setLoading(false)
Línea 82... Línea 81...
82
      {window.innerWidth < 1000 && !isChatPage && <ChatHelper />}
81
      {window.innerWidth < 1000 && !isChatPage && <ChatHelper />}
83
    </>
82
    </>
84
  )
83
  )
85
}
84
}
Línea 86... Línea -...
86
 
-
 
87
export default Navbar
85
 
-
 
86
export default Navbar