Skip to content

Commit

Permalink
FXVPN-321 (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesleyjanenorton authored Dec 23, 2024
1 parent 9120d83 commit 40e326d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
8 changes: 7 additions & 1 deletion src/components/message-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class MessageScreen extends LitElement {
this.secondaryAction,
() => html`
<button
class="secondarybtn"
class="secondarybtn ${this.identifier}"
@click=${(e) => {
this.onSecondaryAction(this, e);
}}
Expand All @@ -115,6 +115,12 @@ export class MessageScreen extends LitElement {
}
static styles = css`
${fontStyling}
/* Hide "Skip" on the last onboarding panel */
.onboarding-screen-3.secondarybtn {
visibility: hidden;
}
:host {
--min-block-size: 521px;
/* prevent the panel from shrinking vertically when there isn't as much content */
Expand Down
47 changes: 17 additions & 30 deletions src/components/prefab-screens.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,10 @@ defineMessageScreen({
heading: "Subscribe to Mozilla VPN",
bodyText: tr("bodySubscribeNow"),
primaryAction: tr("btnSubscribeNow"),
onPrimaryAction: () => {
() =>
closeAfter(() => open("https://www.mozilla.org/products/vpn#pricing"));
},
onPrimaryAction: () =>
closeAfter(() => open("https://www.mozilla.org/products/vpn#pricing")),
secondaryAction: tr("getHelp"),
onSecondaryAction: () => {
close(() => open(getHelpUrl));
},
onSecondaryAction: () => closeAfter(() => open(getHelpUrl)),
});

defineMessageScreen({
Expand All @@ -97,13 +93,10 @@ defineMessageScreen({
heading: tr("headerNeedsUpdate"),
bodyText: tr("bodyNeedsUpdate2"),
primaryAction: tr("btnDownloadNow"),
onPrimaryAction: () => {
closeAfter(() => open("https://www.mozilla.org/products/vpn/download/"));
},
onPrimaryAction: () =>
closeAfter(() => open("https://www.mozilla.org/products/vpn/download/")),
secondaryAction: tr("getHelp"),
onSecondaryAction: () => {
close(() => open(getHelpUrl));
},
onSecondaryAction: () => closeAfter(() => open(getHelpUrl)),
});

defineMessageScreen({
Expand All @@ -112,9 +105,7 @@ defineMessageScreen({
heading: tr("headerSignedOut"),
bodyText: tr("bodySignedOut"),
secondaryAction: tr("getHelp"),
onSecondaryAction: () => {
close(() => open(getHelpUrl));
},
onSecondaryAction: () => closeAfter(() => open(getHelpUrl)),
});

defineMessageScreen({
Expand All @@ -126,13 +117,10 @@ defineMessageScreen({
<p class="footnote">${tr("bodyInstallMsgFooter")}</p>
`,
primaryAction: tr("btnDownloadNow"),
onPrimaryAction: () => {
closeAfter(() => open("https://www.mozilla.org/products/vpn/download/"));
},
onPrimaryAction: () =>
closeAfter(() => open("https://www.mozilla.org/products/vpn/download/")),
secondaryAction: tr("getHelp"),
onSecondaryAction: () => {
close(() => open(getHelpUrl));
},
onSecondaryAction: () => closeAfter(() => open(getHelpUrl)),
});

defineMessageScreen({
Expand All @@ -143,23 +131,24 @@ defineMessageScreen({
onPrimaryAction: null,
primaryAction: null,
secondaryAction: tr("getHelp"),
onSecondaryAction: () => {
close(() => open(getHelpUrl));
},
onSecondaryAction: () => closeAfter(() => open(getHelpUrl)),
});

// Need to start loop at 1 because of how the strings were added to l10n repo.
// We need to stop the looop at NUMBER_OF_ONBOARDING_PAGES-1 -> as we want the Telemetry page to
// be last and it has special logic.
for (let i = 1; i <= NUMBER_OF_ONBOARDING_PAGES; i++) {
const lastOnboardingPanel = i == NUMBER_OF_ONBOARDING_PAGES;
const primaryActionText = lastOnboardingPanel ? tr("done") : tr("next");

defineMessageScreen({
tag: `onboarding-screen-${i}`,
img: `onboarding-${i}.svg`,
heading: tr(`onboarding${i}_title`),
bodyText: html` <p>${tr(`onboarding${i}_body`)}</p> `,
primaryAction: tr("next"),
primaryAction: primaryActionText,
onPrimaryAction: () => {
if (i < NUMBER_OF_ONBOARDING_PAGES) {
if (!lastOnboardingPanel) {
onboardingController.nextOnboardingPage();
} else {
onboardingController.finishOnboarding();
Expand All @@ -185,7 +174,5 @@ defineMessageScreen({
onPrimaryAction: null,
primaryAction: null,
secondaryAction: tr("getHelp"),
onSecondaryAction: () => {
close(() => open(getHelpUrl));
},
onSecondaryAction: () => closeAfter(() => open(getHelpUrl)),
});

0 comments on commit 40e326d

Please sign in to comment.