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

add bid stats to the profile bid list #28

Merged
merged 4 commits into from
Dec 11, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
15 changes: 14 additions & 1 deletion src/Components/BidListResultsCard/BidContent/BidContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
import BidStatus from '../BidStatus';
import BidCount from '../../BidCount';
import { BID_STATISTICS_OBJECT } from '../../../Constants/PropTypes';

const BidContent = ({ status, positionNumber, postName, positionTitle }) => (
const BidContent = ({ status, positionNumber, postName, positionTitle, bidStatistics }) => (
<div className="usa-grid-full bid-content-container">
<BidStatus status={status} positionTitle={positionTitle} />
{
bidStatistics &&
<span className="bid-stats">
<BidCount bidStatistics={bidStatistics} altStyle label="Bid Count" />
</span>
}
<div>
<span className="bid-list-card-title-position">Position number </span>
<Link to={`/details/${positionNumber}`}>
Expand All @@ -24,6 +32,11 @@ BidContent.propTypes = {
positionNumber: PropTypes.string.isRequired,
postName: PropTypes.string.isRequired,
positionTitle: PropTypes.string.isRequired,
bidStatistics: BID_STATISTICS_OBJECT,
};

BidContent.defaultProps = {
bidStatistics: null,
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { shallow } from 'enzyme';
import toJSON from 'enzyme-to-json';
import { APPROVED } from '../../../Constants/BidStatuses';
import BidContent from './BidContent';
import bidStatistics from '../../../__mocks__/bidStatistics';

describe('BidContentComponent', () => {
it('is defined', () => {
Expand All @@ -12,6 +13,7 @@ describe('BidContentComponent', () => {
positionNumber="055A45"
postName="Paris"
positionTitle="Title"
bidStatistics={bidStatistics.result}

Choose a reason for hiding this comment

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

Doesn't look like result is property. I think you can just do bidStatistics={bidStatistics}.

Copy link
Author

Choose a reason for hiding this comment

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

ah good catch, i was looking at the other export from the mock file

/>,
);
expect(wrapper).toBeDefined();
Expand Down
15 changes: 9 additions & 6 deletions src/Components/BidListResultsCard/BidListResultsCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ class BidListResultsCard extends Component {
<InformationDataPoint
titleOnBottom
content={
<BidContent
positionTitle={bid.position.title}
status={bid.status}
positionNumber={bid.position.position_number}
postName={bid.post || NO_POST}
/>
<div>
<BidContent
positionTitle={bid.position.title}
status={bid.status}
positionNumber={bid.position.position_number}
postName={bid.post || NO_POST}
bidStatistics={bid.position.bid_statistics[0]}
/>
</div>
}
title={contentTitle}
/>
Expand Down
27 changes: 25 additions & 2 deletions src/Components/BidListResultsCard/BidListResultsCard.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,30 @@ import { SUBMITTED, DRAFT } from '../../Constants/BidStatuses';
import BidListResultsCard from './BidListResultsCard';

describe('BidListResultsCardComponent', () => {
const bid = { id: 1, status: SUBMITTED.property, post: 'Paris', position: { id: 2, position_number: '05A', title: 'AO' } };
const bid = {
id: 1,
status: SUBMITTED.property,
post: 'Paris',
position: {
id: 2,
position_number: '05A',
title: 'AO',
bid_statistics: [{
id: 4,
bidcycle: 'Demo BidCycle 2018-01-10 15:52:20.583434',
user: 'Jenny Townpost',
draft: 3,
submitted: 4,
handshake_offered: 3,
handshake_accepted: 0,
handshake_declined: 0,
in_panel: 0,
approved: 0,
declined: 0,
closed: 0,
}],
},
};
it('is defined', () => {
const wrapper = shallow(
<BidListResultsCard
Expand All @@ -21,7 +44,7 @@ describe('BidListResultsCardComponent', () => {
it('can receive props', () => {
const wrapper = shallow(
<BidListResultsCard
bid={bid}
bid={{ ...bid, post: null, update_date: '01/02/2000', create_date: '01/01/2000' }}
toggleBidPosition={() => {}}
submitBid={() => {}}
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,30 @@ exports[`BidListResultsCardComponent matches snapshot 1`] = `
<InformationDataPoint
className=""
content={
<BidContent
positionNumber="05A"
positionTitle="AO"
postName="Paris"
status="submitted"
/>
<div>
<BidContent
bidStatistics={
Object {
"approved": 0,
"bidcycle": "Demo BidCycle 2018-01-10 15:52:20.583434",
"closed": 0,
"declined": 0,
"draft": 3,
"handshake_accepted": 0,
"handshake_declined": 0,
"handshake_offered": 3,
"id": 4,
"in_panel": 0,
"submitted": 4,
"user": "Jenny Townpost",
}
}
positionNumber="05A"
positionTitle="AO"
postName="Paris"
status="submitted"
/>
</div>
}
sideBySide={false}
title={null}
Expand Down
8 changes: 8 additions & 0 deletions src/sass/_bidCount.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,13 @@
border-right: solid;
border-right-width: $border-width;
}

.bid-count-list-item:nth-child(odd) {
border-radius: 5px 0 0 5px;
}

.bid-count-list-item:nth-child(even) {
border-radius: 0 5px 5px 0;
}
}
}
13 changes: 13 additions & 0 deletions src/sass/_profile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,19 @@ $padding-no-border: $total-padding - $border;
.saved-search-card {
position: relative;

.bid-stats {
float: right;
font-size: 90%;
burgwyn marked this conversation as resolved.
Show resolved Hide resolved

.bid-count-container {

.bid-count-label {
float: none;
}

}
}

.bid-list-card-title-position {
font-weight: bold;
text-transform: uppercase;
Expand Down