import React from 'react'; import { CircleNotchIcon } from '@phosphor-icons/react'; import { Hero } from '../components/catalog/Hero'; import { Shelf } from '../components/catalog/Shelf'; import { ContinueCard, CourseCard, TrailPoster } from '../components/catalog/Artwork'; import { useCatalog } from '../context/CatalogContext'; import { useAuth } from '../context/AuthContext'; import { paths } from '../lib/routes'; import { useIsMobile } from '../hooks/useMediaQuery'; export const ExplorePage: React.FC = () => { const { courses, paths: trails, areas, isLoading, failed } = useCatalog(); const { user } = useAuth(); const isMobile = useIsMobile(); const going = user ? courses.filter((course) => (course.progress || 0) > 0 && (course.progress || 0) < 100) : []; const mostWatched = courses.length > 0 && ( {[...courses].sort((a, b) => (b.views || 0) - (a.views || 0)).slice(0, 10).map((course) => )} ); const trailsShelf = trails.length > 0 && ( {trails.map((trail) => )} ); return ( <>
{isLoading &&
} {!isLoading && failed &&

Não foi possível carregar os cursos. Tente novamente em instantes.

} {!isLoading && !failed && courses.length === 0 &&

Ainda não há cursos publicados.

} {going.length > 0 && ( {going.map((course) => )} )} {isMobile ? <>{trailsShelf}{mostWatched} : <>{mostWatched}{trailsShelf}} {areas.map((area) => ( {courses.filter((course) => course.category === area).map((course) => )} ))}
); };