Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5400 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5400 Rev 5455
Línea -... Línea 1...
-
 
1
/* eslint-disable camelcase */
1
/* eslint-disable react/prop-types */
2
/* eslint-disable react/prop-types */
2
import React, { useEffect, useState } from 'react'
3
import React, { useEffect, useState } from 'react'
3
import NavLinks from './nav-links/NavLinks'
4
import NavLinks from './nav-links/NavLinks'
4
import ChatHelper from '../../../chat/chatHelper/ChatHelper'
5
import ChatHelper from '../../../chat/chatHelper/ChatHelper'
5
import UserImageDropdown from './user-dropdown/UserImageDropdown'
6
import UserImageDropdown from './user-dropdown/UserImageDropdown'
Línea 19... Línea 20...
19
    routeCheckSession,
20
    routeCheckSession,
20
    logoForNavbar,
21
    logoForNavbar,
21
    menu: menuProps
22
    menu: menuProps
22
  } = navbarVars
23
  } = navbarVars
23
  const [navbarOpen, setNavbarOpen] = useState(false)
24
  const [navbarOpen, setNavbarOpen] = useState(false)
24
  const [sessionImage, setSessionImage] = useState(null)
-
 
25
  const [loading, setLoading] = useState(false)
-
 
26
  const dispatch = useDispatch()
25
  const dispatch = useDispatch()
Línea 27... Línea 26...
27
 
26
 
28
  useEffect(() => {
27
  useEffect(() => {
29
    dispatch(setIntlLabels(labels))
28
    dispatch(setIntlLabels(labels))
Línea 30... Línea -...
30
  }, [])
-
 
31
 
-
 
32
  useEffect(() => {
-
 
33
    let timer
-
 
34
    if (!loading) {
-
 
35
      timer = setTimeout(() => checkSessionImage(), 1000)
-
 
36
    }
-
 
37
    return () => {
-
 
38
      clearTimeout(timer)
-
 
39
    }
-
 
40
  }, [loading])
-
 
41
 
-
 
42
  const checkSessionImage = async () => {
-
 
43
    setLoading(true)
-
 
44
    const session_image = sessionStorage.getItem('user_session_image')
-
 
45
    if (session_image) {
-
 
46
      await setSessionImage(session_image)
-
 
47
      sessionStorage.removeItem('user_session_image')
-
 
48
    }
-
 
49
    setLoading(false)
-
 
50
  }
29
  }, [])
51
 
30
 
52
  return (
31
  return (
53
    <>
32
    <>
54
      <nav className='navbar'>
33
      <nav className='navbar'>
Línea 69... Línea 48...
69
        <UserImageDropdown
48
        <UserImageDropdown
70
          image={image}
49
          image={image}
71
          fullName={fullName}
50
          fullName={fullName}
72
          linkAdmin={linkAdmin}
51
          linkAdmin={linkAdmin}
73
          linkImpersonate={linkImpersonate}
52
          linkImpersonate={linkImpersonate}
74
          sessionImage={sessionImage}
-
 
75
        />
53
        />
76
      </nav>
54
      </nav>
77
      <ResponsiveNavbar
55
      <ResponsiveNavbar
78
        show={navbarOpen}
56
        show={navbarOpen}
79
        navbarVars={navbarVars}
57
        navbarVars={navbarVars}
80
        companyVars={companyVars}
58
        companyVars={companyVars}
81
        image={image}
59
        image={image}
82
        fullName={fullName}
60
        fullName={fullName}
83
        linkAdmin={linkAdmin}
61
        linkAdmin={linkAdmin}
84
        linkImpersonate={linkImpersonate}
62
        linkImpersonate={linkImpersonate}
85
        sessionImage={sessionImage}
-
 
86
      />
63
      />
87
      {window.innerWidth < 1000 && !isChatPage && <ChatHelper />}
64
      {window.innerWidth < 1000 && !isChatPage && <ChatHelper />}
88
    </>
65
    </>
89
  )
66
  )
90
}
67
}