Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6375 Rev 6390
Línea 12... Línea 12...
12
import { addNotification } from '../../../../redux/notification/notification.actions'
12
import { addNotification } from '../../../../redux/notification/notification.actions'
13
import { openShareModal } from '../../../../redux/share-modal/shareModal.actions'
13
import { openShareModal } from '../../../../redux/share-modal/shareModal.actions'
14
import { shareModalTypes } from '../../../../redux/share-modal/shareModal.types'
14
import { shareModalTypes } from '../../../../redux/share-modal/shareModal.types'
15
import { feedTypes } from '../../../../redux/feed/feed.types'
15
import { feedTypes } from '../../../../redux/feed/feed.types'
16
import FeedCommentSection from '../../../components/feed/feed-comment/FeedCommentSection'
16
import FeedCommentSection from '../../../components/feed/feed-comment/FeedCommentSection'
17
import { connect, useDispatch } from 'react-redux'
17
import { connect, useDispatch, useSelector } from 'react-redux'
18
import withExternalShare from './withExternalShare'
18
import withExternalShare from './withExternalShare'
19
import ConfirmModal from '../../../../shared/confirm-modal/ConfirmModal'
19
import ConfirmModal from '../../../../shared/confirm-modal/ConfirmModal'
20
import { deleteFeed } from '../../../../redux/feed/feed.actions'
20
import { deleteFeed } from '../../../../redux/feed/feed.actions'
21
import FeedModal from '../../../components/feed/FeedModal'
21
import FeedModal from '../../../components/feed/FeedModal'
22
import withReactions from '../../../components/feed/withReaction'
22
import withReactions from '../../../components/feed/withReaction'
23
import RecommendIcon from '@mui/icons-material/Recommend'
23
import RecommendIcon from '@mui/icons-material/Recommend'
24
import FavoriteIcon from '@mui/icons-material/FavoriteTwoTone'
24
import FavoriteIcon from '@mui/icons-material/FavoriteTwoTone'
25
import VolunteerActivismIcon from '@mui/icons-material/VolunteerActivism'
25
import VolunteerActivismIcon from '@mui/icons-material/VolunteerActivism'
26
import EmojiEmotionsIcon from '@mui/icons-material/EmojiEmotions'
26
import EmojiEmotionsIcon from '@mui/icons-material/EmojiEmotions'
27
import TungstenIcon from '@mui/icons-material/Tungsten'
27
import TungstenIcon from '@mui/icons-material/Tungsten'
-
 
28
import SurveyForm from '../../../components/survey-form/SurveyForm'
Línea 28... Línea 29...
28
 
29
 
