Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 5 Rev 949
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useState } from 'react'
-
 
2
import { Link } from 'react-router-dom'
2
import { axios } from '../../../utils'
3
import { axios } from '../../../utils'
3
import { useSelector } from 'react-redux'
4
import { useSelector } from 'react-redux'
Línea -... Línea 5...
-
 
5
 
4
 
6
import StyledContainer from '../WidgetLayout'
5
import EmptySection from '../../UI/EmptySection'
-
 
Línea 6... Línea 7...
6
import { Link } from 'react-router-dom'
7
import EmptySection from '../../UI/EmptySection'
7
 
8
 
8
const SuggestWidget = ({
9
const SuggestWidget = ({
9
  title = 'Mis Grupos:',
10
  title = 'Mis Grupos:',
10
  url = '/helpers/my-groups',
11
  url = '/helpers/my-groups',
11
  btnLabelAccept = 'Ver',
12
  btnLabelAccept = 'Ver'
12
}) => {
13
}) => {
13
  const [widgetData, setWidgetData] = useState([])
14
  const [widgetData, setWidgetData] = useState([])
Línea 36... Línea 37...
36
 
37
 
37
    return infoFollows
38
    return infoFollows
Línea 38... Línea 39...
38
  }
39
  }
39
 
40
 
40
  return (
41
  return (
41
    <div className="suggests_widget">
-
 
42
      <div className="suggests_widget-header">
42
    <StyledContainer>
43
        <h3>{title}</h3>
43
      <StyledContainer.Header title={title}>
44
        {widgetData.length >= 3 && (
44
        {widgetData.length >= 3 && (
45
          <span onClick={() => setLookMore(!lookMore)}>
45
          <span onClick={() => setLookMore(!lookMore)}>
46
            {lookMore ? labels.view_less : labels.view_more}
46
            {lookMore ? labels.view_less : labels.view_more}
-
 
47
          </span>
-
 
48
        )}
47
          </span>
49
      </StyledContainer.Header>
48
        )}
50
 
49
      </div>
51
      <StyledContainer.Body>
50
      <div className="suggest-list">
52
        <div className='suggest-list'>
51
        {widgetData.length ? (
53
          {widgetData.length ? (
52
          dataSlice().map((suggest) => (
54
            dataSlice().map((suggest) => (
53
            <SuggestWidget.Item
55
              <SuggestWidget.Item
54
              key={suggest.id}
56
                key={suggest.id}
55
              suggest={suggest}
57
                suggest={suggest}
56
              btnLabelAccept={btnLabelAccept}
58
                btnLabelAccept={btnLabelAccept}
57
            />
59
              />
58
          ))
60
            ))
59
        ) : (
61
          ) : (
60
          <EmptySection align="left" message={labels?.datatable_empty} />
62
            <EmptySection align='left' message={labels?.datatable_empty} />
-
 
63
          )}
61
        )}
64
        </div>
62
      </div>
65
      </StyledContainer.Body>
63
    </div>
66
    </StyledContainer>
Línea 64... Línea 67...
64
  )
67
  )
65
}
68
}
66
 
69
 
67
const Item = ({ suggest, btnLabelAccept }) => {
70
const Item = ({ suggest, btnLabelAccept }) => {
68
  const labels = useSelector(({ intl }) => intl.labels)
71
  const labels = useSelector(({ intl }) => intl.labels)
69
  return (
72
  return (
70
    <div className="user">
73
    <div className='user'>
71
      <div className="d-inline-flex align-items-center">
74
      <div className='d-inline-flex align-items-center'>
72
        <Link to={suggest.profile}>
75
        <Link to={suggest.profile}>
73
          <img src={suggest.image} alt={`${suggest.name} profile image`} />
76
          <img src={suggest.image} alt={`${suggest.name} profile image`} />
74
        </Link>
77
        </Link>
75
        <h4 className="break-ellipsis">{suggest.name}</h4>
78
        <h4 className='break-ellipsis'>{suggest.name}</h4>
76
      </div>
79
      </div>
77
      <Link to={suggest.profile} className="btn btn-primary ml-auto">
80
      <Link to={suggest.profile} className='btn btn-primary ml-auto'>
78
        {btnLabelAccept || labels.view_profile}
81
        {btnLabelAccept || labels.view_profile}
79
      </Link>
82
      </Link>