Skip to content

Commit

Permalink
Interim FriendIntroLanding check in so we can release what is working…
Browse files Browse the repository at this point in the history
…. Added alt null text for candidate images. Added testing packages back into package.json. (More work needed.)
  • Loading branch information
DaleMcGrew committed May 25, 2022
1 parent dbb2322 commit f79f949
Show file tree
Hide file tree
Showing 17 changed files with 3,489 additions and 182 deletions.
3,462 changes: 3,344 additions & 118 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
"lintCordova": "eslint --format stylish --ext .jsx --ext .js srcCordova/js",
"prod": "node node/buildDateFile.js && MINIMIZED=1 webpack --mode production",
"run-prod-local": "node server-prod-local.js",
"start": "node node/buildDateFile.js && PROTOCOL=HTTP webpack serve --mode development",
"start": "node node/buildDateFile.js && PROTOCOL=HTTP webpack serve --mode development",
"start-https": "node node/buildDateFile.js && PROTOCOL=HTTPS webpack serve --mode development",
"start-https-analysis": "node node/buildDateFile.js && PROTOCOL=HTTPS && ANALYSIS=1 webpack serve --mode development",
"start-minified-libs": "webpack serve --mode production",
"start-minified-libs-analysis": "ANALYSIS=1 webpack serve --mode development",
"start-minified-libs-analysis-prod": "ANALYSIS=1 webpack serve --mode production",
"test": "echo \"No test specified\" && exit 0",
"readyTest-Browser": "./node_modules/.bin/wdio ./tests/browserstack/wdio.config.js",
"autoTest": " mocha --require @babel/register --require tests/component/index.js \"./tests/component/tests.js\" && npm run lint",
"snyk-protect": "snyk protect",
"prepare": "npm run snyk-protect"
Expand All @@ -38,9 +39,14 @@
"@babel/preset-env": "^7.13.15",
"@babel/preset-react": "^7.12.1",
"@babel/register": "^7.13.16",
"@wdio/cli": "^7.19.7",
"@wdio/local-runner": "^7.19.7",
"@wdio/mocha-framework": "^7.19.7",
"@wdio/spec-reporter": "^7.19.7",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
"babel-plugin-styled-components": "^2.0.6",
"chromedriver": "^101.0.0",
"clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^7.0.0",
"cordova-plugin-contacts-x": "^2.0.3",
Expand All @@ -66,6 +72,7 @@
"stylelint-config-standard": "^20.0.0",
"terser-webpack-plugin": "^5.1.2",
"unused-webpack-plugin": "^2.4.0",
"wdio-chromedriver-service": "^7.3.2",
"webpack": "^5.32.0",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.9.2",
Expand Down Expand Up @@ -117,8 +124,10 @@
"react-text-truncate": "^0.17.0",
"react-toastify": "^7.0.4",
"rxjs": "^6.6.7",
"selenium-webdriver": "^4.1.2",
"styled-components": "~5.3.3",
"topojson-client": "^3.1.0"
"topojson-client": "^3.1.0",
"wdio": "^6.0.1"
},
"optionalDependencies": {
"snyk": "^1.381.1"
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Ballot/CandidateItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ class CandidateItem extends Component {
className="card-main__avatar"
sizeClassName="icon-office-child "
imageUrl={candidatePhotoUrl}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
/>
</Suspense>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Ballot/CandidateItemCompressed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default class CandidateItemCompressed extends Component {
className={avatarCompressed}
sizeClassName="icon-candidate-small u-push--sm "
imageUrl={this.state.oneCandidate.candidate_photo_url_medium}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
style={{ backgroundImage: { avatarBackgroundImage } }}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Ballot/CandidateItemEndorsement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ class CandidateItemEndorsement extends Component {
className="card-main__avatar"
sizeClassName="icon-office-child "
imageUrl={candidatePhotoUrl}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
/>
</Suspense>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Ballot/CandidateStickyHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CandidateStickyHeader extends Component {
<Flex>
<ColumnOne>
<Profile>
{candidatePhotoUrl && <Avatar src={candidatePhotoUrl} alt="candidate-photo" />}
{candidatePhotoUrl && <Avatar src={candidatePhotoUrl} alt="" />}
<div>
<CandidateName>{displayName}</CandidateName>
<CandidateDescription>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Ballot/OfficeItemCompressed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class OfficeItemCompressed extends Component {
className={avatarCompressed}
sizeClassName="icon-candidate-small u-push--sm "
imageUrl={oneCandidate.candidate_photo_url_medium}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
style={{ backgroundImage: { avatarBackgroundImage } }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class CandidateItemForOpinions extends Component {
className={avatarCompressed}
sizeClassName="icon-candidate-small u-push--sm "
imageUrl={oneCandidate.candidate_photo_url_medium}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
style={{ backgroundImage: { avatarBackgroundImage } }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class CandidateItemForAddPositions extends Component {
className={avatarCompressed}
sizeClassName="icon-candidate-small u-push--sm "
imageUrl={oneCandidate.candidate_photo_url_medium}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
style={{ backgroundImage: { avatarBackgroundImage } }}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Vote/OfficeItemReadyToVote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class OfficeItemReadyToVote extends Component {
className="card-main__avatar"
sizeClassName="icon-office-child "
imageUrl={candidatePhotoUrl}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
/>
</Suspense>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/VoterGuide/OrganizationPositionItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ export default class OrganizationPositionItem extends Component {
className="card-child__avatar--round"
sizeClassName="icon-lg "
imageUrl={position.ballot_item_image_url_https_large}
alt="candidate-photo"
alt=""
kind_of_ballot_item={kindOfBallotItem}
/>
</Suspense>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default class OrganizationVoterGuideCandidateItem extends Component {
className="card-main__avatar"
sizeClassName="icon-office-child "
imageUrl={candidatePhotoUrl}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
/>
</Suspense>
Expand Down
2 changes: 1 addition & 1 deletion src/js/components/Widgets/Testimonial.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Testimonial extends React.Component {
<ImageHandler
className="card-main__avatar__testimonial"
imageUrl={imageUrl}
alt="candidate-photo"
alt=""
kind_of_ballot_item="CANDIDATE"
/>
</Suspense>
Expand Down
58 changes: 38 additions & 20 deletions src/js/pages/FriendIntro/FriendIntroLanding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class FriendIntroLanding extends Component {
this.state = {
friendInvitationInformationCalled: false,
showWhatIsWeVote: false,
skipForNowOff: false,
voterContactEmailListCount: 0,
voterContactEmailGoogleCount: 0,
};
}

Expand Down Expand Up @@ -105,13 +108,18 @@ class FriendIntroLanding extends Component {
onVoterStoreChange () {
// console.log('onVoterStoreChange');
this.onFriendStoreChange();
const voterContactEmailList = VoterStore.getVoterContactEmailList();
const voter = VoterStore.getVoter();
const {
signed_in_apple: voterSignedInApple,
signed_in_facebook: voterSignedInFacebook,
signed_in_twitter: voterSignedInTwitter,
} = voter;
const voterContactEmailGoogleCount = VoterStore.getVoterContactEmailGoogleCount();
const voterContactEmailListCount = voterContactEmailList.length;
this.setState({
voterContactEmailGoogleCount,
voterContactEmailListCount,
voterFirstName: VoterStore.getFirstName(),
voterPhotoUrlLarge: VoterStore.getVoterPhotoUrlLarge(),
voterSignedInApple,
Expand All @@ -124,7 +132,7 @@ class FriendIntroLanding extends Component {
const { location: { pathname: currentPathname } } = window;
AppObservableStore.setSetUpAccountBackLinkPath(currentPathname);
const { setUpAccountEntryPath } = this.state;
// AppObservableStore.setSetUpAccountEntryPath(entryPath);
AppObservableStore.setSetUpAccountEntryPath(setUpAccountEntryPath);
historyPush(setUpAccountEntryPath);
}

Expand All @@ -137,35 +145,40 @@ class FriendIntroLanding extends Component {
voterFirstName, voterPhotoUrlLarge,
voterSignedInApple, voterSignedInFacebook, voterSignedInTwitter,
} = this.state;
const contactsImported = false;
let socialSignInOffered = true;
let socialSignInOffered = false; // Temporarily false until Twitter/Facebook sign in offered
const voterSignedInWithSocialSite = voterSignedInApple || voterSignedInFacebook || voterSignedInTwitter;
if (voterFirstName && voterPhotoUrlLarge) {
socialSignInOffered = false;
} else if (voterSignedInWithSocialSite) {
socialSignInOffered = false;
}

let nextStepButtonText;
let nextStepButtonText = 'Next';
let setUpAccountEntryPath;
let skipForNowOff = false;
if (voterFirstName && voterPhotoUrlLarge) {
if (contactsImported) {
setUpAccountEntryPath = '/setupaccount/invitecontacts';
nextStepButtonText = 'Find other friends';
} else {
setUpAccountEntryPath = '/setupaccount/importcontacts';
nextStepButtonText = 'Find other friends';
}
setUpAccountEntryPath = '/ballot'; // Temporary redirection
nextStepButtonText = 'View your ballot';
skipForNowOff = true;
// if (voterContactEmailGoogleCount) {
// setUpAccountEntryPath = '/setupaccount/invitecontacts';
// nextStepButtonText = 'Find other friends';
// } else {
// setUpAccountEntryPath = '/setupaccount/importcontacts';
// nextStepButtonText = 'Find other friends';
// }
} else if (voterPhotoUrlLarge) {
setUpAccountEntryPath = '/setupaccount/editname';
} else if (voterFirstName) {
setUpAccountEntryPath = '/setupaccount/addphoto';
} else {
setUpAccountEntryPath = '/setupaccount';
setUpAccountEntryPath = '/ballot'; // Temporary redirection
// setUpAccountEntryPath = '/setupaccount';
}
this.setState({
nextStepButtonText,
setUpAccountEntryPath,
skipForNowOff,
socialSignInOffered,
});
}
Expand All @@ -182,7 +195,7 @@ class FriendIntroLanding extends Component {
const { classes } = this.props;
const {
friendFirstName, friendLastName, friendImageUrlHttpsLarge, nextStepButtonText,
showWhatIsWeVote, socialSignInOffered, voterFirstName,
showWhatIsWeVote, skipForNowOff, socialSignInOffered, voterFirstName,
} = this.state;

return (
Expand Down Expand Up @@ -285,6 +298,7 @@ class FriendIntroLanding extends Component {
goToSkipForNow={this.goToSkipForNow}
nextStepButtonText={nextStepButtonText}
onClickNextButton={this.goToNextStep}
skipForNowOff={skipForNowOff}
/>
</DesktopNextButtonsInnerWrapper>
</DesktopNextButtonsOuterWrapperUShowDesktopTablet>
Expand All @@ -309,6 +323,7 @@ class FriendIntroLanding extends Component {
goToSkipForNow={this.goToSkipForNow}
nextStepButtonText={nextStepButtonText}
onClickNextButton={this.goToNextStep}
skipForNowOff={skipForNowOff}
/>
</MobileStaticNextButtonsInnerWrapper>
</MobileStaticNextButtonsOuterWrapperUShowMobile>
Expand Down Expand Up @@ -344,13 +359,15 @@ function NextStepButtons (props) {
>
{props.nextStepButtonText}
</Button>
<Button
classes={props.desktopMode ? { root: props.classes.desktopSimpleLink } : { root: props.classes.mobileSimpleLink }}
color="primary"
onClick={props.goToSkipForNow}
>
Skip for now
</Button>
{!props.skipForNowOff && (
<Button
classes={props.desktopMode ? { root: props.classes.desktopSimpleLink } : { root: props.classes.mobileSimpleLink }}
color="primary"
onClick={props.goToSkipForNow}
>
Skip for now
</Button>
)}
</>
);
}
Expand All @@ -360,6 +377,7 @@ NextStepButtons.propTypes = {
goToSkipForNow: PropTypes.func,
nextStepButtonText: PropTypes.string,
onClickNextButton: PropTypes.func,
skipForNowOff: PropTypes.bool,
};

const styles = () => ({
Expand Down
20 changes: 18 additions & 2 deletions src/js/pages/Ready.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ class Ready extends Component {
</ElectionCountdownInnerWrapper>
</ElectionCountdownOuterWrapper>
<ViewBallotButtonWrapper className="col-12">
{(voterIsSignedIn && electionDataExistsForUpcomingElection) && (
{electionDataExistsForUpcomingElection && (
<Button
color="primary"
onClick={this.goToBallot}
Expand All @@ -226,7 +226,7 @@ class Ready extends Component {
}}
variant="contained"
>
View ballot
View your ballot
</Button>
)}
</ViewBallotButtonWrapper>
Expand Down Expand Up @@ -305,6 +305,22 @@ class Ready extends Component {
arrowsOn
/>
)}
<div className="u-show-mobile">
{electionDataExistsForUpcomingElection && (
<Button
color="primary"
onClick={this.goToBallot}
style={{
boxShadow: 'none !important',
textTransform: 'none',
width: 250,
}}
variant="contained"
>
View your ballot
</Button>
)}
</div>
</div>
<div className="col-lg-4 d-none d-lg-block">
{(chosenReadyIntroductionTitle || chosenReadyIntroductionText) && (
Expand Down
Loading

0 comments on commit f79f949

Please sign in to comment.