Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6699 Rev 6700
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 5... Línea -...
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
}
-
 
166
 
5
 
167
const Header = ({ theme = 'default' }) => {
6
const Header = ({ theme = 'default' }) => {
168
  const [backendVars, setBackendVars] = useState(null)
7
  const [backendVars, setBackendVars] = useState(null)
169
  const [notificationsCount, setNotificationsCount] = useState(0)
8
  const [notificationsCount, setNotificationsCount] = useState(0)
170
  const [messagesCount, setMessagesCount] = useState(0)
9
  const [messagesCount, setMessagesCount] = useState(0)
Línea 198... Línea 37...
198
    }
37
    }
199
  }
38
  }
Línea 200... Línea 39...
200
 
39
 
201
  useEffect(() => {
40
  useEffect(() => {
202
    getBackendVars('/helpers/menu')
41
    getBackendVars('/helpers/menu')
203
      .then((data) => {
42
      .then((results) => {
204
        const knowledgeRoutes = {
43
        const knowledgeRoutes = {
205
          label: 'Conocimiento',
44
          label: 'Conocimiento',
206
          href: '/knowledge',
45
          href: '/knowledge',
207
          img: '',
46
          img: '',
Línea 224... Línea 63...
224
            },
63
            },
225
          ],
64
          ],
226
          ajax: 0,
65
          ajax: 0,
227
        }
66
        }
Línea 228... Línea 67...
228
 
67
 
-
 
68
        const menuItems = [...results.menu, knowledgeRoutes, comunicationRoutes]
-
 
69
 
-
 
70
        if (results.linkMyCoach) {
-
 
71
          knowledgeRoutes.childs.push({ label: 'Mi Coach', href: '/my-coach' })
Línea 229... Línea 72...
229
        const menuItems = [...data.menu, knowledgeRoutes, comunicationRoutes]
72
        }
230
 
73
 
231
        if (results.linkKnowledgeArea) {
74
        if (results.linkKnowledgeArea) {
232
          knowledgeRoutes.childs.push({
75
          knowledgeRoutes.childs.push({
233
            label: 'Área de conocimiento',
76
            label: 'Área de conocimiento',
234
            href: results.routeKnowledgeArea,
77
            href: results.routeKnowledgeArea,
Línea 235... Línea -...
235
          })
-
 
236
        }
-
 
237
 
-
 
238
        if (results.linkMyCoach) {
-
 
239
          knowledgeRoutes.childs.push({ label: 'Mi Coach', href: '/my-coach' })
78
          })
240
        }
79
        }
241
 
80
 
242
        setUserImage(data.image)
81
        setUserImage(results.image)
243
        setBackendVars({ ...data, menu: menuItems })
82
        setBackendVars({ ...results, menu: menuItems })
244
      })
83
      })
245
      .catch((err) => {
84
      .catch((err) => {