Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3201 Rev 3435
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import { useState } from 'react';
2
import { Link, useNavigate } from 'react-router-dom'
2
import { Link, useNavigate } from 'react-router-dom';
3
import { useSelector } from 'react-redux'
3
import { useSelector } from 'react-redux';
4
import { AppBar, Box, Container, Toolbar } from '@mui/material'
4
import { AppBar, Box, Container, Toolbar } from '@mui/material';
5
import {
5
import {
6
  Menu,
6
  Menu,
7
  Chat,
7
  Chat,
8
  Home,
8
  Home,
9
  Sell,
9
  Sell,
10
  School,
10
  School,
11
  People,
11
  People,
12
  Groups,
12
  Groups,
13
  BusinessCenter,
13
  BusinessCenter,
14
  Search
14
  Search
15
} from '@mui/icons-material'
15
} from '@mui/icons-material';
Línea 16... Línea 16...
16
 
16
 
Línea 17... Línea 17...
17
import { useNavbar } from '@hooks'
17
import { useNavbar } from '@hooks';
18
 
18
 
19
import MenuDrawer from './Drawer'
19
import MenuDrawer from './Drawer';
20
import NavigationItem from './navigation-item'
20
import NavigationItem from './navigation-item';
Línea 21... Línea 21...
21
import UserOptions from './user-options'
21
import UserOptions from './user-options';
22
import Input from '@components/UI/inputs/Input'
22
import Input from '@components/UI/inputs/Input';
Línea 23... Línea 23...
23
 
23
 
24
export default function Navbar() {
24
export default function Navbar() {
25
  const { menuData, totalMessages, totalNotifications } = useNavbar()
25
  const { menuData } = useNavbar();
26
 
26
 
Línea 34... Línea 34...
34
    routeKnowledgeArea,
34
    routeKnowledgeArea,
35
    routeAbuseReport,
35
    routeAbuseReport,
36
    urlImpersonate,
36
    urlImpersonate,
37
    urlAdmin,
37
    urlAdmin,
38
    defaultNetwork
38
    defaultNetwork
39
  } = menuData
39
  } = menuData;
Línea 40... Línea 40...
40
 
40
 
41
  const [showDrawer, setShowDrawer] = useState(false)
41
  const [showDrawer, setShowDrawer] = useState(false);
42
  const logo = useSelector(({ auth }) => auth.navbar_url)
42
  const logo = useSelector(({ auth }) => auth.navbar_url);
43
  const labels = useSelector(({ intl }) => intl.labels)
43
  const labels = useSelector(({ intl }) => intl.labels);
44
  const navigate = useNavigate()
44
  const navigate = useNavigate();
45
  const userAgent = navigator.userAgent
45
  const userAgent = navigator.userAgent;
46
  const isIphone = /iPad|iPhone|iPod|Mac/.test(userAgent)
46
  const isIphone = /iPad|iPhone|iPod|Mac/.test(userAgent);
47
 
47
 
48
  const ICON_OPTIONS = [
-
 
49
    Home,
-
 
50
    People,
-
 
51
    BusinessCenter,
-
 
52
    Groups,
-
 
53
    Sell,
-
 
54
    Chat,
-
 
55
    School
-
 
Línea 56... Línea 48...
56
  ]
48
  const ICON_OPTIONS = [Home, People, BusinessCenter, Groups, Sell, Chat, School];
57
 
49
 
58
  const handleSearch = ({ key, target }) => {
50
  const handleSearch = ({ key, target }) => {
59
    if (key !== 'Enter') {
51
    if (key !== 'Enter') {
Línea 60... Línea 52...
60
      return
52
      return;
61
    }
53
    }
62
 
54
 
63
    navigate(`/search/entity/user?keyword=${target.value}`)
55
    navigate(`/search/entity/user?keyword=${target.value}`);
Línea 64... Línea 56...
64
    target.value = ''
56
    target.value = '';
65
    target.blur()
57
    target.blur();
66
  }
58
  };
67
 
59
 
Línea 129... Línea 121...
129
                  }
121
                  }
130
                }
122
                }
131
              }}
123
              }}
132
            >
124
            >
133
              <ul>
125
              <ul>
134
                {menu.map(({ label, href, childs, ajax }, index) => {
126
                {menu.map(({ label, href, childs }, index) => {
135
                  const totalCount = totalNotifications + totalMessages
-
 
136
                  const Icon = ICON_OPTIONS[index]
127
                  const Icon = ICON_OPTIONS[index];
Línea 137... Línea 128...
137
 
128
 
138
                  return (
-
 
139
                    <NavigationItem
-
 
140
                      key={index}
-
 
141
                      url={href}
-
 
142
                      childs={childs}
129
                  return (
143
                      count={label === 'Comunicación' ? totalCount : 0}
-
 
144
                    >
130
                    <NavigationItem key={index} url={href} childs={childs}>
145
                      <Icon />
131
                      <Icon />
146
                      {label}
132
                      {label}
147
                    </NavigationItem>
133
                    </NavigationItem>
148
                  )
134
                  );
Línea 149... Línea 135...
149
                })}
135
                })}
150
 
136
 
151
                <UserOptions
137
                <UserOptions
Línea 175... Línea 161...
175
        icons={ICON_OPTIONS}
161
        icons={ICON_OPTIONS}
176
        isOpen={showDrawer}
162
        isOpen={showDrawer}
177
        closeDrawer={() => setShowDrawer(false)}
163
        closeDrawer={() => setShowDrawer(false)}
178
      />
164
      />
179
    </>
165
    </>
180
  )
166
  );
181
}
167
}