Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7148 Rev 7149
Línea 1... Línea 1...
1
import React, { useEffect, useRef, useState } from 'react'
1
import React, { useEffect, useState } from 'react'
2
import { axios } from '../../../utils'
2
import { axios } from '../../../utils'
3
import { feedTypes } from '../../../redux/feed/feed.types'
3
import { feedTypes } from '../../../redux/feed/feed.types'
4
import { deleteFeed } from '../../../redux/feed/feed.actions'
4
import { deleteFeed } from '../../../redux/feed/feed.actions'
5
import { openShareModal } from '../../../redux/share-modal/shareModal.actions'
5
import { openShareModal } from '../../../redux/share-modal/shareModal.actions'
6
import { shareModalTypes } from '../../../redux/share-modal/shareModal.types'
6
import { shareModalTypes } from '../../../redux/share-modal/shareModal.types'
Línea 26... Línea 26...
26
 
26
 
27
import './Feed.scss'
27
import './Feed.scss'
28
import ReactionsButton from '../../UI/buttons/ReactionsButton'
28
import ReactionsButton from '../../UI/buttons/ReactionsButton'
29
import Options from '../../UI/Option'
29
import Options from '../../UI/Option'
-
 
30
import { Avatar } from '@mui/material'
Línea 30... Línea 31...
30
import { Avatar } from '@mui/material'
31
import { Link } from 'react-router-dom'
31
 
32
 
32
const Feed = (props) => {
33
const Feed = (props) => {
33
  const {
34
  const {
Línea 358... Línea 359...
358
  deleteUrl = '',
359
  deleteUrl = '',
359
  viewUrl = '',
360
  viewUrl = '',
360
  feedUnique = '',
361
  feedUnique = '',
361
}) => {
362
}) => {
362
  const [showConfirmModal, setShowConfirmModal] = useState(false)
363
  const [showConfirmModal, setShowConfirmModal] = useState(false)
-
 
364
  const [options, setOptions] = useState([])
363
  const labels = useSelector(({ intl }) => intl.labels)
365
  const labels = useSelector(({ intl }) => intl.labels)
364
  const options = useRef([])
-
 
365
  const dispatch = useDispatch()
366
  const dispatch = useDispatch()
Línea 366... Línea 367...
366
 
367
 
367
  const toggleConfirm = () => {
368
  const toggleConfirm = () => {
368
    setShowConfirmModal(!showConfirmModal)
369
    setShowConfirmModal(!showConfirmModal)
Línea 384... Línea 385...
384
  }
385
  }
Línea 385... Línea 386...
385
 
386
 
386
  useEffect(() => {
387
  useEffect(() => {
387
    if (deleteUrl) {
388
    if (deleteUrl) {
388
      const deleteOption = { action: toggleConfirm, label: labels.delete }
389
      const deleteOption = { action: toggleConfirm, label: labels.delete }
389
      options.current.concat(deleteOption)
390
      setOptions([...options, deleteOption])
390
    }
391
    }
Línea 391... Línea 392...
391
  }, [deleteUrl])
392
  }, [deleteUrl])
392
 
393
 
Línea 397... Línea 398...
397
          src={image}
398
          src={image}
398
          alt={name}
399
          alt={name}
399
          sx={{ width: '60px', height: '60px', marginRight: '.5rem' }}
400
          sx={{ width: '60px', height: '60px', marginRight: '.5rem' }}
400
        />
401
        />
401
        <div className="feed__info">
402
        <div className="feed__info">
402
          <a href={viewUrl}>
403
          <Link to={viewUrl}>
403
            <h2>{name}</h2>
404
            <h2>{name}</h2>
404
          </a>
405
          </Link>
405
          <div className="time__elapse">
406
          <div className="time__elapse">
406
            <p>{timeElapsed}</p>
407
            <p>{timeElapsed}</p>
407
            <AccessTimeIcon className="time__elapse-icon" />
408
            <AccessTimeIcon className="time__elapse-icon" />
408
          </div>
409
          </div>
409
        </div>
410
        </div>
410
      </div>
411
      </div>
411
      {!!options.current.length && <Options options={options.current} />}
412
      {!!options.length && <Options options={options} />}
412
      <ConfirmModal
413
      <ConfirmModal
413
        show={showConfirmModal}
414
        show={showConfirmModal}
414
        onClose={toggleConfirm}
415
        onClose={toggleConfirm}
415
        onAccept={onDelete}
416
        onAccept={onDelete}
416
      />
417
      />