Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3481 Rev 3482
Línea 1... Línea 1...
1
import React, { useEffect } from 'react';
1
import React from 'react';
2
import { useParams } from 'react-router-dom';
2
import { useParams } from 'react-router-dom';
3
import { connect } from 'react-redux';
-
 
Línea 4... Línea -...
4
 
-
 
5
import { addSlide } from '@app/redux/micro-learning/topics.actions';
3
 
Línea 6... Línea 4...
6
import { useFetch } from '@hooks';
4
import { useFetch } from '@shared/hooks';
7
 
5
 
8
import Spinner from '@app/components/UI/Spinner';
-
 
9
import Slides from '@microlearning/components/Slides';
-
 
10
import MicrolearningLayout from '@app/layouts/micro-learning/GoBack';
-
 
11
 
-
 
12
const CapsuleSlidesPage = ({ addSlide }) => {
-
 
13
  const { capsuleId } = useParams();
-
 
14
  const { data: capsule } = useFetch(`/microlearning/get-capsule/${capsuleId}`, {});
-
 
15
  const { data: slides, isLoading } = useFetch(capsule?.link_slides, []);
-
 
16
 
-
 
17
  useEffect(() => {
-
 
Línea -... Línea 6...
-
 
6
import { Grid, PageHeader, Spinner } from '@shared/components';
18
    slides.forEach((slide) => addSlide({ ...slide, capsuleId }));
7
import { SlideCard } from '@microlearning/components';
19
  }, [slides]);
8
 
-
 
9
export function CapsulePage() {
20
 
10
  const { uuid } = useParams();
-
 
11
  const { data: capsule, loading } = useFetch(`/microlearning/capsules/${uuid}`);
21
  return (
12
 
22
    <MicrolearningLayout title={capsule?.name || ''}>
13
  /* const handleShowCarousel = (index = 0) => {
23
      {isLoading ? <Spinner /> : <Slides capsuleId={capsuleId} />}
14
    setCurrentSlideIndex(index);
-
 
15
    setShowCarousel(true);
-
 
16
  };
-
 
17
 
-
 
18
  const handleHideCarousel = () => {
Línea 24... Línea -...
24
    </MicrolearningLayout>
-
 
25
  );
19
    setCurrentSlideIndex(0);
26
};
-
 
Línea -... Línea 20...
-
 
20
    setShowCarousel(false);
-
 
21
  }; */
-
 
22
 
-
 
23
  if (loading || !capsule) return <Spinner />;
-
 
24
 
-
 
25
  return (
27
 
26
    <>
-
 
27
      <PageHeader title={capsule.name} goBack />
-
 
28
      <Grid
-
 
29
        items={capsule.slides}
-
 
30
        emptyMessage='No hay cápsulas para mostrar'
-
 
31
        renderItem={(slide) => <SlideCard slide={slide} />}
-
 
32
      />
-
 
33
      {/* <SlidesCarousel
-
 
34
        onClose={handleHideCarousel}
-
 
35
        slides={filteredSlides}
-
 
36
        show={showCarousel}