Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3481 | Rev 3488 | 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 { useDispatch } from 'react-redux';
2
import { Link } from 'react-router-dom';
3
import { Typography } from '@mui/material';
-
 
Línea 4... Línea 3...
4
 
3
 
5
import { useMicroLearning, useFetch } from '@hooks';
-
 
Línea 6... Línea 4...
6
import { addTopic } from '../../../redux/micro-learning/topics.actions';
4
import { useFetch } from '@shared/hooks';
7
 
5
 
Línea 8... Línea 6...
8
import Spinner from 'components/UI/Spinner';
6
import { Grid, PageHeader, Spinner } from '@shared/components';
9
import Topics from 'components/micro-learning/Topics';
-
 
10
 
7
import { TopicCard } from '@microlearning/components';
11
const TopicsPage = () => {
-
 
12
  const { link_topics: linkTopics } = useMicroLearning();
8
 
13
  const { data: topics, isLoading } = useFetch(linkTopics, []);
-
 
14
  const dispatch = useDispatch();
9
const TopicsPage = () => {
15
 
-
 
Línea 16... Línea 10...
16
  useEffect(() => {
10
  const { data: topics, loading } = useFetch('/microlearning/topics');
17
    topics.forEach((topic) => dispatch(addTopic(topic)));
11
 
18
  }, [topics]);
12
  if (loading || !topics) return <Spinner />;
19
 
13
 
-
 
14
  return (
-
 
15
    <>
-
 
16
      <PageHeader title='Temas' />
-
 
17
      <Grid
-
 
18
        items={topics}
20
  return (
19
        emptyMessage='No hay temas para mostrar'
-
 
20
        keyExtractor='uuid'
-
 
21
        renderItem={(topic) => (
-
 
22
          <Link to={topic.uuid}>
21
    <>
23
            <TopicCard topic={topic} />
22
      <Typography variant='h1'>Topicos</Typography>
24
          </Link>
23
 
25
        )}
Línea 24... Línea 26...
24
      {isLoading ? <Spinner /> : <Topics />}
26
      />