import { Container, Row, Col, Card, Button, ProgressBar } from 'react-bootstrap' import newBie from '../../../../assets/images/illustration/emptyJourney.png' import { Link, NavLink } from 'react-router-dom' import useDashboards from '../hooks/useDashboards' import { slugify } from '../../../../utils/Constant' import Skeleton from 'react-loading-skeleton' function validName(fullName) { const nameArray = fullName.split(' ') const firstTwoWords = nameArray.slice(0, 2).join(' ') return firstTwoWords } const Dashboard = () => { const { username } = JSON.parse(localStorage.getItem('userData')) const { journey, loading, error, thumbPath } = useDashboards() const noData = () => { return journey.lenght == 0 } if (error) { return
Error: {error.message}
} return (

Hi, {validName(username)} !

Let’s evolve together with adaptive learning tailored just for you.

Your Last Journey!

{loading ? ( <>
) : noData() ? (

Still new?

Begin your journey!

) : ( journey.map((data, index) => (
{data.NAME_SECTION} {data.DESCRIPTION_SECTION}
{( (data.COMPLETED_TOPICS / data.TOTAL_TOPICS) * 100 ).toFixed(0)} %

{data.COMPLETED_TOPICS} / {data.TOTAL_TOPICS} Topics

)) )}
) } export default Dashboard