Skip to content

Commit

Permalink
Merge pull request #466 from MetaPhase-Consulting/feature/bid_count_flag
Browse files Browse the repository at this point in the history
Add bid_count feature flag to differentiate from bidding flag
  • Loading branch information
mjoyce91 committed Nov 1, 2019
2 parents a6990f2 + b11d464 commit d0eed5c
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 55 deletions.
1 change: 1 addition & 0 deletions public/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"notifications": true,
"data_sync_admin": true,
"available_positions": false,
"bid_count": true,
"personalization": true,
"persona_auth": true
}
Expand Down
1 change: 1 addition & 0 deletions public/config/config_dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"notifications": true,
"data_sync_admin": true,
"available_positions": false,
"bid_count": true,
"personalization": true,
"persona_auth": true
}
Expand Down
13 changes: 13 additions & 0 deletions src/Components/BidCount/FeatureFlagWrapper.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { Flag } from 'flag';
import BidCount from './BidCount';

// Only show bid count if bid_count flag === true
const BidCountFeatureFlagWrapper = props => (
<Flag
name="flags.bid_count"
render={() => <BidCount {...props} />}
/>
);

export default BidCountFeatureFlagWrapper;
2 changes: 1 addition & 1 deletion src/Components/BidCount/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { default } from './BidCount';
export { default } from './FeatureFlagWrapper';
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ exports[`BidContentComponent matches snapshot 1`] = `
<span
className="bid-stats"
>
<BidCount
<BidCountFeatureFlagWrapper
altStyle={true}
bidStatistics={null}
hideLabel={false}
isCondensed={false}
label="Bid Count"
/>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ exports[`BidTrackerCardTitleComponent matches snapshot when condensedView is tru
<span
className="bid-stats"
>
<BidCount
<BidCountFeatureFlagWrapper
altStyle={true}
bidStatistics={
Object {
Expand All @@ -58,9 +58,6 @@ exports[`BidTrackerCardTitleComponent matches snapshot when condensedView is tru
"total_positions": 251,
}
}
hideLabel={false}
isCondensed={false}
label="Bid count:"
/>
</span>
</div>
Expand Down Expand Up @@ -105,7 +102,7 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is "approved"
<span
className="bid-stats"
>
<BidCount
<BidCountFeatureFlagWrapper
altStyle={true}
bidStatistics={
Object {
Expand All @@ -125,9 +122,6 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is "approved"
"total_positions": 251,
}
}
hideLabel={false}
isCondensed={false}
label="Bid count:"
/>
</span>
</div>
Expand Down Expand Up @@ -172,7 +166,7 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is "submitted
<span
className="bid-stats"
>
<BidCount
<BidCountFeatureFlagWrapper
altStyle={true}
bidStatistics={
Object {
Expand All @@ -192,9 +186,6 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is "submitted
"total_positions": 251,
}
}
hideLabel={false}
isCondensed={false}
label="Bid count:"
/>
</span>
</div>
Expand Down Expand Up @@ -239,7 +230,7 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is "submitted
<span
className="bid-stats"
>
<BidCount
<BidCountFeatureFlagWrapper
altStyle={true}
bidStatistics={
Object {
Expand All @@ -259,9 +250,6 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is "submitted
"total_positions": 251,
}
}
hideLabel={false}
isCondensed={false}
label="Bid count:"
/>
</span>
</div>
Expand Down Expand Up @@ -306,7 +294,7 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is not "submi
<span
className="bid-stats"
>
<BidCount
<BidCountFeatureFlagWrapper
altStyle={true}
bidStatistics={
Object {
Expand All @@ -326,9 +314,6 @@ exports[`BidTrackerCardTitleComponent matches snapshot when status is not "submi
"total_positions": 251,
}
}
hideLabel={false}
isCondensed={false}
label="Bid count:"
/>
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/CompareList/CompareList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class CompareList extends Component {
}
</tr>
<Flag
name="flags.static_content"
name="flags.bid_count"
render={() => renderBidCounts(compareArray, emptyArray)}
/>
<tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ exports[`CompareListComponent matches snapshot 1`] = `
/>
</tr>
<Flag
name="flags.static_content"
name="flags.bid_count"
render={[Function]}
/>
<tr>
Expand Down Expand Up @@ -710,7 +710,7 @@ exports[`CompareListComponent matches snapshot when there is an obc id 1`] = `
/>
</tr>
<Flag
name="flags.static_content"
name="flags.bid_count"
render={[Function]}
/>
<tr>
Expand Down
38 changes: 21 additions & 17 deletions src/Components/PositionTitle/PositionTitle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import { getAssetPath, propOrDefault, getPostName } from '../../utilities';
import { CANNOT_BID_DEFAULT, CANNOT_BID_SUFFIX, NO_POST } from '../../Constants/SystemMessages';
import PermissionsWrapper from '../../Containers/PermissionsWrapper';
import BidCount from '../BidCount';
import { checkFlag } from '../../flags';


const seal = getAssetPath('/assets/img/us-flag.jpg');
const useBidding = () => checkFlag('flags.bidding');

class PositionTitle extends Component {
constructor(props) {
Expand Down Expand Up @@ -91,28 +93,30 @@ class PositionTitle extends Component {
src={seal}
/>
</div>
<div className="offset-bid-button-container">
<div className={useBidding() ? 'offset-bid-button-container' : 'offset-bid-button-container-no-button'}>
{
!isProjectedVacancy &&
<Flag
name="flags.bidding"
render={this.renderBidCount}
/>
this.renderBidCount()
}
{
!get(details, 'availability.availability', true) &&
<div className="unavailable-tooltip">
<Tooltip
title={availablilityText}
arrow
position="bottom"
tabIndex="0"
theme="light"
>
<FontAwesome name="question-circle" />
{'Why can\'t I add this position to my bid list?'}
</Tooltip>
</div>
<Flag
name="flags.bidding"
render={() => (
<div className="unavailable-tooltip">
<Tooltip
title={availablilityText}
arrow
position="bottom"
tabIndex="0"
theme="light"
>
<FontAwesome name="question-circle" />
{'Why can\'t I add this position to my bid list?'}
</Tooltip>
</div>
)}
/>
}
{
!isProjectedVacancy &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ exports[`PositionTitleComponent matches snapshot 1`] = `
<div
className="offset-bid-button-container"
>
<Flag
name="flags.bidding"
render={[Function]}
<BidCountFeatureFlagWrapper
altStyle={true}
hideLabel={true}
isCondensed={true}
/>
<Flag
name="flags.bidding"
Expand Down
4 changes: 2 additions & 2 deletions src/Components/ResultsCard/ResultsCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class ResultsCard extends Component {
{
!isProjectedVacancy &&
<Flag
name="flags.bidding"
name="flags.bid_count"
render={() => renderBidCountMobile(stats)}
/>
}
Expand All @@ -199,7 +199,7 @@ class ResultsCard extends Component {
{
!isProjectedVacancy &&
<Flag
name="flags.bidding"
name="flags.bid_count"
render={() => renderBidCount(stats)}
/>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ class ResultsCondensedCardBottom extends Component {
const { showBidCount, position } = this.props;
const pos = position.position || position;
return showBidCount ?
<ResultsCondensedCardStats bidStatisticsArray={pos.bid_statistics} />
<Flag
name="flags.bid_count"
render={() => <ResultsCondensedCardStats bidStatisticsArray={pos.bid_statistics} />}
/>
:
null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ exports[`ResultsCondensedCardStatsComponent matches snapshot 1`] = `
<div
className="usa-grid-full condensed-card-statistics-inner"
>
<BidCount
altStyle={false}
<BidCountFeatureFlagWrapper
bidStatistics={
Object {
"at_skill": 5,
Expand All @@ -17,9 +16,6 @@ exports[`ResultsCondensedCardStatsComponent matches snapshot 1`] = `
"total_bids": 5,
}
}
hideLabel={false}
isCondensed={false}
label="Bid count:"
/>
</div>
</div>
Expand Down
15 changes: 15 additions & 0 deletions src/sass/_details.scss
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,21 @@
white-space: nowrap;
}
}

.bid-count-container {
margin-right: 7.5px;
}
}

.offset-bid-button-container-no-button {
bottom: 17%;
left: 71%;
position: absolute;

@media screen and (max-width: $screen-xs-max) {
min-width: 0px;
left: 63%;
}
}

.offset-bid-count-container {
Expand Down

0 comments on commit d0eed5c

Please sign in to comment.