-
Notifications
You must be signed in to change notification settings - Fork 536
New onboarding #2425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New onboarding #2425
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,44 +1,63 @@ | ||
| import type { ComponentType } from "react"; | ||
|
|
||
| import { ConfigureNotice } from "./configure-notice"; | ||
| import { Login } from "./login"; | ||
| import { Permissions } from "./permissions"; | ||
| import { Welcome } from "./welcome"; | ||
| import type { Search } from "../../routes/app/onboarding"; | ||
| import { ConfigureNotice, STEP_ID_CONFIGURE_NOTICE } from "./configure-notice"; | ||
| import { Login, STEP_ID_LOGIN } from "./login"; | ||
| import { Permissions, STEP_ID_PERMISSIONS } from "./permissions"; | ||
| import { STEP_ID_WELCOME, Welcome } from "./welcome"; | ||
|
|
||
| export type OnboardingStepId = | ||
| | "welcome" | ||
| | "login" | ||
| | "configure-notice" | ||
| | "permissions"; | ||
| export type NavigateTarget = Omit<Search, "step"> & { | ||
| step: Search["step"] | "done"; | ||
| }; | ||
|
|
||
| export type StepProps = { | ||
| onNavigate: (step: OnboardingStepId | "done") => void; | ||
| onNavigate: (ctx: NavigateTarget) => void; | ||
| }; | ||
|
|
||
| export function getNextAfterLogin( | ||
| platform: string, | ||
| isPro: boolean, | ||
| ): OnboardingStepId | "done" { | ||
| if (!isPro) { | ||
| return "configure-notice"; | ||
| export function getNext(ctx: Search): Search["step"] | "done" { | ||
| switch (ctx.step) { | ||
| case STEP_ID_WELCOME: | ||
| if (ctx.local) return STEP_ID_CONFIGURE_NOTICE; | ||
| if (ctx.platform === "macos") return STEP_ID_PERMISSIONS; | ||
| return STEP_ID_LOGIN; | ||
| case STEP_ID_PERMISSIONS: | ||
| return ctx.local ? STEP_ID_CONFIGURE_NOTICE : STEP_ID_LOGIN; | ||
| case STEP_ID_LOGIN: | ||
| return ctx.pro ? "done" : STEP_ID_CONFIGURE_NOTICE; | ||
| case STEP_ID_CONFIGURE_NOTICE: | ||
| return "done"; | ||
| } | ||
| return platform === "macos" ? "permissions" : "done"; | ||
| } | ||
|
|
||
| export function getNextAfterConfigureNotice( | ||
| platform: string, | ||
| ): OnboardingStepId | "done" { | ||
| return platform === "macos" ? "permissions" : "done"; | ||
| export function getBack(ctx: Search): Search["step"] | null { | ||
| switch (ctx.step) { | ||
| case STEP_ID_WELCOME: | ||
| return null; | ||
| case STEP_ID_PERMISSIONS: | ||
| return STEP_ID_WELCOME; | ||
| case STEP_ID_LOGIN: | ||
| return ctx.platform === "macos" ? STEP_ID_PERMISSIONS : STEP_ID_WELCOME; | ||
| case STEP_ID_CONFIGURE_NOTICE: | ||
| if (ctx.local) return STEP_ID_WELCOME; | ||
| return STEP_ID_LOGIN; | ||
| } | ||
| } | ||
|
|
||
| type StepConfig = { | ||
| id: OnboardingStepId; | ||
| id: Search["step"]; | ||
| component: ComponentType<StepProps>; | ||
| }; | ||
|
|
||
| export const STEP_IDS = [ | ||
| STEP_ID_WELCOME, | ||
| STEP_ID_LOGIN, | ||
| STEP_ID_CONFIGURE_NOTICE, | ||
| STEP_ID_PERMISSIONS, | ||
| ] as const; | ||
|
|
||
| export const STEP_CONFIGS: StepConfig[] = [ | ||
| { id: "welcome", component: Welcome }, | ||
| { id: "login", component: Login }, | ||
| { id: "configure-notice", component: ConfigureNotice }, | ||
| { id: "permissions", component: Permissions }, | ||
| { id: STEP_ID_WELCOME, component: Welcome }, | ||
| { id: STEP_ID_LOGIN, component: Login }, | ||
| { id: STEP_ID_CONFIGURE_NOTICE, component: ConfigureNotice }, | ||
| { id: STEP_ID_PERMISSIONS, component: Permissions }, | ||
| ]; |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.