import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { Alert, Button, Grid, Row, Col } from '@freecodecamp/react-bootstrap'; import Helmet from 'react-helmet'; import { Link } from 'gatsby'; import CurrentChallengeLink from '../helpers/CurrentChallengeLink'; import FullWidthRow from '../helpers/FullWidthRow'; import Spacer from '../helpers/Spacer'; 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 }), username: PropTypes.string }) }; function TakeMeToTheChallenges() { return ( Take me to the Challenges ); } function renderIsLocked(username) { return ( {username} | freeCodeCamp.org {username} has not made their profile public. {username} needs to change their privacy setting in order for you to view their profile ); } function renderSettingsButton() { return ( Update my settings ); } function Profile({ user, isSessionUser }) { const { profileUI: { isLocked = true, 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; if (isLocked) { return renderIsLocked(username); } return ( {username} | freeCodeCamp.org {isSessionUser ? renderSettingsButton() : null} {showHeatMap ? : null} {showCerts ? : null} {showPortfolio ? : null} {showTimeLine ? ( ) : null} ); } Profile.displayName = 'Profile'; Profile.propTypes = propTypes; export default Profile;
{username} needs to change their privacy setting in order for you to view their profile