Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 5011 Rev 5107
Línea 3... Línea 3...
3
import ThumbUpAltOutlinedIcon from '@mui/icons-material/ThumbUpAltOutlined'
3
import ThumbUpAltOutlinedIcon from '@mui/icons-material/ThumbUpAltOutlined'
4
import ThumbUpAltIcon from '@mui/icons-material/ThumbUpAlt'
4
import ThumbUpAltIcon from '@mui/icons-material/ThumbUpAlt'
5
import ChatOutlinedIcon from '@mui/icons-material/ChatOutlined'
5
import ChatOutlinedIcon from '@mui/icons-material/ChatOutlined'
6
import ShareOutlinedIcon from '@mui/icons-material/ShareOutlined'
6
import ShareOutlinedIcon from '@mui/icons-material/ShareOutlined'
7
import SendOutlinedIcon from '@mui/icons-material/SendOutlined'
7
import SendOutlinedIcon from '@mui/icons-material/SendOutlined'
8
import RecommendIcon from '@mui/icons-material/Recommend';
8
import RecommendIcon from '@mui/icons-material/Recommend'
9
import InputOption from './InputOption'
9
import InputOption from './InputOption'
10
import parse from 'html-react-parser'
10
import parse from 'html-react-parser'
11
import Avatar from '../../../../shared/Avatar/Avatar'
11
import Avatar from '../../../../shared/Avatar/Avatar'
12
import AccessTimeIcon from '@mui/icons-material/AccessTime';
12
import AccessTimeIcon from '@mui/icons-material/AccessTime'
13
import { axios } from '../../../../utils'
13
import { axios } from '../../../../utils'
14
import { addNotification } from '../../../../redux/notification/notification.actions'
14
import { addNotification } from '../../../../redux/notification/notification.actions'
15
import { openShareModal } from '../../../../redux/share-modal/shareModal.actions'
15
import { openShareModal } from '../../../../redux/share-modal/shareModal.actions'
16
import { shareModalTypes } from '../../../../redux/share-modal/shareModal.types'
16
import { shareModalTypes } from '../../../../redux/share-modal/shareModal.types'
17
import { feedTypes } from '../../../../redux/feed/feed.types'
17
import { feedTypes } from '../../../../redux/feed/feed.types'
Línea 21... Línea 21...
21
import ConfirmModal from '../../../../shared/confirm-modal/ConfirmModal'
21
import ConfirmModal from '../../../../shared/confirm-modal/ConfirmModal'
22
import { deleteFeed } from '../../../../redux/feed/feed.actions'
22
import { deleteFeed } from '../../../../redux/feed/feed.actions'
23
import FeedModal from '../../../components/feed/FeedModal'
23
import FeedModal from '../../../components/feed/FeedModal'
Línea 24... Línea 24...
24
 
24
 
25
const Feed = (props) => {
-
 
26
 
25
const Feed = (props) => {
27
  const {
26
  const {
28
    isShare = false,
27
    isShare = false,
29
    feed_unique,
28
    feed_unique,
30
    feed_is_liked,
29
    feed_is_liked,
Línea 57... Línea 56...
57
    owner_external_shared,
56
    owner_external_shared,
58
    shared_file_document,
57
    shared_file_document,
59
    shared_url,
58
    shared_url,
60
    feed_increment_external_counter_url,
59
    feed_increment_external_counter_url,
61
    addNotification, // REDUX ACTION
60
    addNotification, // REDUX ACTION
62
    openShareModal, // REDUX ACTION
61
    openShareModal // REDUX ACTION
63
  } = props;
62
  } = props
Línea 64... Línea 63...
64
 
63
 
65
  const [feedIsLiked, setFeedIsLiked] = useState(feed_is_liked);
64
  const [feedIsLiked, setFeedIsLiked] = useState(feed_is_liked)
66
  const [likesState, setLikesState] = useState(feed_likes);
65
  const [likesState, setLikesState] = useState(feed_likes)
67
  const [totalComments, setTotalComments] = useState(owner_comments);
66
  const [totalComments, setTotalComments] = useState(owner_comments)
68
  const [externalShare, setExternalShare] = useState(owner_external_shared);
67
  const [externalShare, setExternalShare] = useState(owner_external_shared)
69
  const [sharedState, setSharedState] = useState(owner_shared);
68
  const [sharedState, setSharedState] = useState(owner_shared)
70
  const [showComments, setShowComments] = useState(false);
69
  const [showComments, setShowComments] = useState(false)
Línea 71... Línea 70...
71
  const [showModal, setShowModal] = useState(false);
70
  const [showModal, setShowModal] = useState(false)
72
 
71
 
73
  const handleLike = (url) => {
72
  const handleLike = (url) => {
74
    axios.post(url)
73
    axios.post(url)
75
      .then(({ data: response }) => {
74
      .then(({ data: response }) => {
76
        if (!response.success) {
75
        if (!response.success) {
77
          addNotification({ style: "danger", msg: response.data })
76
          addNotification({ style: 'danger', msg: response.data })
78
          return
77
          return
79
        }
78
        }
80
        setLikesState(response.data.likes)
79
        setLikesState(response.data.likes)
81
        setFeedIsLiked(!feedIsLiked);
80
        setFeedIsLiked(!feedIsLiked)
Línea 82... Línea 81...
82
      });
81
      })
83
  };
82
  }
Línea 84... Línea 83...
84
 
83
 
Línea 93... Línea 92...
93
    title: 'Send',
92
    title: 'Send',
94
    shareUrl: feed_increment_external_counter_url,
93
    shareUrl: feed_increment_external_counter_url,
95
    setValue: handleExternalShare
94
    setValue: handleExternalShare
96
  })
