Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3505 | Rev 3516 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
3481 stevensc 1
import React from 'react';
2
import { useParams } from 'react-router-dom';
3
 
4
import { useFetch } from '@shared/hooks';
5
 
6
import { Grid, PageHeader, Spinner } from '@shared/components';
7
import { CapsuleCard } from '@microlearning/components';
8
 
3505 stevensc 9
export function TopicPage() {
3481 stevensc 10
  const { uuid } = useParams();
3489 stevensc 11
  const { data: topic, loading } = useFetch(`/microlearning/topic/${uuid}`);
3515 stevensc 12
  const { data: capsules, loading: capsulesLoading } = useFetch(`/microlearning/capsules/${uuid}`);
3481 stevensc 13
 
3515 stevensc 14
  if (loading || capsulesLoading || !topic || !capsules) return <Spinner />;
3481 stevensc 15
 
16
  return (
17
    <>
18
      <PageHeader title={`${topic?.name} - Cápsulas`} goBack />
19
      <Grid
3515 stevensc 20
        items={capsules}
3481 stevensc 21
        emptyMessage='No hay cápsulas para mostrar'
22
        renderItem={(capsule) => <CapsuleCard capsule={capsule} />}
23
      />
24
    </>
25
  );
26
}