Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6698 Rev 6699
Línea 1... Línea 1...
1
import React, { useState, useEffect } from 'react'
1
import React, { useState, useEffect } from 'react'
2
import DefaultNavbar from './default/Navbar'
2
import DefaultNavbar from './default/Navbar'
3
import { axios } from '../../utils'
3
import { axios } from '../../utils'
4
import { getBackendVars } from '../../services/backendVars'
4
import { getBackendVars } from '../../services/backendVars'
Línea -... Línea 5...
-
 
5
 
-
 
6
const results = {
-
 
7
  menu: [
-
 
8
    {
-
 
9
      label: 'Inicio',
-
 
10
      href: 'dashboard',
-
 
11
      img: '/images/navbar/home.svg',
-
 
12
      ajax: 0,
-
 
13
      childs: [],
-
 
14
    },
-
 
15
    {
-
 
16
      label: 'Perfil',
-
 
17
      href: 'profile',
-
 
18
      img: '/images/navbar/perfil.svg',
-
 
19
      ajax: 0,
-
 
20
      childs: [
-
 
21
        {
-
 
22
          label: 'Conexiones',
-
 
23
          href: 'connection',
-
 
24
          childs: [
-
 
25
            {
-
 
26
              label: 'Mis Conexiones',
-
 
27
              href: 'connection/my-connections',
-
 
28
            },
-
 
29
            {
-
 
30
              label: 'Invitaciones enviadas',
-
 
31
              href: 'connection/invitations-sent',
-
 
32
            },
-
 
33
            {
-
 
34
              label: 'Invitaciones recibidas',
-
 
35
              href: 'connection/invitations-received',
-
 
36
            },
-
 
37
            {
-
 
38
              label: 'Personas que quizás conozcas',
-
 
39
              href: 'connection/people-you-may-know',
-
 
40
            },
-
 
41
            {
-
 
42
              label: 'Personas bloqueadas',
-
 
43
              href: 'connection/people-blocked',
-
 
44
            },
-
 
45
          ],
-
 
46
        },
-
 
47
        {
-
 
48
          label: 'Mis perfiles',
-
 
49
          href: 'profile/my-profiles',
-
 
50
          childs: [],
-
 
51
        },
-
 
52
        {
-
 
53
          label: 'Empleos',
-
 
54
          href: 'job',
-
 
55
          childs: [
-
 
56
            {
-
 
57
              label: 'Que he aplicado',
-
 
58
              href: 'job/applied-jobs',
-
 
59
            },
-
 
60
            {
-
 
61
              label: 'Guardados',
-
 
62
              href: 'job/saved-jobs',
-
 
63
            },
-
 
64
          ],
-
 
65
        },
-
 
66
        {
-
 
67
          label: 'Quién ha visto mi perfil',
-
 
68
          href: 'profile/people-viewed-profile',
-
 
69
          childs: [],
-
 
70
        },
-
 
71
      ],
-
 
72
    },
-
 
73
    {
-
 
74
      label: 'Empresas',
-
 
75
      href: 'company',
-
 
76
      img: '/images/navbar/empresa.svg',
-
 
77
      ajax: 0,
-
 
78
      childs: [
-
 
79
        {
-
 
80
          label: 'Mis empresas',
-
 
81
          href: 'company/my-companies',
-
 
82
          childs: [],
-
 
83
        },
-
 
84
        {
-
 
85
          label: 'Empresas que sigo',
-
 
86
          href: 'company/following-companies',
-
 
87
          childs: [],
-
 
88
        },
-
 
89
        {
-
 
90
          label: 'Empresas donde trabajo',
-
 
91
          href: 'company/i-work-with',
-
 
92
          childs: [],
-
 
93
        },
-
 
94
        {
-
 
95
          label: 'Solicitudes enviadas',
-
 
96
          href: 'company/requests-sent',
-
 
97
          childs: [],
-
 
98
        },
-
 
99
        {
-
 
100
          label: 'Invitaciones recibidas',
-
 
101
          href: 'company/invitations-received',
-
 
102
          childs: [],
-
 
103
        },
-
 
104
      ],
-
 
105
    },
-
 
106
    {
-
 
107
      label: 'Grupos',
-
 
108
      href: 'group',
-
 
109
      img: '/images/navbar/grupos.svg',
-
 
110
      ajax: 0,
-
 
111
      childs: [
-
 
112
        {
-
 
113
          label: 'Mis Grupos',
-
 
114
          href: 'group/my-groups',
-
 
115
          childs: [],
-
 
116
        },
-
 
117
        {
-
 
118
          label: 'Grupos unidos',
-
 
119
          href: 'group/joined-groups',
-
 
120
          childs: [],
-
 
121
        },
-
 
122
        {
-
 
123
          label: 'Solicitudes enviadas',
-
 
124
          href: 'group/requests-sent',
-
 
125
          childs: [],
-
 
126
        },
-
 
127
        {
-
 
128
          label: 'Invitaciones recibidas',
-
 
129
          href: 'group/invitations-received',
-
 
130
          childs: [],
-
 
131
        },
-
 
132
      ],
-
 
133
    },
-
 
134
    {
-
 
135
      label: 'Tienda',
-
 
136
      href: 'marketplace',
-
 
137
      img: '/images/navbar/market-place.svg',
-
 
138
      ajax: 0,
-
 
139
      childs: [],
-
 
140
    },
-
 
141
    {
-
 
142
      label: 'Calendario',
-
 
143
      href: 'calendar',
-
 
144
      img: '/images/navbar/calendar.svg',
-
 
145
      ajax: 0,
-
 
146
      childs: [],
-
 
147
    },
-
 
148
  ],
-
 
149
  isChatPage: false,
-
 
150
  routeCheckSession: '/check-session',
-
 
151
  linkAdmin: false,
-
 
152
  linkImpersonate: true,
-
 
153
  image:
-
 
154
    '/storage/type/user/code/e85129fa-18eb-4149-8640-fea9ae916cdc/filename/user-profile-63d3c94c2b1a4.png/',
-
 
155
  fullName: 'Santiago Olivera',
-
 
156
  country: 'México',
-
 
157
  visits: '64',
-
 
158
  connections: 6,
-
 
159
  logoForNavbar: 'https://dev.leaderslinked.com/storage-network/type/navbar',
-
 
160
  defaultNetwork: 'y',
-
 
161
  linkKnowledgeArea: true,
-
 
162
  routeKnowledgeArea: '/knowledge-area',
-
 
163
  linkMyCoach: true,
-
 
164
  routeMyCoach: '/my-coach',
-
 
165
}
5
 
