Skip to content

Commit

Permalink
Merge branch 'StreamlineDeadline'
Browse files Browse the repository at this point in the history
  • Loading branch information
abrauninger committed Oct 18, 2018
2 parents c89e41b + 24ec94b commit 0d6aa53
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/components/PlanStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class PlanStep extends React.Component<IPlanStepProps & IPropsFromState & IConne
return (
<div key={planStepId}>
<div className="plan-step-header VotingVoices-sans-serif">{this.checkboxElement()}{fullHeaderString}</div>
<div className="plan-step-text VotingVoices-serif">{this.props.getString(text)}</div>
<div className="plan-step-text VotingVoices-serif" dangerouslySetInnerHTML={ { __html: this.props.getString(text)} } />

{ this.showBallotReady(planStepId) ?
this.ballotReadyWidget(callToAction, link) :
Expand Down
14 changes: 2 additions & 12 deletions src/store/Questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const QUESTIONS : IQuestion[] = [
AnswerId.Washington,
AnswerId.OtherState,
],
resultingPlanStep: (answer) => undefined,
resultingPlanStep: (answer) => answer !== AnswerId.OtherState ? PlanStepId.CheckBallotReturnDeadline : undefined,
},
/* VOTE-IN-PERSON PATH */
{
Expand Down Expand Up @@ -110,23 +110,13 @@ export const QUESTIONS : IQuestion[] = [
/* VOTE-BY-MAIL PATH */
{
id: QuestionId.ReceivedBallot,
dotNavStep: 5,
nextQuestionId: (key) => QuestionId.Deadline,
answers: [
AnswerId.Yes,
AnswerId.No,
],
resultingPlanStep: (answer) => answer === AnswerId.Yes ? PlanStepId.HaveBallot : PlanStepId.NoBallotYet,
},
{
id: QuestionId.Deadline,
dotNavStep: 6,
nextQuestionId: (key) => QuestionId.ReturnMethod,
answers: [
AnswerId.Yes,
AnswerId.No,
],
resultingPlanStep: (answer) => answer === AnswerId.Yes ? PlanStepId.KnowDeadline : PlanStepId.DontKnowDeadline,
resultingPlanStep: (answer) => answer === AnswerId.Yes ? PlanStepId.HaveBallot : PlanStepId.NoBallotYet,
},
{
id: QuestionId.ReturnMethod,
Expand Down
3 changes: 1 addition & 2 deletions src/store/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ export enum PlanStepId {
MaybeRegister,
HaveBallot,
NoBallotYet,
DontKnowDeadline,
KnowDeadline,
CheckBallotReturnDeadline,
MailBallot,
DropBallotAtDropBox,
RequestAbsenteeBallot,
Expand Down
119 changes: 66 additions & 53 deletions src/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export enum StringId {
OregonDeadlineLink,
WashingtonDeadlineLink,
WhenIsTheDeadlineExactly,
TheDeadlineYouveGotThis,
MidnightBallotDropOrPostmark,
CheckYourDeadline,
FindOutMore,
CheckYourDeadlineAndDontForgetPostage,
CheckYourDeadlineAndRestEasy,
FindColoradoMailingDetails,
Expand All @@ -86,7 +84,7 @@ export enum StringId {
OregonDropBoxLink,
WashingtonDropBoxLink,
DiscoverYourNeighborhoodDropBox,
CheckYourDeadlineForDropbox,
PlanAheadForDropBox,
FindDropboxNearYou,
CheckAbsenteePostageAndDeadline,
VoteDotOrgAbsenteeBallotLink,
Expand Down Expand Up @@ -154,6 +152,9 @@ export enum StringId {
AngryEmoji,
MehEmoji,
DeadlineBannerMarkup,
ColoradoDeadlineDescription,
OregonDeadlineDescription,
WashingtonDeadlineDescription,
}

const STRINGS_ENGLISH = new Map<StringId, string>([
Expand Down Expand Up @@ -326,7 +327,7 @@ const STRINGS_ENGLISH = new Map<StringId, string>([
"Have ballot, will vote!"],

[StringId.YouveGotItNowSubmitIt,
"You've got it, now submit it. (Don't forget to check the postage requirements if you're using USPS.)"], // TODO: Spell out U.S. Postal Service
"You've got it, now submit it. (Don't forget to check the postage requirements if you're using the U.S. Postal Service.)"], // TODO: Spell out U.S. Postal Service

[StringId.FindYourColoradoBallot,
"Find your Colorado ballot"],
Expand All @@ -353,25 +354,19 @@ const STRINGS_ENGLISH = new Map<StringId, string>([
"Track your ballot online and find out when to expect it."],

[StringId.ColoradoDeadlineLink,
"https://www.sos.state.co.us/pubs/elections/"],
"https://www.sos.state.co.us/pubs/elections/FAQs/ElectionDay.html"],

[StringId.OregonDeadlineLink,
"https://sos.oregon.gov/voting/Pages/current-election.aspx"],
"https://sos.oregon.gov/voting/Pages/voteinor.aspx"],

[StringId.WashingtonDeadlineLink,
"https://www.sos.wa.gov/elections/dates-and-deadlines.aspx"],

[StringId.WhenIsTheDeadlineExactly,
"When is the deadline, exactly?"],

[StringId.TheDeadlineYouveGotThis,
"The deadline: you've got this"],

[StringId.MidnightBallotDropOrPostmark,
"Midnight ballot box drop or postmark? Quickly double-check your deadline and rest easy."],

[StringId.CheckYourDeadline,
"Check your deadline"],
[StringId.FindOutMore,
"Find out more"],

[StringId.CheckYourDeadlineAndDontForgetPostage,
"Check up on your deadline and rest easy. (And don't forget postage if your ballot envelope is not prepaid.)"],
Expand Down Expand Up @@ -410,10 +405,10 @@ const STRINGS_ENGLISH = new Map<StringId, string>([
"https://www.sos.wa.gov/elections/auditors/"], // TODO: Is this really the best URL?

[StringId.DiscoverYourNeighborhoodDropBox,
"Discover your neighborhood ballot drop box."],
"Find your neighborhood ballot drop box."],

[StringId.CheckYourDeadlineForDropbox,
"Check your deadline and plan ahead for a convenient ballot box drop."],
[StringId.PlanAheadForDropBox,
"Plan ahead for a convenient ballot box drop."],

[StringId.FindDropboxNearYou,
"Find a ballot drop box near you"],
Expand Down Expand Up @@ -612,6 +607,15 @@ const STRINGS_ENGLISH = new Map<StringId, string>([

[StringId.DeadlineBannerMarkup,
"<strong>Make a plan to vote.</strong> The midterm elections are on <strong>November 6th</strong>."],

[StringId.ColoradoDeadlineDescription,
"In Colorado, your ballot must be received by your county clerk by <strong>7:00 p.m.</strong> on Election Day (Tuesday, November 6, 2018). If you are not sure if your ballot will arrive in time, drop it off in person."],

[StringId.OregonDeadlineDescription,
"In Oregon, your ballot must be received by <strong>8:00 p.m.</strong> on Election Day (Tuesday, November 6, 2018). If you haven't sent your ballot by October 31, 2018, you should drop off the ballot in person to make sure it's counted."],

[StringId.WashingtonDeadlineDescription,
"In Washington, your ballot must be postmarked on or before Election Day (Tuesday, November 6, 2018). Ballot drop boxes close promptly at <strong>8:00 p.m.</strong> on Election Day."],
]);

const STRINGS_SPANISH = new Map<StringId, string>([
Expand Down Expand Up @@ -835,7 +839,7 @@ const STRINGS_SPANISH = new Map<StringId, string>([
"Tengo un cartón de votación. Votaré!"], // TODO: Tiene?

[StringId.YouveGotItNowSubmitIt,
// "You've got it, now submit it. (Don't forget to check the postage requirements if you're using USPS.)"], // TODO: Spell out U.S. Postal Service
// "You've got it, now submit it. (Don't forget to check the postage requirements if you're using the U.S. Postal Service.)"],
"Ya lo tiene, ahora envíalo. (No se le olvidé revisar los requerimientos postales si usa USPS)"], // TODO: Spell out USPS in Spanish?

[StringId.FindYourColoradoBallot,
Expand Down Expand Up @@ -868,10 +872,10 @@ const STRINGS_SPANISH = new Map<StringId, string>([
"Rastree su cartón de votación y sepá cuando va a llegar"],

[StringId.ColoradoDeadlineLink,
"https://www.sos.state.co.us/pubs/elections/"],
"https://www.sos.state.co.us/pubs/elections/FAQs/ElectionDay.html"],

[StringId.OregonDeadlineLink,
"https://sos.oregon.gov/voting/Pages/current-election.aspx"],
"https://sos.oregon.gov/voting/Pages/voteinor.aspx"],

[StringId.WashingtonDeadlineLink,
"https://www.sos.wa.gov/elections/dates-and-deadlines.aspx"],
Expand All @@ -880,17 +884,9 @@ const STRINGS_SPANISH = new Map<StringId, string>([
// "When is the deadline, exactly?"],
"Cuándo es exactamente la fecha límite?"],

[StringId.TheDeadlineYouveGotThis,
// "The deadline: you've got this"],
"La fecha límite: "], // TODO: Incomplete translation?

[StringId.MidnightBallotDropOrPostmark,
// "Midnight ballot box drop or postmark? Quickly double-check your deadline and rest easy."],
"Dejar en el casillero de envió por correo o matasellos. Rápidamente revisé su fecha límite y el resto va a ser sencillo."], // TODO: Double-check translation

[StringId.CheckYourDeadline,
// "Check your deadline"],
"Revisé su fecha límite"],
[StringId.FindOutMore,
// TODO: Translate
"Find out more"],

[StringId.CheckYourDeadlineAndDontForgetPostage,
// "Check up on your deadline and rest easy. (And don't forget postage if your ballot envelope is not prepaid.)"],
Expand Down Expand Up @@ -926,7 +922,7 @@ const STRINGS_SPANISH = new Map<StringId, string>([
"Envíe su cartón de votación, pronto!"],

[StringId.ColoradoDropBoxLink,
"https://www.sos.state.co.us/pubs/elections/"],
"https://www.sos.state.co.us/pubs/elections/FAQs/ElectionDay.html"],

[StringId.OregonDropBoxLink,
"https://sos.oregon.gov/voting/pages/drop-box-locator.aspx"],
Expand All @@ -935,12 +931,12 @@ const STRINGS_SPANISH = new Map<StringId, string>([
"https://www.sos.wa.gov/elections/auditors/"], // TODO: Is this really the best URL?

[StringId.DiscoverYourNeighborhoodDropBox,
// "Discover your neighborhood ballot drop box."],
// "Find your neighborhood ballot drop box."],
"Encuntré el casillero de envio dentro de su vecindario."], // TODO: Typo? Es 'encuntre' una palabra espanola?

[StringId.CheckYourDeadlineForDropbox,
[StringId.PlanAheadForDropBox,
// "Check your deadline and plan ahead for a convenient ballot box drop."],
"Verifique su fecha límite y planee con tiempo el envío de su cartón de votación en el casillero."],
"Planee con tiempo el envío de su cartón de votación en el casillero."],

[StringId.FindDropboxNearYou,
// "Find a ballot drop box near you"],
Expand Down Expand Up @@ -1198,6 +1194,18 @@ const STRINGS_SPANISH = new Map<StringId, string>([
[StringId.DeadlineBannerMarkup,
// TODO: Translate
"<strong>Make a plan to vote.</strong> The midterm elections are on <strong>November 6th</strong>."],

[StringId.ColoradoDeadlineDescription,
// TODO: Translate
"In Colorado, your ballot must be received by your county clerk by <strong>7:00 p.m.</strong> on Election Day (Tuesday, November 6, 2018). If you are not sure if your ballot will arrive in time, drop it off in person."],

[StringId.OregonDeadlineDescription,
// TODO: Translate
"In Oregon, your ballot must be received by <strong>8:00 p.m.</strong> on Election Day (Tuesday, November 6, 2018). If you haven't sent your ballot by October 31, 2018, you should drop off the ballot in person to make sure it's counted."],

[StringId.WashingtonDeadlineDescription,
// TODO: Translate
"In Washington, your ballot must be postmarked on or before Election Day (Tuesday, November 6, 2018). Ballot drop boxes close promptly at <strong>8:00 p.m.</strong> on Election Day."],
]);

export function getEnglishString(id: StringId): string {
Expand Down Expand Up @@ -1349,33 +1357,38 @@ export function getPlanStepStrings(step: PlanStepId, state: VotingStateId): IPla
}
}

case PlanStepId.DontKnowDeadline:
case PlanStepId.KnowDeadline: {
let link: StringId | undefined;
case PlanStepId.CheckBallotReturnDeadline: {
const header = StringId.WhenIsTheDeadlineExactly;
const callToAction = StringId.FindOutMore;

switch (state) {
case VotingStateId.Colorado: {
link = StringId.ColoradoDeadlineLink;
break;
return {
header,
text: StringId.ColoradoDeadlineDescription,
callToAction,
link: StringId.ColoradoDeadlineLink,
}
}
case VotingStateId.Oregon: {
link = StringId.OregonDeadlineLink;
break;
return {
header,
text: StringId.OregonDeadlineDescription,
callToAction,
link: StringId.OregonDeadlineLink,
}
}
case VotingStateId.Washington: {
link = StringId.WashingtonDeadlineLink;
break;
return {
header,
text: StringId.WashingtonDeadlineDescription,
callToAction,
link: StringId.WashingtonDeadlineLink,
}
}
default:
throw new Error("Unrecognized VotingStateId");
}

return {
header: step === PlanStepId.DontKnowDeadline ? StringId.WhenIsTheDeadlineExactly : StringId.TheDeadlineYouveGotThis,
text: StringId.MidnightBallotDropOrPostmark,
callToAction: StringId.CheckYourDeadline,
link
}
}

case PlanStepId.MailBallot: {
Expand Down Expand Up @@ -1435,7 +1448,7 @@ export function getPlanStepStrings(step: PlanStepId, state: VotingStateId): IPla

return {
header: StringId.DiscoverYourNeighborhoodDropBox,
text: StringId.CheckYourDeadlineForDropbox,
text: StringId.PlanAheadForDropBox,
callToAction: StringId.FindDropboxNearYou,
link,
}
Expand Down

0 comments on commit 0d6aa53

Please sign in to comment.