Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3481 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3481 Rev 3517
Línea 1... Línea 1...
1
import React, { useMemo } from 'react'
1
import React from 'react';
2
import { useSelector } from 'react-redux'
-
 
3
import { Link } from 'react-router-dom'
-
 
4
import { Typography } from '@mui/material'
-
 
Línea 5... Línea 2...
5
 
2
 
6
import { TopicContainer, TopicProgress, TopicsGrid } from './UI'
-
 
7
import EmptySection from 'components/UI/EmptySection'
-
 
8
 
-
 
9
const Capsules = ({ topicId = '' }) => {
-
 
10
  const capsules = useSelector(({ microlearning }) =>
-
 
11
    microlearning.capsulesAllIds.map((uuid) => microlearning.capsuleById[uuid])
-
 
12
  )
-
 
13
  const labels = useSelector(({ intl }) => intl.labels)
-
 
14
 
3
import { Card, CardContent, CardHeader, CardMedia } from '@shared/components';
15
  const filteredCapsules = useMemo(() => {
-
 
16
    if (!topicId) {
-
 
17
      return capsules
-
 
18
    }
-
 
19
 
-
 
20
    return capsules.filter((capsule) => capsule.topicId === topicId)
-
 
Línea -... Línea 4...
-
 
4
import { TopicProgress } from '.';
21
  }, [topicId, capsules])
5
 
22
 
6
export function CapsuleItem({ capsule: { name, image, progress } }) {
23
  return (
7
  return (
24
    <TopicsGrid>
8
    <Card>
25
      {filteredCapsules.length ? (
-
 
26
        filteredCapsules.map((capsule) => (
9
      <CardHeader title={name} />
27
          <Capsule key={capsule.uuid} capsule={capsule} />
10
      <CardMedia src={image} />
28
        ))
11
 
-
 
12
      <CardContent>
29
      ) : (
13
        <TopicProgress variant='determinate' value={progress} />
30
        <EmptySection message={labels.datatable_szerorecords} />
14
        <span>{`${progress}%`}</span>
31
      )}
15
      </CardContent>
32
    </TopicsGrid>
16
    </Card>
33
  )
-
 
34
}
-
 
35
 
-
 
36
const Capsule = ({ capsule }) => {
-
 
37
  const { name, image, progress, uuid } = capsule
-
 
38
 
-
 
39
  return (
-
 
40
    <Link to={`/microlearning/capsules/${uuid}/slides`}>
-
 
41
      <TopicContainer>
-
 
42
        <div className='c-header'>
-
 
43
          <Typography variant='h3'>{name}</Typography>
-
 
44
        </div>
-
 
45
 
-
 
46
        <img src={image} alt='' />
-
 
47
 
-
 
48
        <div className='c-footer'>
-
 
49
          <TopicProgress variant='determinate' value={progress} />
-
 
50
 
-
 
51
          <span>{`${progress}%`}</span>
-
 
52
        </div>
-
 
53
      </TopicContainer>
-
 
54
    </Link>
-
 
55
  )
-
 
56
}
-