Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client dashboard - Language History TM-2290 #1706

Merged
merged 15 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions src/Components/ProfileDashboard/Languages/Languages.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import PropTypes from 'prop-types';
import { format, isValid } from 'date-fns-v2';
import { get } from 'lodash';
import SectionTitle from '../SectionTitle';
import InformationDataPoint from '../InformationDataPoint';

const Languages = props => {
const { languagesArray } = props;
const languagesArray$ = languagesArray || [];

const getTestDate = (langObj) => {
const testDate = get(langObj, 'test_date') || '';
return isValid(new Date(testDate)) ? format(new Date(testDate), 'P') : '--/--/----';
scott062 marked this conversation as resolved.
Show resolved Hide resolved
};

return (
<div className="usa-grid-full profile-section-container languages-container">
<div className="usa-grid-full section-padded-inner-container">
<div className="usa-width-one-whole">
<SectionTitle title="Language History" len={languagesArray$.length} icon="language" />
</div>
{
!languagesArray$.length &&
<div>No language history</div>
}
<div className="languages-list-container">
{languagesArray.map(l => (
<>
{
get(l, 'language') ?
<InformationDataPoint
title={get(l, 'language') || 'N/A'}
content={
<div className="language-details">
{`Reading: ${get(l, 'reading_score') || '--'} | Speaking: ${get(l, 'speaking_score') || '--'}`}
<span>{`Test Date: ${getTestDate(l)}`}</span>
</div>
}
/> : <></>
}
</>
))}
</div>
</div>
</div>
);
};

Languages.propTypes = {
languagesArray: PropTypes.arrayOf(
PropTypes.shape(
{
language: PropTypes.string,
reading_score: PropTypes.string,
speaking_score: PropTypes.string,
test_date: PropTypes.string,
},
),
),
};

Languages.defaultProps = {
languagesArray: [],
};

export default Languages;
1 change: 1 addition & 0 deletions src/Components/ProfileDashboard/Languages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Languages';
84 changes: 48 additions & 36 deletions src/Components/ProfileDashboard/ProfileDashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import SavedSearches from './SavedSearches/SavedSearchesWrapper';
import BackButton from '../BackButton';
import BoxShadow from '../BoxShadow';
import Classifications from './Classifications';
import Languages from './Languages';

const useCDOBidding = () => checkFlag('flags.cdo_bidding');


const ProfileDashboard = ({
userProfile, isLoading, notifications, isPublic,
notificationsIsLoading, bidList, bidListIsLoading, favoritePositions, favoritePositionsIsLoading,
Expand Down Expand Up @@ -120,46 +122,56 @@ const ProfileDashboard = ({
</div>
}
{
isPublic && showClassifications && !userClassificationsHasErrored &&
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broke out isPublic logic to encapsulate all the other checks - deleted lines 139

<Column
columns={columns[1]}
className="user-dashboard-section-container user-dashboard-column-2"
>
<BoxShadow className="usa-width-one-whole user-dashboard-section assignments-section">
<Classifications
classifications={classifications}
clientClassifications={clientClassifications}
userId={userProfile.perdet_seq_number}
isPublic={isPublic}
/>
</BoxShadow>
</Column>
}
{
isPublic && (showAssignmentHistory || showBidTracker) &&
<Column
columns={columns[2]}
className="user-dashboard-section-container user-dashboard-column-3"
>
{
showBidTracker &&
<BoxShadow className="usa-width-one-whole user-dashboard-section bidlist-section">
<BidList
bids={bidList}
isPublic={isPublic}
registerHandshake={registerHandshake}
unregisterHandshake={unregisterHandshake}
userId={userProfile.perdet_seq_number}
isPublic &&
<>
<Column
columns={columns[1]}
className="user-dashboard-section-container user-dashboard-column-2"
>
{
showClassifications && !userClassificationsHasErrored &&
<BoxShadow className="usa-width-one-whole user-dashboard-section assignments-section">
<Classifications
classifications={classifications}
clientClassifications={clientClassifications}
userId={userProfile.perdet_seq_number}
isPublic={isPublic}
/>
</BoxShadow>
}
<BoxShadow className="usa-width-one-whole user-dashboard-section favorites-section">
<Languages
languagesArray={userProfile.languages}
/>
</BoxShadow>
}
</Column>
{
showAssignmentHistory &&
<BoxShadow className="usa-width-one-whole user-dashboard-section assignments-section">
<Assignments assignments={userProfile.assignments} />
</BoxShadow>
(showAssignmentHistory || showBidTracker) &&
<Column
columns={columns[2]}
className="user-dashboard-section-container user-dashboard-column-3"
>
{
showBidTracker &&
<BoxShadow className="usa-width-one-whole user-dashboard-section bidlist-section">
<BidList
bids={bidList}
isPublic={isPublic}
registerHandshake={registerHandshake}
unregisterHandshake={unregisterHandshake}
userId={userProfile.perdet_seq_number}
/>
</BoxShadow>
}
{
showAssignmentHistory &&
<BoxShadow className="usa-width-one-whole user-dashboard-section assignments-section">
<Assignments assignments={userProfile.assignments} />
</BoxShadow>
}
</Column>
}
</Column>
</>
}
</Row>
);
Expand Down
6 changes: 6 additions & 0 deletions src/sass/_languages.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.language-details {
span {
font-style: italic;
float: right;
}
}
1 change: 1 addition & 0 deletions src/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@
@import 'availableBidders';
@import 'handshakeStatus';
@import 'handshakeModal';
@import 'languages';