diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 08f38a8..7499df9 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -1,4 +1,14 @@ -import React, {FC, useState, useEffect} from 'react'; +import React, {FC} from 'react'; +// Redux +import {compose} from '@reduxjs/toolkit'; +import {firestoreConnect} from 'react-redux-firebase'; +import {connect} from 'react-redux'; +import {RootState} from '../store'; +// Routing +import {Link, useParams} from 'react-router-dom'; +import Routes from '../constants/routes'; +import NotFound from './NotFound'; +// Style import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import { faGithub, @@ -15,18 +25,12 @@ import { faEye, faCodeBranch, } from '@fortawesome/free-solid-svg-icons'; +// Typing import Dev from '../models/Dev'; import Experience from '../types/Experience'; import {getTimePeriod} from '../types/TimePeriod'; import Education from '../types/Education'; import Repo from '../types/Repo'; -import {compose} from '@reduxjs/toolkit'; -import {firestoreConnect} from 'react-redux-firebase'; -import {connect} from 'react-redux'; -import {RootState} from '../store'; -import Routes from '../constants/routes'; -import {Link, useParams, Redirect} from 'react-router-dom'; -import NotFound from './NotFound'; interface IProps { dev: Dev; @@ -59,7 +63,9 @@ const Profile: FC = ({dev}) => { } }; - return ( + return dev === undefined ? ( +
Loading ...
+ ) : (
Back to profiles @@ -72,11 +78,11 @@ const Profile: FC = ({dev}) => { alt="Some guy" className="round-img my-1" /> -

{dev?.displayName}

-

{dev?.description}

-

{dev?.location}

+

{dev.displayName}

+

{dev.description}

+

{dev.location}

- {/* {Object.entries(dev?.links).map(([icon, webAddress], i: number) => ( + {/* {Object.entries(dev.links).map(([icon, webAddress], i: number) => ( @@ -85,12 +91,12 @@ const Profile: FC = ({dev}) => {
-

{`${dev?.displayName}'s Bio`}

-

{dev?.bio}

+

{`${dev.displayName}'s Bio`}

+

{dev.bio}

Skill Set

- {dev?.skills?.map((s: string, i: number) => ( + {dev.skills?.map((s: string, i: number) => (
{s}
@@ -100,7 +106,7 @@ const Profile: FC = ({dev}) => {

Experiences

- {dev?.experiences?.map((exp: Experience, i: number) => ( + {dev.experiences?.map((exp: Experience, i: number) => (

{exp.company}

{getTimePeriod(exp.from, exp.to)}

@@ -118,7 +124,7 @@ const Profile: FC = ({dev}) => {

Education

- {dev?.educations?.map((edu: Education, i: number) => ( + {dev.educations?.map((edu: Education, i: number) => (

{edu.school}

{getTimePeriod(edu.from, edu.to)}

@@ -143,7 +149,7 @@ const Profile: FC = ({dev}) => { GitHub Repos - {dev?.repos?.map((r: Repo, i: number) => ( + {dev.repos?.map((r: Repo, i: number) => (