Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4263 Rev 5173
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React, { useEffect, useState, useRef } from "react";
2
import React, { useEffect, useState, useRef } from 'react'
3
import SocialNetworks from "../../../../dashboard/components/home-section/SocialNetworks";
3
import SocialNetworks from '../../../../dashboard/components/home-section/SocialNetworks'
4
import ProfileInfo from "../../../../dashboard/components/home-section/ProfileInfo";
4
import ProfileInfo from '../../../../dashboard/components/home-section/ProfileInfo'
5
import MyGroups from "../../../../shared/helpers/my-groups-helper/MyGroups";
5
import MyGroups from '../../../../shared/helpers/my-groups-helper/MyGroups'
6
import SuggestedGroupsHelper from "../../../../shared/helpers/suggested-groups-helper/SuggestedGroupsHelper";
6
import SuggestedGroupsHelper from '../../../../shared/helpers/suggested-groups-helper/SuggestedGroupsHelper'
7
 
-
 
8
const ResponsiveNavbar = ({ show, navbarVars }) => {
-
 
Línea -... Línea 7...
-
 
7
 
9
 
8
const ResponsiveNavbar = ({ show, navbarVars, LABELS }) => {
10
  // const { authorization } = props.companyVars
9
  // const { authorization } = props.companyVars
Línea 11... Línea 10...
11
  //  const {allowProfile, allowFollower, allowUser, allowFeed, allowJob, allowCompany, allowSetting} = authorization
10
  //  const {allowProfile, allowFollower, allowUser, allowFeed, allowJob, allowCompany, allowSetting} = authorization
12
 
11
 
Línea 13... Línea 12...
13
  const [shouldRender, setShouldRender] = useState(show);
12
  const [shouldRender, setShouldRender] = useState(show)
Línea 14... Línea 13...
14
  const responsiveNavbar = useRef()
13
  const responsiveNavbar = useRef()
15
 
14
 
16
  const handleUnmount = () => !show && setShouldRender(false)
15
  const handleUnmount = () => !show && setShouldRender(false)
Línea 17... Línea 16...
17
 
16
 
18
  useEffect(() => {
17
  useEffect(() => {
19
    if (show) return setShouldRender(show)
18
    if (show) return setShouldRender(show)
20
  }, [show]);
19
  }, [show])
21
 
20
 
22
  useEffect(() => {
21
  useEffect(() => {
23
    const handleClickOutside = (event) => {
22
    const handleClickOutside = (event) => {
Línea 24... Línea 23...
24
      if (responsiveNavbar.current && !responsiveNavbar.current.contains(event.target)) {
23
      if (responsiveNavbar.current && !responsiveNavbar.current.contains(event.target)) {
25
        setShouldRender(false)
24
        setShouldRender(false)
26
      }
25
      }
27
    }
26
    }
Línea 28... Línea 27...
28
    document.addEventListener("mousedown", handleClickOutside);
27
    document.addEventListener('mousedown', handleClickOutside)
29
 
28
 
30
    return () => {
29
    return () => {
31
      document.removeEventListener("mousedown", handleClickOutside);
30
      document.removeEventListener('mousedown', handleClickOutside)
Línea 40... Línea 39...
40
    >
39
    >
41
      <ProfileInfo
40
      <ProfileInfo
42
        {...navbarVars}
41
        {...navbarVars}
43
        headerClasses="d-flex rounded-0"
42
        headerClasses="d-flex rounded-0"
44
      />
43
      />
45
      <MyGroups suggestedClassname="d-block" />
44
      <MyGroups LABELS={LABELS} suggestedClassname="d-block" />
46
      <SuggestedGroupsHelper suggestedClassname='d-block' />
45
      <SuggestedGroupsHelper suggestedClassname='d-block' />
47
      <SocialNetworks />
46
      <SocialNetworks LABELS={LABELS} />
48
    </nav>
47
    </nav>
49
  )
48
  )
50
}
49
}
Línea 51... Línea 50...
51
 
50