import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { Grid, Row, Col } from '@freecodecamp/react-bootstrap'; import Helmet from 'react-helmet'; import Link from '../helpers/Link'; import { CurrentChallengeLink, FullWidthRow, Spacer } from '../helpers'; import Camper from './components/Camper'; import HeatMap from './components/HeatMap'; import Certifications from './components/Certifications'; import Portfolio from './components/Portfolio'; import Timeline from './components/TimeLine'; const propTypes = { isSessionUser: PropTypes.bool, user: PropTypes.shape({ profileUI: PropTypes.shape({ isLocked: PropTypes.bool, showAbout: PropTypes.bool, showCerts: PropTypes.bool, showHeatMap: PropTypes.bool, showLocation: PropTypes.bool, showName: PropTypes.bool, showPoints: PropTypes.bool, showPortfolio: PropTypes.bool, showTimeLine: PropTypes.bool }), calendar: PropTypes.object, streak: PropTypes.shape({ current: PropTypes.number, longest: PropTypes.number }), completedChallenges: PropTypes.array, portfolio: PropTypes.array, about: PropTypes.string, githubProfile: PropTypes.string, isGithub: PropTypes.bool, isLinkedIn: PropTypes.bool, isTwitter: PropTypes.bool, isWebsite: PropTypes.bool, linkedin: PropTypes.string, location: PropTypes.string, name: PropTypes.string, picture: PropTypes.string, points: PropTypes.number, twitter: PropTypes.string, username: PropTypes.string, website: PropTypes.string, yearsTopContributor: PropTypes.array }) }; function renderMessage(isSessionUser, username) { return isSessionUser ? (

You have not made your portfolio public.

You need to change your privacy setting in order for your portfolio to be seen by others. This is a preview of how your portfolio will look when made public.

) : (

{username} has not made their portfolio public.

{username} needs to change their privacy setting in order for you to view their portfolio.

Take me to the Challenges
); } function renderProfile(user) { const { profileUI: { showAbout = false, showCerts = false, showHeatMap = false, showLocation = false, showName = false, showPoints = false, showPortfolio = false, showTimeLine = false }, calendar, completedChallenges, streak, githubProfile, isLinkedIn, isGithub, isTwitter, isWebsite, linkedin, twitter, website, name, username, location, points, picture, portfolio, about, yearsTopContributor } = user; return ( {showHeatMap ? : null} {showCerts ? : null} {showPortfolio ? : null} {showTimeLine ? ( ) : null} ); } function Profile({ user, isSessionUser }) { const { profileUI: { isLocked = true }, username } = user; return ( Profile | freeCodeCamp.org {isSessionUser ? ( Update my settings ) : null} {isLocked ? renderMessage(isSessionUser, username) : null} {!isLocked || isSessionUser ? renderProfile(user) : null} {isSessionUser ? null : ( Report This User )} ); } Profile.displayName = 'Profile'; Profile.propTypes = propTypes; export default Profile;