Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1567 Rev 2276
Línea 1... Línea 1...
1
import React, { useMemo, useState } from 'react'
1
import React, { useMemo, useState } from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
3
import {
3
import {
4
  Avatar,
4
  Avatar,
5
  Box,
-
 
6
  List,
5
  List,
7
  ListItem,
6
  ListItem,
8
  ListItemAvatar,
7
  ListItemAvatar,
9
  ListItemButton,
8
  ListItemButton,
10
  ListItemText,
9
  ListItemText,
11
  Typography,
10
  Typography
12
  styled
-
 
13
} from '@mui/material'
11
} from '@mui/material'
Línea 14... Línea 12...
14
 
12
 
15
import { axios } from '@app/utils'
13
import { axios } from '@app/utils'
16
import { addNotification } from '@app/redux/notification/notification.actions'
14
import { addNotification } from '@app/redux/notification/notification.actions'
Línea -... Línea 15...
-
 
15
import useFetch from '@app/hooks/useFetch'
17
import useFetch from '@app/hooks/useFetch'
16
 
18
 
-
 
19
import Button from '@app/components/UI/buttons/Buttons'
-
 
20
import WidgetWrapper from '../WidgetLayout'
-
 
21
 
-
 
22
const Header = styled(Box)(({ theme }) => ({
-
 
23
  display: 'flex',
-
 
24
  alignItems: 'baseline',
-
 
25
  justifyContent: 'space-between',
-
 
26
  padding: theme.spacing(1),
-
 
27
  span: {
-
 
28
    cursor: 'pointer'
-
 
Línea 29... Línea 17...
29
  }
17
import Widget from '@app/components/UI/Widget'
30
}))
18
import Button from '@app/components/UI/buttons/Buttons'
31
 
19
 
32
const PeopleYouMayKnow = () => {
20
const PeopleYouMayKnow = () => {
Línea 65... Línea 53...
65
      refetch()
53
      refetch()
66
    })
54
    })
67
  }
55
  }
Línea 68... Línea 56...
68
 
56
 
69
  return (
57
  return (
70
    <WidgetWrapper>
58
    <Widget>
71
      <Header>
59
      <Widget.Header
-
 
60
        title={labels.connect_with + ':'}
-
 
61
        renderAction={() => {
-
 
62
          if (peopleYouMayKnow.length <= 4) return null
-
 
63
          return (
-
 
64
            <Button onClick={() => setLookMore(!lookMore)}>
-
 
65
              {lookMore ? labels.view_less : labels.view_more}
-
 
66
            </Button>
-
 
67
          )
-
 
68
        }}
72
        <Typography variant='h3'>{`${labels.connect_with}:`}</Typography>
69
      />
-
 
70
 
73
 
71
      <Widget.Body>
74
        {peopleYouMayKnow.length >= 4 && (
72
        {!users.length ? (
75
          <Typography variant='body2' onClick={() => setLookMore(!lookMore)}>
73
          <Typography variant='body1' px={1}>
76
            {lookMore ? labels.view_less : labels.view_more}
74
            {labels.datatable_empty}
-
 
75
          </Typography>
-
 
76
        ) : (
-
 
77
          <List sx={{ width: '100%', maxHeight: 200, overflow: 'auto' }}>
-
 
78
            {users.map(
-
 
79
              ({ id, image, link_cancel, link_request, name, profile }) => (
-
 
80
                <ListItem key={id} disablePadding disableRipple>
-
 
81
                  <ListItemButton disableRipple>
-
 
82
                    <ListItemAvatar>
-
 
83
                      <Avatar alt={`${name} image`} src={image} />
-
 
84
                    </ListItemAvatar>
-
 
85
 
-
 
86
                    <ListItemText primary={name} />
-
 
87
 
-
 
88
                    {link_request && (
-
 
89
                      <Button
-
 
90
                        variant='primary'
-
 
91
                        onClick={() => handleConnect(link_request)}
-
 
92
                      >
-
 
93
                        {labels.connect}
-
 
94
                      </Button>
-
 
95
                    )}
-
 
96
                    {link_cancel && (
-
 
97
                      <Button
-
 
98
                        variant='secondary'
-
 
99
                        onClick={() => handleConnect(link_cancel)}
-
 
100
                      >
-
 
101
                        {labels.cancel}
-
 
102
                      </Button>
-
 
103
                    )}
-
 
104
                  </ListItemButton>
-
 
105
                </ListItem>
-
 
106
              )
-
 
107
            )}
77
          </Typography>
108
          </List>
78
        )}
109
        )}
79
      </Header>
-
 
80
 
-
 
81
      {!users.length ? (
-
 
82
        <Typography variant='body1' px={1}>
-
 
83
          {labels.datatable_empty}
-
 
84
        </Typography>
-
 
85
      ) : (
-
 
86
        <List sx={{ width: '100%', maxHeight: 200, overflow: 'auto' }}>
-
 
87
          {users.map(
-
 
88
            ({ id, image, link_cancel, link_request, name, profile }) => (
-
 
89
              <ListItem key={id} disablePadding disableRipple>
-
 
90
                <ListItemButton disableRipple>
-
 
91
                  <ListItemAvatar>
-
 
92
                    <Avatar alt={`${name} image`} src={image} />
-
 
93
                  </ListItemAvatar>
-
 
94
 
-
 
95
                  <ListItemText primary={name} />
-
 
96
 
-
 
97
                  {link_request && (
-
 
98
                    <Button
-
 
99
                      variant='primary'
-
 
100
                      onClick={() => handleConnect(link_request)}
-
 
101
                    >
-
 
102
                      {labels.connect}
-
 
103
                    </Button>
-
 
104
                  )}
-
 
105
                  {link_cancel && (
-
 
106
                    <Button
-
 
107
                      variant='secondary'
-
 
108
                      onClick={() => handleConnect(link_cancel)}
-
 
109
                    >
-
 
110
                      {labels.cancel}
-
 
111
                    </Button>
-
 
112
                  )}
-
 
113
                </ListItemButton>
-
 
114
              </ListItem>
-
 
115
            )
-
 
116
          )}
-
 
117
        </List>
-
 
118
      )}
110
      </Widget.Body>
119
    </WidgetWrapper>
111
    </Widget>
120
  )
112
  )
Línea 121... Línea 113...
121
}
113
}