feat(client, api): Add Camper Join Date to Profile (#38408)
This commit is contained in:
@@ -37,6 +37,7 @@ const propTypes = {
|
||||
isLinkedIn: PropTypes.bool,
|
||||
isTwitter: PropTypes.bool,
|
||||
isWebsite: PropTypes.bool,
|
||||
joinDate: PropTypes.string,
|
||||
linkedin: PropTypes.string,
|
||||
location: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
@@ -114,6 +115,7 @@ function renderProfile(user) {
|
||||
website,
|
||||
name,
|
||||
username,
|
||||
joinDate,
|
||||
location,
|
||||
points,
|
||||
picture,
|
||||
@@ -133,6 +135,7 @@ function renderProfile(user) {
|
||||
isLinkedIn={isLinkedIn}
|
||||
isTwitter={isTwitter}
|
||||
isWebsite={isWebsite}
|
||||
joinDate={showAbout ? joinDate : null}
|
||||
linkedin={linkedin}
|
||||
location={showLocation ? location : null}
|
||||
name={showName ? name : null}
|
||||
|
@@ -32,6 +32,7 @@ const userProps = {
|
||||
isLinkedIn: true,
|
||||
isTwitter: true,
|
||||
isWebsite: true,
|
||||
joinDate: 'string',
|
||||
linkedin: 'string',
|
||||
location: 'string',
|
||||
name: 'string',
|
||||
|
@@ -2,7 +2,11 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Col, Row, Image } from '@freecodecamp/react-bootstrap';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faAward, faHeart } from '@fortawesome/free-solid-svg-icons';
|
||||
import {
|
||||
faAward,
|
||||
faHeart,
|
||||
faCalendar
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
import Identicon from 'react-identicons';
|
||||
|
||||
import SocialIcons from './SocialIcons';
|
||||
@@ -17,6 +21,7 @@ const propTypes = {
|
||||
isLinkedIn: PropTypes.bool,
|
||||
isTwitter: PropTypes.bool,
|
||||
isWebsite: PropTypes.bool,
|
||||
joinDate: PropTypes.string,
|
||||
linkedin: PropTypes.string,
|
||||
location: PropTypes.string,
|
||||
name: PropTypes.string,
|
||||
@@ -46,6 +51,13 @@ function joinArray(array) {
|
||||
});
|
||||
}
|
||||
|
||||
function parseDate(joinDate) {
|
||||
joinDate = new Date(joinDate);
|
||||
const year = joinDate.getFullYear();
|
||||
const month = joinDate.toLocaleString('en-US', { month: 'long' });
|
||||
return `Joined ${month} ${year}`;
|
||||
}
|
||||
|
||||
function Camper({
|
||||
name,
|
||||
username,
|
||||
@@ -60,6 +72,7 @@ function Camper({
|
||||
isGithub,
|
||||
isTwitter,
|
||||
isWebsite,
|
||||
joinDate,
|
||||
linkedin,
|
||||
twitter,
|
||||
website
|
||||
@@ -110,6 +123,11 @@ function Camper({
|
||||
</p>
|
||||
)}
|
||||
{about && <p className='bio text-center'>{about}</p>}
|
||||
{joinDate && (
|
||||
<p className='bio text-center'>
|
||||
<FontAwesomeIcon icon={faCalendar} /> {parseDate(joinDate)}
|
||||
</p>
|
||||
)}
|
||||
{yearsTopContributor.filter(Boolean).length > 0 && (
|
||||
<div>
|
||||
<br />
|
||||
|
Reference in New Issue
Block a user