-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Stepper: Unify loading states #99158
Merged
Merged
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
adf6316
First iteration on the unified loading bar
escapemanuele 5a9e218
Unused progress in launchpad
escapemanuele 9a2ba9d
Change checkout margin and color
escapemanuele 60b0eaf
Fix StepperLoader
escapemanuele bc200de
Handle wooexpress
escapemanuele 887ce2a
Fix types
escapemanuele 0add66f
Remove old classnames and address wooexpress
escapemanuele c261e19
Handle boot fallback missing padding
escapemanuele 6ad3813
Fix bigsky, launchpad, tailoredcheckout
escapemanuele 346052b
Unused CSS
escapemanuele bd519a4
Fix wooexpress
escapemanuele 1bd9188
Remove unused classname
escapemanuele 149af33
Fix site launch
escapemanuele 90eed85
Not show bar if error on bigsky
escapemanuele 3258912
Converte progress to 0-100
escapemanuele b045f3b
Fix tailored logic
escapemanuele 8a488c7
Default to undefined for progress
escapemanuele fcf9c42
Missing useEffect
escapemanuele b370cf5
Fit unit test
escapemanuele 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
28 changes: 24 additions & 4 deletions
28
client/landing/stepper/declarative-flow/internals/components/stepper-loader/index.tsx
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 |
---|---|---|
@@ -1,10 +1,30 @@ | ||
import { ProgressBar } from '@wordpress/components'; | ||
import clsx from 'clsx'; | ||
import WordPressLogo from 'calypso/components/wordpress-logo'; | ||
import './style.scss'; | ||
|
||
const StepperLoader = () => { | ||
/* eslint-disable wpcalypso/jsx-classname-namespace */ | ||
return <WordPressLogo size={ 72 } className={ clsx( 'wpcom-site__logo', 'stepper-loader' ) } />; | ||
interface StepperLoaderProps { | ||
title?: string; | ||
subtitle?: React.ReactNode; | ||
progress?: number; | ||
className?: string; | ||
} | ||
|
||
const StepperLoader: React.FC< StepperLoaderProps > = ( { | ||
title, | ||
subtitle, | ||
progress = -1, | ||
className, | ||
} ) => { | ||
return ( | ||
<div className={ clsx( 'stepper-loader', className ) }> | ||
<h1 className="stepper-loader__title">{ title }</h1> | ||
<ProgressBar | ||
value={ progress >= 0 ? progress * 100 : undefined } | ||
className="stepper-loader__progress-bar" | ||
/> | ||
{ subtitle && <p className="stepper-loader__subtitle">{ subtitle }</p> } | ||
</div> | ||
); | ||
}; | ||
|
||
export default StepperLoader; |
42 changes: 41 additions & 1 deletion
42
client/landing/stepper/declarative-flow/internals/components/stepper-loader/style.scss
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 |
---|---|---|
@@ -1,3 +1,43 @@ | ||
@import "@wordpress/base-styles/breakpoints"; | ||
@import "@wordpress/base-styles/mixins"; | ||
@import "@automattic/onboarding/styles/mixins"; | ||
|
||
.stepper-loader { | ||
animation: loading-fade 1.6s ease-in-out infinite; | ||
--wp-components-color-foreground: #3858e9; | ||
padding: 1em; | ||
max-width: 540px; | ||
margin: 32vh auto 0; | ||
|
||
&.stepper-loader__boot { | ||
margin-top: calc(32vh + 60px); | ||
} | ||
|
||
.stepper-loader__title { | ||
@include onboarding-font-recoleta; | ||
font-weight: 400; | ||
height: 40px; | ||
letter-spacing: -0.4px; | ||
line-height: 40px; | ||
margin: 0; | ||
text-align: center; | ||
vertical-align: middle; | ||
|
||
font-size: $font-title-medium; | ||
|
||
@include break-medium { | ||
font-size: $font-title-large; | ||
} | ||
} | ||
|
||
.stepper-loader__progress-bar { | ||
margin: 46px auto 0 auto; | ||
} | ||
|
||
.stepper-loader__subtitle { | ||
font-size: 1rem; | ||
line-height: 21px; | ||
letter-spacing: -0.02em; | ||
color: var(--studio-gray-50); | ||
margin-top: 24px; | ||
} | ||
} |
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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Onboard } from '@automattic/data-stores'; | ||
import { getAssemblerDesign } from '@automattic/design-picker'; | ||
import { ProgressBar } from '@wordpress/components'; | ||
import { resolveSelect, useDispatch, useSelect } from '@wordpress/data'; | ||
import { useI18n } from '@wordpress/react-i18n'; | ||
import { useEffect, FormEvent, useState } from 'react'; | ||
import wpcomRequest from 'wpcom-proxy-request'; | ||
import { StepperLoader } from 'calypso/landing/stepper/declarative-flow/internals/components'; | ||
import { SITE_STORE, ONBOARD_STORE } from 'calypso/landing/stepper/stores'; | ||
import { useIsBigSkyEligible } from '../../../../hooks/use-is-site-big-sky-eligible'; | ||
import { useSiteData } from '../../../../hooks/use-site-data'; | ||
|
@@ -122,19 +122,14 @@ const LaunchBigSky: Step = function () { | |
|
||
function LaunchingBigSky() { | ||
return ( | ||
<div className="processing-step__container"> | ||
<div className="processing-step"> | ||
<h1 className="processing-step__progress-step"> | ||
{ __( 'Launching the AI Website Builder' ) } | ||
</h1> | ||
{ ! isError && <ProgressBar className="processing-step__progress-bar" /> } | ||
{ isError && ( | ||
<p className="processing-step__error"> | ||
{ __( 'Something unexpected happened. Please go back and try again.' ) } | ||
</p> | ||
) } | ||
</div> | ||
</div> | ||
<> | ||
<StepperLoader title={ __( 'Launching the AI Website Builder' ) } /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The loading bar will stay rendered when there is an error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed! |
||
{ isError && ( | ||
<p className="processing-step__error"> | ||
{ __( 'Something unexpected happened. Please go back and try again.' ) } | ||
</p> | ||
) } | ||
</> | ||
); | ||
} | ||
|
||
|
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.
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.
We should probably make the progress prop range from 0-100 and do the calculation on the consumer side. This way we can just do
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.
I updated the codebase to use
setProgress
with 0-100 in mind. But to have the indefinite loading (the bar that doesn't follow numbers but goes on indefinitely), we have to not pass a number to value, asAny suggestion?
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.
Now we're failing over to -1 when it's undefined, so if remove the -1, it will be undefined.