95
  })
Línea 97... Línea 96...
97
 
96
 
Línea 98... Línea 97...
98
  useEffect(() => setSharedState(owner_shared), [owner_shared]);
97
  useEffect(() => setSharedState(owner_shared), [owner_shared])
99
 
98
 
100
  return (
99
  return (
101
    <>
100
    <>
Línea 125... Línea 124...
125
              description: shared_description,
124
              description: shared_description,
126
              file_video: shared_file_video,
125
              file_video: shared_file_video,
127
              file_image_preview: shared_file_image_preview,
126
              file_image_preview: shared_file_image_preview,
128
              file_image: shared_file_image,
127
              file_image: shared_file_image,
129
              file_document: shared_file_document,
128
              file_document: shared_file_document,
130
              shared_url: shared_url
129
              shared_url
131
            }}
130
            }}
132
          />
131
          />
133
        </div>
132
        </div>
Línea 134... Línea 133...
134
 
133
 
Línea 194... Línea 193...
194
  ownerFileImagepreview,
193
  ownerFileImagepreview,
195
  ownerFileVideo,
194
  ownerFileVideo,
196
  ownerFileDocument,
195
  ownerFileDocument,
197
  sharedItem
196
  sharedItem
198
}) => {
197
}) => {
199
  const [isReadMoreActive, setIsReadMoreActive] = useState(false);
198
  const [isReadMoreActive, setIsReadMoreActive] = useState(false)
Línea 200... Línea 199...
200
 
199
 
Línea 201... Línea 200...
201
  const readMoreHandler = () => setIsReadMoreActive(!isReadMoreActive)
200
  const readMoreHandler = () => setIsReadMoreActive(!isReadMoreActive)
202
 
201
 
203
  const htmlParsedText = (fullStringText) => {
202
  const htmlParsedText = (fullStringText) => {
204
    const fullText = parse(fullStringText)
203
    const fullText = parse(fullStringText)
205
    if (fullStringText.length > 500) {
204
    if (fullStringText.length > 500) {
206
      const shortenedString = fullStringText.substr(0, 500);
205
      const shortenedString = fullStringText.substr(0, 500)
207
      const shortenedText = parse(`${shortenedString}... `);
206
      const shortenedText = parse(`${shortenedString}... `)
208
      return (
207
      return (
209
        <>
208
        <>
210
          {isReadMoreActive ? fullText : shortenedText}
209
          {isReadMoreActive ? fullText : shortenedText}
211
          <span className='cursor-pointer' onClick={readMoreHandler}>
210
          <span className='cursor-pointer' onClick={readMoreHandler}>
212
            {isReadMoreActive ? " Leer menos" : " Leer más"}
211
            {isReadMoreActive ? ' Leer menos' : ' Leer más'}
213
          </span>
212
          </span>
214
        </>
213
        </>
215
      );
214
      )
216
    }
215
    }
Línea 217... Línea 216...
217
    return <p>{fullText}</p>
216
    return <p>{fullText}</p>
Línea 262... Línea 261...
262
  timeElapsed = '',
261
  timeElapsed = '',
263
  deleteUrl = '',
262
  deleteUrl = '',
264
  viewUrl = '',
263
  viewUrl = '',
265
  feedUnique = ''
264
  feedUnique = ''
266
}) => {
265
}) => {
267
  const [showConfirmModal, setShowConfirmModal] = useState(false);
266
  const [showConfirmModal, setShowConfirmModal] = useState(false)
268
  const [displayOption, setDisplayOption] = useState(false)
267
  const [displayOption, setDisplayOption] = useState(false)
269
  const deleteButton = useRef();
268
  const deleteButton = useRef()
270
  const dispatch = useDispatch()
269
  const dispatch = useDispatch()
Línea 271... Línea 270...
271
 
270
 
Línea 272... Línea 271...
272
  const handleShowConfirmModal = () => setShowConfirmModal(!showConfirmModal);
271
  const handleShowConfirmModal = () => setShowConfirmModal(!showConfirmModal)
273
 
272
 
274
  const deleteFeedHandler = () => {
273
  const deleteFeedHandler = () => {
275
    axios.post(deleteUrl)
274
    axios.post(deleteUrl)
276
      .then((res) => {
275
      .then((res) => {
277
        const { data } = res
276
        const { data } = res
278
        if (!data.success) {
277
        if (!data.success) {
279
          dispatch(addNotification({ style: "danger", msg: data.data }))
278
          dispatch(addNotification({ style: 'danger', msg: data.data }))
280
          return
279
          return
281
        }
280
        }
282
        dispatch(addNotification({ style: "success", msg: data.data }))
281
        dispatch(addNotification({ style: 'success', msg: data.data }))
283
        handleShowConfirmModal()
282
        handleShowConfirmModal()
284
        dispatch(deleteFeed(feedUnique));
283
        dispatch(deleteFeed(feedUnique))
Línea 285... Línea 284...
285
      });
284
      })
286
  };
285
  }
287
 
286
 
288
  useEffect(() => {
287
  useEffect(() => {
289
    const handleClickOutside = (event) => {
288
    const handleClickOutside = (event) => {
290
      if (deleteButton.current && !deleteButton.current.contains(event.target)) {
289
      if (deleteButton.current && !deleteButton.current.contains(event.target)) {
291
        setDisplayOption(false)
290
        setDisplayOption(false)
Línea 292... Línea 291...
292
      }
291
      }
293
    }
292
    }
294
    document.addEventListener("mousedown", handleClickOutside);
293
    document.addEventListener('mousedown', handleClickOutside)
295
 
294
 
Línea 296... Línea 295...
296
    return () => {
295
    return () => {
297
      document.removeEventListener("mousedown", handleClickOutside);
296
      document.removeEventListener('mousedown', handleClickOutside)
298
    };
297
    }
299
  }, [deleteButton]);
298
  }, [deleteButton])
Línea 335... Línea 334...
335
                  className="option-btn"
334
                  className="option-btn"
336
                  onClick={handleShowConfirmModal}
335
                  onClick={handleShowConfirmModal}
337
                  ref={deleteButton}
336
                  ref={deleteButton}
338
                >
337
                >
339
                  <i className="fa fa-trash-o mr-1" />
338
                  <i className="fa fa-trash-o mr-1" />
340
                  Borrar
339
                  {LABELS.}
341
                </button>
340
                </button>
342
              </li>
341
              </li>
343
            </ul>
342
            </ul>
344
          </div>
343
          </div>
345
          <ConfirmModal
344
          <ConfirmModal
346
            show={showConfirmModal}
345
            show={showConfirmModal}
347
            onClose={() => handleShowConfirmModal(false)}
346
            onClose={() => handleShowConfirmModal(false)}
348
            onAccept={deleteFeedHandler}
347
            onAccept={deleteFeedHandler}
349
            acceptLabel="Aceptar"
348
            acceptLabel={LABELS.ACCEPT}
350
          />
349
          />
351
        </div>}
350
        </div>}
352
    </div>
351
    </div>
353
  )
352
  )
354
}
353
}
Línea 356... Línea 355...
356
Feed.Content = Content
355
Feed.Content = Content
357
Feed.Header = Header
356
Feed.Header = Header
Línea 358... Línea 357...
358
 
357
 
359
const mapDispatchToProps = {
358
const mapDispatchToProps = {
360
  addNotification: (notification) => addNotification(notification),
359
  addNotification: (notification) => addNotification(notification),
361
  openShareModal: (postUrl, modalType, feedType) => openShareModal(postUrl, modalType, feedType),
360
  openShareModal: (postUrl, modalType, feedType) => openShareModal(postUrl, modalType, feedType)
Línea 362... Línea -...
362
};
-
 
363
 
361
}
-
 
362