166
 
6
const Header = ({ theme = 'default' }) => {
167
const Header = ({ theme = 'default' }) => {
7
  const [backendVars, setBackendVars] = useState(null)
168
  const [backendVars, setBackendVars] = useState(null)
8
  const [setNotificationsCount] = useState(0)
169
  const [notificationsCount, setNotificationsCount] = useState(0)
9
  const [setMessagesCount] = useState(0)
170
  const [messagesCount, setMessagesCount] = useState(0)
10
  const [userImage, setUserImage] = useState('')
171
  const [userImage, setUserImage] = useState('')
Línea 11... Línea 172...
11
  const [loading, setLoading] = useState(false)
172
  const [loading, setLoading] = useState(false)
12
 
173
 
Línea 37... Línea 198...
37
    }
198
    }
38
  }
199
  }
Línea 39... Línea 200...
39
 
200
 
40
  useEffect(() => {
201
  useEffect(() => {
41
    getBackendVars('/helpers/menu')
202
    getBackendVars('/helpers/menu')
42
      .then((results) => {
203
      .then((data) => {
43
        const knowledgeRoutes = {
204
        const knowledgeRoutes = {
44
          label: 'Conocimiento',
205
          label: 'Conocimiento',
45
          href: '/knowledge',
206
          href: '/knowledge',
-
 
207
          img: '',
-
 
208
          childs: [],
-
 
209
          ajax: 0,
-
 
210
        }
-
 
211
 
-
 
212
        const comunicationRoutes = {
-
 
213
          label: 'Comunicación',
-
 
214
          href: '/comunication',
-
 
215
          img: '',
-
 
216
          childs: [
-
 
217
            { label: 'Calendario', href: '/calendar' },
46
          img: '',
218
            { label: 'Inmail', href: '/inmail', count: messagesCount },
-
 
219
            { label: 'Chat', href: '/chat' },
-
 
220
            {
-
 
221
              label: 'Notificaciones',
-
 
222
              href: '/notifications',
-
 
223
              count: notificationsCount,
-
 
224
            },
47
          childs: [{ label: 'Mi Coach', href: '/my-coach' }],
225
          ],
48
          ajax: 0,
226
          ajax: 0,
Línea 49... Línea 227...
49
        }
227
        }
-
 
228
 
-
 
229
        const menuItems = [...data.menu, knowledgeRoutes, comunicationRoutes]
-
 
230
 
-
 
231
        if (results.linkKnowledgeArea) {
-
 
232
          knowledgeRoutes.childs.push({
-
 
233
            label: 'Área de conocimiento',
-
 
234
            href: results.routeKnowledgeArea,
-
 
235
          })
-
 
236
        }
-
 
237
 
-
 
238
        if (results.linkMyCoach) {
Línea 50... Línea 239...
50
 
239
          knowledgeRoutes.childs.push({ label: 'Mi Coach', href: '/my-coach' })
51
        const menuItems = [...results.menu, knowledgeRoutes]
240
        }
52
 
241
 
53
        setUserImage(results.image)
242
        setUserImage(data.image)
54
        setBackendVars({ ...results, menu: menuItems })
243
        setBackendVars({ ...data, menu: menuItems })
55
      })
244
      })
56
      .catch((err) => {
245
      .catch((err) => {