diff --git a/components/conference/ConferenceDetails.test.tsx b/components/conference/ConferenceDetails.test.tsx index a1d2e4135..7556a82c7 100644 --- a/components/conference/ConferenceDetails.test.tsx +++ b/components/conference/ConferenceDetails.test.tsx @@ -597,7 +597,7 @@ describe("ConferenceDetails", () => { mockUser = { uid: "reader", emailVerified: true } render() expect( - screen.getByRole("dialog", { name: "input.panel_title" }) + screen.getByRole("dialog", { name: "input.cosign_title" }) ).toBeInTheDocument() letGo() }) @@ -613,7 +613,7 @@ describe("ConferenceDetails", () => { mockUser = { uid: "reader", emailVerified: true } rerender() expect( - screen.getByRole("dialog", { name: "input.panel_title" }) + screen.getByRole("dialog", { name: "input.cosign_title" }) ).toBeInTheDocument() expect(mockDispatch).toHaveBeenCalledTimes(1) }) diff --git a/components/conference/ConferenceDetails.tsx b/components/conference/ConferenceDetails.tsx index a41ecd49f..5b11bee3d 100644 --- a/components/conference/ConferenceDetails.tsx +++ b/components/conference/ConferenceDetails.tsx @@ -664,12 +664,15 @@ function InputPanel({ return () => onDraft(undefined) }, [edit.draft, edit.loading, onDraft]) + const mode = cosigning ? "cosign_" : "" const title = step === "review" - ? "input.review_title" - : cosigning && edit.publication + ? `input.${mode}review_title` + : !cosigning + ? "input.panel_title" + : edit.publication ? "input.cosign_edit_title" - : "input.panel_title" + : "input.cosign_title" return ( { const onPosted = jest.fn() const onStep = jest.fn() mount(edit, "write", { onPosted, onStep }) - press("input.review") + press("input.cosign_review") expect(onStep).not.toHaveBeenCalled() fireEvent.click( screen.getByRole("checkbox", { name: "input.cosign_no_words_label" }) ) expect(screen.getByRole("textbox")).toBeDisabled() - press("input.review") + press("input.cosign_review") expect(onStep).toHaveBeenCalledWith("review") expect(edit.publishTestimony.execute).not.toHaveBeenCalled() }) @@ -254,7 +254,7 @@ describe("CosignForm", () => { fireEvent.change(screen.getByRole("textbox"), { target: { value: "After." } }) - press("input.review") + press("input.cosign_review") expect(onStep).toHaveBeenCalledWith("review") }) diff --git a/components/conference/input/CosignForm.tsx b/components/conference/input/CosignForm.tsx index 6cabf2fad..18d3191ba 100644 --- a/components/conference/input/CosignForm.tsx +++ b/components/conference/input/CosignForm.tsx @@ -24,6 +24,7 @@ import { Body, ConductRule, Field, + Hint, Label, Muted, Primary, @@ -233,6 +234,12 @@ const Optional = styled(Cosigned)` color: ${ink.faint}; ` +/** Where the reader's line lands in the letter. */ +const LineHint = styled(Hint)` + margin: -4px 0 8px; + text-align: left; +` + const NoteField = styled(Field)` &:disabled { background: ${wash.default}; @@ -447,6 +454,9 @@ export function CosignForm({ {t("input.cosign_body_label")}{" "} {t("input.cosign_optional")} + + {t("input.cosign_line_hint", { name: nameOf(parent) })} + (ready ? onStep("review") : ask.ask())} > - {t("input.review")} + {t("input.cosign_review")} diff --git a/components/conference/input/InputForm.test.tsx b/components/conference/input/InputForm.test.tsx index e8e8aee7e..c2bfadb5b 100644 --- a/components/conference/input/InputForm.test.tsx +++ b/components/conference/input/InputForm.test.tsx @@ -61,7 +61,33 @@ const review = (edit: UseEditConferenceTestimony) => /> ) +const write = (edit: UseEditConferenceTestimony) => + render( + + ) + describe("InputForm", () => { + it("promises the email to legislators only when the profile has some", () => { + const { unmount } = write(editing()) + expect(screen.getByText("input.delivery_note")).toBeInTheDocument() + unmount() + + mockProfile.current = { fullName: "Gina K." } + write(editing()) + expect(screen.getByText("input.delivery_note_weekly")).toBeInTheDocument() + expect(screen.queryByText("input.delivery_note")).not.toBeInTheDocument() + }) + it("leaves a cosign's draft alone while it sits behind a closed panel", () => { jest.useFakeTimers() const edit = { diff --git a/components/conference/input/InputForm.tsx b/components/conference/input/InputForm.tsx index 7d2e1459c..875aba681 100644 --- a/components/conference/input/InputForm.tsx +++ b/components/conference/input/InputForm.tsx @@ -74,6 +74,14 @@ const Option = styled.button<{ $on: boolean; $position: ConferencePosition }>` }} ` +/** What a position means, under its label where it needs saying. */ +const OptionHelp = styled.span` + display: block; + margin-top: 2px; + font-size: 0.75rem; + font-weight: 300; +` + const ask = keyframes` 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } @@ -175,28 +183,26 @@ export const Rules = styled.ul` } ` -const RuleLabel = styled.p` - margin: 0 0 8px; - font-size: 0.6875rem; - font-weight: 600; - letter-spacing: 0.08em; - text-transform: uppercase; - color: ${ink.mid}; -` - export const Problem = styled.p` margin: 12px 0 0; font-size: 0.75rem; color: ${red.refused}; ` -const Hint = styled.p` +export const Hint = styled.p` margin: 0; text-align: right; font-size: 0.75rem; color: ${ink.mid}; ` +/** Where posted input goes, under the field it is written in. */ +const Delivery = styled(Hint)` + margin-top: 8px; + text-align: left; + line-height: 1.5; +` + /** A field that asks for what is missing: pressed on without it, the field * goes red, shakes and takes the focus; words in it settle it. */ export function useAsk(field: RefObject) { @@ -309,15 +315,6 @@ export function ReviewStep({ {cosign && !letter.content.trim() && } - {!cosign && ( -
- {t("input.rules_label")} - -
  • {t("input.rule_revise")}
  • - -
    -
    - )} {needsReason && } {problem}
    @@ -456,24 +453,28 @@ export function InputForm({ - {conferencePositions.map(p => ( - - ))} + {conferencePositions.map(p => { + const help = t(`input.position.${p}.help`, { defaultValue: "" }) + return ( + + ) + })} + + {hasLegislators(profile ?? {}) ? ( + t("input.delivery_note") + ) : ( + + When you post, MAPLE will include your input in the weekly + update to the conferees. + + Add your representative and senator to your profile + + and MAPLE will email them your input too. + + )} + {failed && {t("input.error")}} diff --git a/functions/src/conferenceLetters/letters.test.ts b/functions/src/conferenceLetters/letters.test.ts index 2ab3991f6..02886a745 100644 --- a/functions/src/conferenceLetters/letters.test.ts +++ b/functions/src/conferenceLetters/letters.test.ts @@ -114,9 +114,7 @@ describe("buildLetterEmail", () => { expect(email.from).toBe( '"Ada via MAPLE" ' ) - expect(email.message.subject).toBe( - "Phone-Free Schools: Please pass something" - ) + expect(email.message.subject).toBe("Phone-Free Schools: Pass a final bill") }) it("turns tracking off per message", () => { diff --git a/functions/src/conferenceUpdates/weeklyUpdate.test.ts b/functions/src/conferenceUpdates/weeklyUpdate.test.ts index ea6d1f284..17777b9da 100644 --- a/functions/src/conferenceUpdates/weeklyUpdate.test.ts +++ b/functions/src/conferenceUpdates/weeklyUpdate.test.ts @@ -154,7 +154,7 @@ describe("the update email", () => { ]) expect(data.changes).toContain("2 inputs added.") expect(data.changes).toContain("Counted input went from 1 to 3.") - expect(data.changes).toContain("Don't pass anything: 0 → 1.") + expect(data.changes).toContain("Don’t pass a final bill: 0 → 1.") }) it("renders the conferees, figures and a link to the page", () => { diff --git a/functions/src/email/digestEmail.test.ts b/functions/src/email/digestEmail.test.ts index 4b2d0c609..36144927e 100644 --- a/functions/src/email/digestEmail.test.ts +++ b/functions/src/email/digestEmail.test.ts @@ -39,8 +39,8 @@ describe("digest email, conferences", () => { court: "194", newTestimonyCount: 3, stances: [ - { stance: "Please pass something", count: 2 }, - { stance: "Don't pass anything", count: 1 } + { stance: "Pass a final bill", count: 2 }, + { stance: "Don’t pass a final bill", count: 1 } ] } ], @@ -53,8 +53,8 @@ describe("digest email, conferences", () => { ) expect(html).toContain("Phone-Free Schools") expect(html).toContain("New Inputs") - expect(html).toMatch(/2<\/td>\s*]*>Please pass something/) - expect(html).toContain("Don't pass anything") + expect(html).toMatch(/2<\/td>\s*]*>Pass a final bill/) + expect(html).toContain("Don’t pass a final bill") }) it("leaves the section out for a reader following no conference", () => { diff --git a/functions/src/notifications/deliverNotifications.test.ts b/functions/src/notifications/deliverNotifications.test.ts index 68c5cb988..989f3d820 100644 --- a/functions/src/notifications/deliverNotifications.test.ts +++ b/functions/src/notifications/deliverNotifications.test.ts @@ -394,10 +394,10 @@ describe("buildDigestData — conferences", () => { court: "194", newTestimonyCount: 3, stances: [ - { stance: "Please pass something", count: 2 }, + { stance: "Pass a final bill", count: 2 }, { stance: "Pass the Senate version", count: 0 }, { stance: "Pass the House version", count: 0 }, - { stance: "Don't pass anything", count: 1 } + { stance: "Don’t pass a final bill", count: 1 } ] } ]) @@ -443,7 +443,7 @@ describe("buildDigestData — conferences", () => { billId: "S2581", court: "194", conferenceId: "phones", - stance: "Please pass something" + stance: "Pass a final bill" } ]) }) diff --git a/functions/src/shared/conferences.ts b/functions/src/shared/conferences.ts index 8428bbca1..cacf1fd55 100644 --- a/functions/src/shared/conferences.ts +++ b/functions/src/shared/conferences.ts @@ -24,8 +24,8 @@ export const conferenceName = (c: Named) => c.name?.trim() || c.title?.trim() || "" // The site's wording, conferences input.position.*.long; a test holds them equal. export const CONFERENCE_STANCES: Record = { - passSomething: "Please pass something", + passSomething: "Pass a final bill", passSenateVersion: "Pass the Senate version", passHouseVersion: "Pass the House version", - passNothing: "Don't pass anything" + passNothing: "Don’t pass a final bill" } diff --git a/public/locales/en/conferences.json b/public/locales/en/conferences.json index 9d27f49e7..273f258d2 100644 --- a/public/locales/en/conferences.json +++ b/public/locales/en/conferences.json @@ -173,20 +173,26 @@ "clear_position": "Clear the {{position}} filter", "position": { "passSomething": { - "long": "Please pass something", - "short": "Pass something" + "long": "Pass a final bill", + "short": "Final bill", + "help": "Either version or a mix of both. Tell conferees what the final bill should include.", + "prompt": "What should the final bill include or leave out?" }, "passSenateVersion": { "long": "Pass the Senate version", - "short": "Senate version" + "short": "Senate version", + "prompt": "Why should conferees adopt the Senate version?" }, "passHouseVersion": { "long": "Pass the House version", - "short": "House version" + "short": "House version", + "prompt": "Why should conferees adopt the House version?" }, "passNothing": { - "long": "Don't pass anything", - "short": "Pass nothing" + "long": "Don’t pass a final bill", + "short": "No final bill", + "help": "Neither version nor a compromise this session.", + "prompt": "Why shouldn’t this bill become law this session?" } }, "show_more": "Show more", @@ -203,19 +209,19 @@ "close_panel": "Close Add Your Input", "position_label": "Your position", "body_label": "Your input", - "prompt": "What do you want lawmakers and other voters to know about this question?", + "delivery_note": "When you post, MAPLE will email your input to your state representative and state senator and include it in the weekly update to the conferees. You’ll see exactly what they get before you post.", + "delivery_note_weekly": "When you post, MAPLE will include your input in the weekly update to the conferees. <1>Add your state representative and senator to your profile and MAPLE will email them your input too.", "saving": "Saving…", "saved": "Saved", "delete_draft": "Delete Draft", "cancel": "Cancel", "review": "Review and Post", - "review_title": "Review and Post", + "review_title": "Review Your Input", "preview_label": "Preview", - "rules_label": "Before You Post", "rule_public": "Posting is public and stays attached to your account.", "rule_revise": "You can revise it later; earlier versions stay on the record.", "conduct": "All posts are governed by our <1>Code of Conduct.", - "back": "Back to editing", + "back": "Back to Editing", "post": "Post", "empty_hint": "Write something first, then post it.", "error": "Your input could not be saved. Try again in a moment.", @@ -275,11 +281,15 @@ "cosign_wordless_note": "Hidden by default. Each card's cosigned count includes them either way.", "cosign_lands": "Each individual can provide input or cosign one position, with the option to add their own words. This is where that message will appear.", "cosign_no_words": "Each individual can provide input or cosign one position. This individual decided not to publicly share additional input.", - "cosign_body_label": "Your Input", - "cosign_optional": "Optional", + "cosign_body_label": "Add a line of your own", + "cosign_optional": "(optional)", + "cosign_line_hint": "It goes at the top of your message, above {{name}}’s input.", "cosign_prompt": "Why does this matter to you? One or two sentences in your own words will have more impact with lawmakers.", "cosign_no_words_label": "I do not want to add input of my own", + "cosign_title": "Cosign Input", "cosign_edit_title": "Edit Your Cosign", + "cosign_review_title": "Review Your Cosign", + "cosign_review": "Review and Cosign", "cosign_parent_gone": "The input you are cosigning has been removed, so your cosign could not be filed.", "cosign_closed": "This conference committee is no longer taking input, so your cosign could not be filed.", "fill_window": "Fill the window", @@ -302,8 +312,8 @@ "rep": "Rep. {{name}}", "sen": "Sen. {{name}}", "and": " and ", - "weekly_input": "Included in MAPLE’s weekly update to the conferees.", - "weekly_cosign": "Counted in MAPLE’s weekly update to the conferees.", + "weekly_input": "Included in MAPLE’s weekly update to the six conferees.", + "weekly_cosign": "Counted in MAPLE’s weekly update to the six conferees.", "conferees": "This committee’s conferees", "conferees_label": "The conferees", "email_label": "Your email", diff --git a/tests/integration/conferenceLetters.test.ts b/tests/integration/conferenceLetters.test.ts index 4059a2e28..1eab77b94 100644 --- a/tests/integration/conferenceLetters.test.ts +++ b/tests/integration/conferenceLetters.test.ts @@ -156,7 +156,7 @@ describe("sendConferenceLetters", () => { from: '"Ada \\"Ace\\" Lovelace via MAPLE" ' }) expect(sent!.message.subject).toBe( - `[dev] would have gone to: rep@malegislature.gov, sen@malegislature.gov — Phone-Free Schools: Please pass something` + `[dev] would have gone to: rep@malegislature.gov, sen@malegislature.gov — Phone-Free Schools: Pass a final bill` ) expect(sent!.message.html).toContain(`Dear Representative Member ${rep}`) expect(sent!.message.html).toContain( @@ -173,7 +173,7 @@ describe("sendConferenceLetters", () => { kind: "letter", court: COURT, memberCodes: [rep, sen], - subject: "Phone-Free Schools: Please pass something", + subject: "Phone-Free Schools: Pass a final bill", html: sent!.message.html, text: sent!.message.text, createdAt: sent!.createdAt, @@ -234,10 +234,10 @@ describe("sendConferenceLetters", () => { const editId = await event(posted, "edited", 2, noon(1)) await sendConferenceLetters(run(1)) expect((await email(editId))!.message.subject).toMatch( - /Phone-Free Schools: Please pass something \(updated\)$/ + /Phone-Free Schools: Pass a final bill \(updated\)$/ ) expect(await record(editId)).toMatchObject({ - subject: "Phone-Free Schools: Please pass something (updated)", + subject: "Phone-Free Schools: Pass a final bill (updated)", version: 2, updated: true }) @@ -274,9 +274,7 @@ describe("sendConferenceLetters", () => { await publishVersion(posted, 2) const editId = await event(posted, "edited", 2, noon(1)) await sendConferenceLetters(run(1)) - expect((await email(editId))!.message.subject).toMatch( - /Please pass something$/ - ) + expect((await email(editId))!.message.subject).toMatch(/Pass a final bill$/) expect(await record(editId)).toMatchObject({ updated: false }) }) @@ -328,9 +326,7 @@ describe("sendConferenceLetters", () => { ) await sendConferenceLetters(NOW) expect((await skip(first.eventId))!.reason).toBe("superseded") - expect((await email(editId))!.message.subject).toMatch( - /Please pass something$/ - ) + expect((await email(editId))!.message.subject).toMatch(/Pass a final bill$/) }) })