Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3554 Rev 3571
Línea 1... Línea 1...
1
import React from 'react';
1
import React from 'react';
2
import { useParams } from 'react-router-dom';
2
import { useNavigate, useParams } from 'react-router-dom';
3
import { Box, Typography } from '@mui/material';
3
import { Box, Button, Typography } from '@mui/material';
Línea 4... Línea 4...
4
 
4
 
5
import { useCapsule } from '@microlearning/hooks';
5
import { useCapsule } from '@microlearning/hooks';
Línea -... Línea 6...
-
 
6
import { parse } from '@shared/utils';
-
 
7
 
-
 
8
import {
-
 
9
  Card,
-
 
10
  CardActions,
-
 
11
  CardContent,
-
 
12
  CardMedia,
6
import { parse } from '@shared/utils';
13
  CommentList,
7
 
14
  Spinner
-
 
15
} from '@shared/components';
Línea 8... Línea 16...
8
import { Card, CardContent, CardMedia, CommentList, Spinner } from '@shared/components';
16
import { CapsuleCommentForm, SlideForm } from '@microlearning/components';
9
import { CapsuleCommentForm } from '@microlearning/components';
17
import { useModal } from '@shared/hooks';
-
 
18
 
Línea 10... Línea 19...
10
 
19
export function CapsuleDetailsPage() {
Línea -... Línea 20...
-
 
20
  const { uuid } = useParams();
-
 
21
  const navigate = useNavigate();
-
 
22
 
-
 
23
  const { capsule, loading, addComment, deleteComment } = useCapsule(uuid);
-
 
24
 
-
 
25
  const { showModal } = useModal();
-
 
26
 
-
 
27
  const showContent = () => {
-
 
28
    if (capsule.slides.length === 0) return;
-
 
29
    if (capsule.slides.length > 1 || capsule.slides[0].type !== 'video') {
-
 
30
      return navigate(`/microlearning/capsules/${uuid}`);
11
export function CapsulePage() {
31
    }
Línea 12... Línea 32...
12
  const { uuid } = useParams();
32
    const firstSlide = capsule.slides[0];
13
 
33
    showModal(firstSlide.name, <SlideForm slideUuid={firstSlide.uuid} />);
14
  const { capsule, loading, addComment, deleteComment } = useCapsule(uuid);
34
  };
Línea 33... Línea 53...
33
        <Box sx={{ mt: 1, display: 'flex', flexDirection: 'column', gap: 1 }}>
53
        <Box sx={{ mt: 1, display: 'flex', flexDirection: 'column', gap: 1 }}>
34
          <CapsuleCommentForm onSubmit={addComment} />
54
          <CapsuleCommentForm onSubmit={addComment} />
35
          <CommentList comments={capsule.comments} onDelete={deleteComment} />
55
          <CommentList comments={capsule.comments} onDelete={deleteComment} />
36
        </Box>
56
        </Box>
37
      </CardContent>
57
      </CardContent>
-
 
58
 
-
 
59
      <CardActions>
-
 
60
        {capsule.slides.length > 0 && (
-
 
61
          <Button variant='contained' color='primary' onClick={showContent}>
-
 
62
            Ver contenido
-
 
63
          </Button>
-
 
64
        )}
-
 
65
      </CardActions>
38
    </Card>
66
    </Card>
39
  );
67
  );
40
}
68
}