-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These should match [onboarding mocks from figma](https://www.figma.com/design/s13B7zs27cadZXUyvxobgW/Mozilla-VPN-Extension?node-id=1848-41802&node-type=frame&t=k3T4A0zHBsqtwmbk-0). Associated PR is up for the string: mozilla-l10n/mozilla-vpn-extension-l10n#3 Updated video: https://github.com/user-attachments/assets/317e48e7-9982-4489-ad19-8651dd5f21a6 The scroll bars in the video on page 2 are due to my browser settings, and won't be seen by most people.
- Loading branch information
Showing
11 changed files
with
486 additions
and
28 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
// @ts-check | ||
|
||
import { Component } from "./component.js"; | ||
// import { VPNController, VPNState } from "../vpncontroller/index.js"; | ||
import { property } from "../shared/property.js"; | ||
import { PropertyType } from "./../shared/ipc.js"; | ||
import { fromStorage, putIntoStorage } from "./vpncontroller/vpncontroller.js"; | ||
|
||
const ONBOARDING_KEY = "mozillaVpnOnboarding"; | ||
const FIRST_PAGE = 1; | ||
export const NUMBER_OF_ONBOARDING_PAGES = 3; | ||
const FIRST_UNUSED_PAGE = NUMBER_OF_ONBOARDING_PAGES + 1; | ||
|
||
/** | ||
* Handles onboarding. | ||
* | ||
*/ | ||
export class OnboardingController extends Component { | ||
static properties = { | ||
nextOnboardingPage: PropertyType.Function, | ||
finishOnboarding: PropertyType.Function, | ||
currentOnboardingPage: PropertyType.Bindable, | ||
}; | ||
|
||
/** | ||
* | ||
* @param {*} receiver | ||
*/ | ||
constructor(receiver) { | ||
super(receiver); | ||
this.#mCurrentOnboardingPage = property(FIRST_PAGE); | ||
} | ||
|
||
async init() { | ||
this.#mCurrentOnboardingPage.value = await fromStorage( | ||
browser.storage.local, | ||
ONBOARDING_KEY, | ||
FIRST_PAGE | ||
); | ||
} | ||
|
||
get currentOnboardingPage() { | ||
return this.#mCurrentOnboardingPage.readOnly; | ||
} | ||
|
||
nextOnboardingPage() { | ||
this.#mCurrentOnboardingPage.set(this.#mCurrentOnboardingPage.value + 1); | ||
} | ||
|
||
finishOnboarding() { | ||
this.#mCurrentOnboardingPage.set(FIRST_UNUSED_PAGE); | ||
putIntoStorage(FIRST_UNUSED_PAGE, browser.storage.local, ONBOARDING_KEY); | ||
} | ||
|
||
#mCurrentOnboardingPage = property(FIRST_PAGE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.