-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Fixed missing onboarding flow in React admin shell #27625
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
Changes from all commits
Commits
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
102 changes: 102 additions & 0 deletions
102
apps/admin/src/onboarding/components/onboarding-checklist.tsx
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 |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| import {Button} from "@tryghost/shade/components"; | ||
| import {LucideIcon} from "@tryghost/shade/utils"; | ||
| import {ONBOARDING_STEPS, type OnboardingStep} from "@/onboarding/constants"; | ||
| import {OnboardingLogoVideo} from "@/onboarding/components/onboarding-logo-video"; | ||
| import {OnboardingStepItem} from "@/onboarding/components/onboarding-step-item"; | ||
|
|
||
| interface OnboardingChecklistProps { | ||
| allStepsCompleted: boolean; | ||
| completedSteps: string[]; | ||
| nextStep: OnboardingStep | undefined; | ||
| onComplete: () => void; | ||
| onDismiss: () => void; | ||
| onStepClick: (step: OnboardingStep) => void; | ||
| siteTitle: string; | ||
| } | ||
|
|
||
| export function OnboardingChecklist({ | ||
| allStepsCompleted, | ||
| completedSteps, | ||
| nextStep, | ||
| onComplete, | ||
| onDismiss, | ||
| onStepClick, | ||
| siteTitle, | ||
| }: OnboardingChecklistProps) { | ||
| const completedStepSet = new Set(completedSteps); | ||
|
|
||
| return ( | ||
| <main className="relative flex min-h-screen flex-col items-center justify-center px-6 py-8"> | ||
| <section className="mt-[-48px] flex w-full flex-col items-center" data-test-dashboard="onboarding-checklist" data-testid="onboarding-checklist"> | ||
| <div className="mb-8 flex flex-col items-center text-center"> | ||
| <OnboardingLogoVideo /> | ||
| {allStepsCompleted ? | ||
| <h1 className="text-[32px] leading-[1.15] font-bold tracking-normal text-foreground max-[480px]:text-[24px]">You're all set.</h1> | ||
| : | ||
| <> | ||
| <h1 className="text-[32px] leading-[1.15] font-bold tracking-normal text-foreground max-[480px]:text-[24px]">Let's get started!</h1> | ||
| <p className="mt-2 mb-0 text-[15px] text-muted-foreground max-[480px]:m-0 max-[480px]:text-[14px]">Welcome! It's time to set up {siteTitle}.</p> | ||
| </> | ||
| } | ||
| </div> | ||
|
|
||
| <div className="w-full max-w-[540px] rounded-md border border-border bg-background px-6 pt-4 pb-1"> | ||
| <div className={`mt-[-12px] flex items-center justify-between py-6 ${nextStep === "customize-design" ? "border-b-0" : "border-b border-border"}`}> | ||
| <span className="flex min-w-0 items-center opacity-20"> | ||
| <LucideIcon.Rocket className="mr-4 size-5 shrink-0 text-purple" /> | ||
| <span className="truncate pr-8 text-[16px] leading-[1.3] font-bold text-foreground">Start a new Ghost publication</span> | ||
| </span> | ||
| <span className="shrink-0 text-green"> | ||
| <LucideIcon.Check className="size-5" /> | ||
| </span> | ||
| </div> | ||
|
|
||
| {ONBOARDING_STEPS.map((step, index) => ( | ||
| <OnboardingStepItem | ||
| key={step.id} | ||
| complete={completedStepSet.has(step.id)} | ||
| id={`ob-${step.id}`} | ||
| isBeforeNext={ONBOARDING_STEPS[index + 1]?.id === nextStep} | ||
| isLast={index === ONBOARDING_STEPS.length - 1} | ||
| isNext={nextStep === step.id} | ||
| step={step} | ||
| onClick={() => onStepClick(step.id)} | ||
| /> | ||
| ))} | ||
| </div> | ||
|
|
||
| {allStepsCompleted && | ||
| <Button | ||
| className="mt-6 h-auto w-full max-w-[540px] px-3 py-3 text-[16px] max-[480px]:text-[15px]" | ||
| data-testid="onboarding-complete" | ||
| id="ob-completed" | ||
| type="button" | ||
| onClick={onComplete} | ||
| > | ||
| Explore your dashboard | ||
| </Button> | ||
| } | ||
|
|
||
| <p className="mt-8 mb-0 text-[15px] text-muted-foreground max-[480px]:text-[14px]"> | ||
| More questions? Check out our{" "} | ||
| <Button asChild className="h-auto p-0 align-baseline text-[15px] text-green hover:text-green/90 max-[480px]:text-[14px]" variant="link"> | ||
| <a href="https://ghost.org/help?utm_source=admin&utm_campaign=onboarding" id="ob-help-center" rel="noreferrer" target="_blank">Help Center</a> | ||
| </Button>. | ||
| </p> | ||
|
|
||
| {!allStepsCompleted && | ||
| <Button | ||
| className="mt-6 h-[38px] overflow-hidden px-3.5 py-px text-[15px] font-normal whitespace-nowrap text-muted-foreground hover:border-gray-300 hover:text-foreground" | ||
| data-testid="onboarding-skip" | ||
| id="ob-skip" | ||
| type="button" | ||
| variant="outline" | ||
| onClick={onDismiss} | ||
| > | ||
| Skip onboarding | ||
| </Button> | ||
| } | ||
| </section> | ||
| </main> | ||
| ); | ||
| } |
40 changes: 40 additions & 0 deletions
40
apps/admin/src/onboarding/components/onboarding-logo-video.tsx
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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import logoLoaderDarkUrl from "@/assets/videos/logo-loader-dark.mp4"; | ||
| import logoLoaderUrl from "@/assets/videos/logo-loader.mp4"; | ||
|
|
||
| export function OnboardingLogoVideo() { | ||
| return ( | ||
| <div className="relative mb-6 size-20"> | ||
| <video | ||
| aria-hidden="true" | ||
| autoPlay | ||
| className="size-20 dark:hidden" | ||
| height={80} | ||
| loop | ||
| muted | ||
| playsInline | ||
| preload="metadata" | ||
| role="presentation" | ||
| tabIndex={-1} | ||
| width={80} | ||
| > | ||
| <source src={logoLoaderUrl} type="video/mp4" /> | ||
| </video> | ||
| <video | ||
| aria-hidden="true" | ||
| autoPlay | ||
| className="hidden size-20 dark:block" | ||
| height={80} | ||
| loop | ||
| muted | ||
| playsInline | ||
| preload="metadata" | ||
| role="presentation" | ||
| tabIndex={-1} | ||
| width={80} | ||
| > | ||
| <source src={logoLoaderDarkUrl} type="video/mp4" /> | ||
| </video> | ||
| <div className="pointer-events-none absolute inset-0 hidden bg-[hsl(216deg_11%_70%/1%)] dark:block" /> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| </div> | ||
| ); | ||
| } | ||
51 changes: 51 additions & 0 deletions
51
apps/admin/src/onboarding/components/onboarding-step-item.tsx
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 |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import {LucideIcon} from "@tryghost/shade/utils"; | ||
| import {type OnboardingStepDefinition} from "@/onboarding/constants"; | ||
|
|
||
| interface OnboardingStepItemProps { | ||
| complete: boolean; | ||
| id: string; | ||
| isBeforeNext: boolean; | ||
| isLast: boolean; | ||
| isNext: boolean; | ||
| onClick: () => void; | ||
| step: OnboardingStepDefinition; | ||
| } | ||
|
|
||
| export function OnboardingStepItem({ | ||
| complete, | ||
| id, | ||
| isBeforeNext, | ||
| isLast, | ||
| isNext, | ||
| onClick, | ||
| step, | ||
| }: OnboardingStepItemProps) { | ||
| const Icon = step.icon; | ||
| const hideBorder = isLast || isBeforeNext || isNext; | ||
| const rowClassName = isNext | ||
| ? `relative z-10 -mx-8 flex w-[calc(100%+64px)] items-center justify-between rounded-md bg-background px-8 py-6 text-left shadow-[0_1px_0_rgba(17,17,26,0.05),0_0_8px_rgba(17,17,26,0.10)] transition-none dark:ring-1 dark:ring-border ${isLast ? "-mb-[18px]" : "mb-1.5"}` | ||
| : `relative flex w-full items-center justify-between bg-transparent py-6 text-left ${hideBorder ? "" : "after:absolute after:inset-x-0 after:bottom-0 after:h-px after:bg-border after:content-['']"}`; | ||
|
|
||
| return ( | ||
| <button | ||
| className={`group ${rowClassName}`} | ||
| data-testid={`onboarding-step-${step.id}`} | ||
| id={id} | ||
| type="button" | ||
| onClick={onClick} | ||
| > | ||
| <span className={`flex min-w-0 items-center ${complete ? "opacity-20 group-hover:opacity-25" : "group-hover:opacity-90"}`}> | ||
| <Icon className="mr-4 size-5 shrink-0 text-purple" /> | ||
| <span className="min-w-0 text-left"> | ||
| <span className="block truncate pr-8 text-[16px] leading-[1.3] font-bold text-foreground">{step.title}</span> | ||
| {isNext && | ||
| <span className="mt-1 block pr-8 text-[15px] leading-[1.4] text-muted-foreground">{step.description}</span> | ||
| } | ||
| </span> | ||
| </span> | ||
| <span className={`flex shrink-0 items-center transition-transform group-hover:translate-x-[5px] ${complete ? "text-green" : "text-purple"}`}> | ||
| {complete ? <LucideIcon.Check className="size-5" /> : <LucideIcon.ArrowRight className="size-3.5" />} | ||
| </span> | ||
| </button> | ||
| ); | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not blocking: I wonder if there is a better way for us to align this with the schema without the typecasts. Maybe we could just inline the defaults below and then parse an empty object to get the default onboarding preferences? 🤔