29
const Feed = (props) => {
30
const Feed = (props) => {
30
  const {
31
  const {
31
    isShare = false,
32
    isShare = false,
Línea 74... Línea 75...
74
  const [totalComments, setTotalComments] = useState(owner_comments)
75
  const [totalComments, setTotalComments] = useState(owner_comments)
75
  const [externalShare, setExternalShare] = useState(owner_external_shared)
76
  const [externalShare, setExternalShare] = useState(owner_external_shared)
76
  const [sharedState, setSharedState] = useState(owner_shared)
77
  const [sharedState, setSharedState] = useState(owner_shared)
77
  const [showComments, setShowComments] = useState(false)
78
  const [showComments, setShowComments] = useState(false)
78
  const [showModal, setShowModal] = useState(false)
79
  const [showModal, setShowModal] = useState(false)
-
 
80
  const labels = useSelector(({ labels }) => labels)
Línea 79... Línea 81...
79
 
81
 
80
  const reactionsOptions = [
82
  const reactionsOptions = [
81
    {
83
    {
82
      type: 'r',
84
      type: 'r',
Línea 205... Línea 207...
205
            (owner_file_image || owner_file_video || owner_file_document) &&
207
            (owner_file_image || owner_file_video || owner_file_document) &&
206
            setShowModal(true)
208
            setShowModal(true)
207
          }
209
          }
208
        >
210
        >
209
          <Feed.Content
211
          <Feed.Content
210
            ownerDescription={owner_description}
212
            description={owner_description}
211
            ownerFileImage={owner_file_image}
213
            image={owner_file_image}
212
            ownerFileImagepreview={owner_file_image_preview}
214
            imagePreview={owner_file_image_preview}
213
            ownerFileVideo={owner_file_video}
215
            video={owner_file_video}
214
            ownerFileDocument={owner_file_document}
216
            document={owner_file_document}
215
            sharedItem={{
217
            sharedItem={{
216
              name: shared_name,
218
              name: shared_name,
217
              image: shared_image,
219
              image: shared_image,
218
              time_elapse: shared_time_elapse,
220
              time_elapse: shared_time_elapse,
219
              description: shared_description,
221
              description: shared_description,
Línea 241... Línea 243...
241
            <div
243
            <div
242
              className="d-inline-flex align-items-center"
244
              className="d-inline-flex align-items-center"
243
              style={{ gap: '5px' }}
245
              style={{ gap: '5px' }}
244
            >
246
            >
245
              {!!totalComments && (
247
              {!!totalComments && (
246
                <span>{`${totalComments} ${LABELS.COMMENTS.toLowerCase()}`}</span>
248
                <span>{`${totalComments} ${labels.COMMENTS.toLowerCase()}`}</span>
247
              )}
249
              )}
248
              {!!sharedState && (
250
              {!!sharedState && (
249
                <span>{`${sharedState} ${LABELS.SHARED.toLowerCase()}`}</span>
251
                <span>{`${sharedState} ${labels.SHARED.toLowerCase()}`}</span>
250
              )}
252
              )}
251
              {!!externalShare && (
253
              {!!externalShare && (
252
                <span>{`${externalShare} ${LABELS.SENDS.toLowerCase()}`}</span>
254
                <span>{`${externalShare} ${labels.SENDS.toLowerCase()}`}</span>
253
              )}
255
              )}
254
            </div>
256
            </div>
255
          </div>
257
          </div>
256
        )}
258
        )}
Línea 257... Línea 259...
257
 
259
 
258
        {!isShare && (
260
        {!isShare && (
259
          <div className="feed__buttons">
261
          <div className="feed__buttons">
260
            <WithReactionIcon withTitle />
262
            <WithReactionIcon withTitle />
261
            <InputOption
263
            <InputOption
262
              Icon={ChatOutlinedIcon}
264
              Icon={ChatOutlinedIcon}
263
              title={LABELS.COMMENT}
265
              title={labels.COMMENT}
264
              color="gray"
266
              color="gray"
265
              onClick={displayCommentSection}
267
              onClick={displayCommentSection}
266
              withTitle
268
              withTitle
267
            />
269
            />
268
            <InputOption
270
            <InputOption
269
              Icon={ShareOutlinedIcon}
271
              Icon={ShareOutlinedIcon}
270
              title={LABELS.SHARE}
272
              title={labels.SHARE}
271
              color="gray"
273
              color="gray"
272
              onClick={handleShare}
274
              onClick={handleShare}
273
              withTitle
275
              withTitle
274
            />
276
            />
Línea 290... Línea 292...
290
    </>
292
    </>
291
  )
293
  )
292
}
294
}
Línea 293... Línea 295...
293
 
295
 
294
const Content = ({
296
const Content = ({
295
  ownerDescription,
297
  description,
296
  ownerFileImage,
298
  image,
297
  ownerFileImagepreview,
299
  imagePreview,
298
  ownerFileVideo,
300
  video,
299
  ownerFileDocument,
301
  document,
-
 
302
  sharedItem,
300
  sharedItem,
303
  type,
301
}) => {
304
}) => {
-
 
305
  const [isReadMoreActive, setIsReadMoreActive] = useState(false)
Línea 302... Línea 306...
302
  const [isReadMoreActive, setIsReadMoreActive] = useState(false)
306
  const labels = useSelector(({ labels }) => labels)
Línea 303... Línea 307...
303
 
307
 
304
  const readMoreHandler = () => setIsReadMoreActive(!isReadMoreActive)
308
  const readMoreHandler = () => setIsReadMoreActive(!isReadMoreActive)
Línea 310... Línea 314...
310
      const shortenedText = parse(`${shortenedString}... `)
314
      const shortenedText = parse(`${shortenedString}... `)
311
      return (
315
      return (
312
        <>
316
        <>
313
          {isReadMoreActive ? fullText : shortenedText}
317
          {isReadMoreActive ? fullText : shortenedText}
314
          <span className="cursor-pointer" onClick={readMoreHandler}>
318
          <span className="cursor-pointer" onClick={readMoreHandler}>
315
            {isReadMoreActive ? LABELS.READ_LESS : LABELS.READ_MORE}
319
            {isReadMoreActive ? labels.READ_LESS : labels.READ_MORE}
316
          </span>
320
          </span>
317
        </>
321
        </>
318
      )
322
      )
319
    }
323
    }
320
    return <p>{fullText}</p>
324
    return <p>{fullText}</p>
321
  }
325
  }
Línea 322... Línea 326...
322
 
326
 
323
  return (
327
  return (
-
 
328
    <>
324
    <>
329
      {type !== 'fast-survey' ? (
-
 
330
        htmlParsedText(description)
325
      {ownerDescription && htmlParsedText(ownerDescription)}
331
      ) : (
-
 
332
        <SurveyForm
326
      {ownerFileImage && (
333
          active={description.active}
327
        <img src={ownerFileImage} className="Entradas" loading="lazy" />
334
          question={description.question}
328
      )}
335
          answers={[
329
      {ownerFileVideo && (
336
            description.answer1,
330
        <video
337
            description.answer2,
331
          src={ownerFileVideo}
338
            description.answer3,
332
          controls
339
            description.answer4,
333
          poster={ownerFileImagepreview}
340
            description.answer5,
-
 
341
          ]}
334
          preload="none"
342
          time={description.time_remaining}
335
        />
343
        />
-
 
344
      )}
-
 
345
      {image && <img src={image} className="Entradas" loading="lazy" />}
-
 
346
      {video && (
-
 
347
        <video src={video} controls poster={imagePreview} preload="none" />
336
      )}
348
      )}
337
      {ownerFileDocument && (
349
      {document && (
338
        <a href={ownerFileDocument} target="_blank" rel="noreferrer">
350
        <a href={document} target="_blank" rel="noreferrer">
339
          {LABELS.DOWNLOAD}
351
          {labels.DOWNLOAD}
340
        </a>
352
        </a>
341
      )}
353
      )}
342
      {sharedItem.name && (
354
      {sharedItem.name && (
343
        <div className="py-3 px-md-3">
355
        <div className="py-3 px-md-3">
Línea 369... Línea 381...
369
}) => {
381
}) => {
370
  const [showConfirmModal, setShowConfirmModal] = useState(false)
382
  const [showConfirmModal, setShowConfirmModal] = useState(false)
371
  const [displayOption, setDisplayOption] = useState(false)
383
  const [displayOption, setDisplayOption] = useState(false)
372
  const deleteButton = useRef()
384
  const deleteButton = useRef()
373
  const dispatch = useDispatch()
385
  const dispatch = useDispatch()
-
 
386
  const labels = useSelector(({ labels }) => labels)
Línea 374... Línea 387...
374
 
387
 
Línea 375... Línea 388...
375
  const handleShowConfirmModal = () => setShowConfirmModal(!showConfirmModal)
388
  const handleShowConfirmModal = () => setShowConfirmModal(!showConfirmModal)
376
 
389
 
Línea 433... Línea 446...
433
                  className="option-btn"
446
                  className="option-btn"
434
                  onClick={handleShowConfirmModal}
447
                  onClick={handleShowConfirmModal}
435
                  ref={deleteButton}
448
                  ref={deleteButton}
436
                >
449
                >
437
                  <i className="fa fa-trash-o mr-1" />
450
                  <i className="fa fa-trash-o mr-1" />
438
                  {LABELS.DELETE}
451
                  {labels.DELETE}
439
                </button>
452
                </button>
440
              </li>
453
              </li>
441
            </ul>
454
            </ul>
442
          </div>
455
          </div>
443
          <ConfirmModal
456
          <ConfirmModal
444
            show={showConfirmModal}
457
            show={showConfirmModal}
445
            onClose={() => handleShowConfirmModal(false)}
458
            onClose={() => handleShowConfirmModal(false)}
446
            onAccept={deleteFeedHandler}
459
            onAccept={deleteFeedHandler}
447
            acceptLabel={LABELS.ACCEPT}
460
            acceptLabel={labels.ACCEPT}
448
          />
461
          />
449
        </div>
462
        </div>
450
      )}
463
      )}
451
    </div>
464
    </div>
452
  )
465
  )