Skip to content

Commit

Permalink
Added support for Primary races for Presidential candidates.
Browse files Browse the repository at this point in the history
  • Loading branch information
DaleMcGrew committed Mar 24, 2024
1 parent 20eed28 commit af52e8c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/js/components/Ballot/BallotItemCompressed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class BallotItemCompressed extends PureComponent {
renderLog('BallotItemCompressed'); // Set LOG_RENDER_EVENTS to log all renders
const {
ballotItemDisplayName, candidateList, candidatesToShowForSearchResults,
isFirstBallotItem, isMeasure,
isFirstBallotItem, isMeasure, primaryParty,
weVoteId,
} = this.props;
return (
Expand All @@ -26,6 +26,7 @@ export default class BallotItemCompressed extends PureComponent {
candidateList={candidateList}
candidatesToShowForSearchResults={candidatesToShowForSearchResults}
isFirstBallotItem={isFirstBallotItem}
primaryParty={primaryParty}
/>
)}
</div>
Expand All @@ -38,5 +39,6 @@ BallotItemCompressed.propTypes = {
candidatesToShowForSearchResults: PropTypes.array,
isFirstBallotItem: PropTypes.bool,
isMeasure: PropTypes.bool,
primaryParty: PropTypes.string,
weVoteId: PropTypes.string.isRequired,
};
16 changes: 15 additions & 1 deletion src/js/components/Ballot/OfficeItemCompressed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ class OfficeItemCompressed extends Component {
renderLog('OfficeItemCompressed'); // Set LOG_RENDER_EVENTS to log all renders
// console.log('OfficeItemCompressed render');
let { ballotItemDisplayName } = this.props;
const { isFirstBallotItem, officeWeVoteId } = this.props; // classes
const { isFirstBallotItem, officeWeVoteId, primaryParty } = this.props; // classes
const { candidateListLength, showAllCandidates, totalNumberOfCandidates } = this.state;
ballotItemDisplayName = toTitleCase(ballotItemDisplayName).replace('(Unexpired)', '(Remainder)');
const candidatesToRenderCount = this.getCandidatesToRenderCount();
Expand All @@ -534,6 +534,15 @@ class OfficeItemCompressed extends Component {
/>
<OfficeNameH2>
{ballotItemDisplayName}
{!!(primaryParty) && (
<PrimaryPartyWrapper>
{' '}
(
{primaryParty}
{' '}
Primary)
</PrimaryPartyWrapper>
)}
</OfficeNameH2>
{/* *************************
Display either a) the candidates the voter supports, or b) the first few candidates running for this office
Expand Down Expand Up @@ -576,6 +585,7 @@ OfficeItemCompressed.propTypes = {
isFirstBallotItem: PropTypes.bool,
organization: PropTypes.object,
organizationWeVoteId: PropTypes.string,
primaryParty: PropTypes.string,
};

const styles = (theme) => ({
Expand Down Expand Up @@ -616,6 +626,10 @@ const ItemActionBarOutsideWrapper = styled('div')`
width: 100%;
`;

const PrimaryPartyWrapper = styled('span')`
font-size: 18px;
`;

const ScoreWrapper = styled('div')`
display: flex;
`;
Expand Down
1 change: 1 addition & 0 deletions src/js/pages/Ballot/Ballot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,7 @@ class Ballot extends Component {
id={chipLabelText(item.ballot_item_display_name)}
isFirstBallotItem={isFirstBallotItem}
isMeasure={item.kind_of_ballot_item === TYPES.MEASURE}
primaryParty={item.primary_party}
totalNumberOfBallotItems={totalNumberOfBallotItems}
weVoteId={item.we_vote_id}
key={key}
Expand Down

0 comments on commit af52e8c

Please sign in to comment.