-
Notifications
You must be signed in to change notification settings - Fork 18
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
Studio: Replace button loading indicator with full window one #362
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
79793c0
Add basic logic for a new site adding state
93818f0
Remove state that handles adding a site
218e36a
Close modal
631bb17
Add progress bar for loading
332acc4
Jump to a new site when it is created
8356362
Add sidebar spinner
fd411db
Add site name to the loading screen
5e67070
Throw error when creating a site fails
bc793c4
Add error handling and remove temporary state when error occurs
2ab04ce
Remove tests not necessary for the new flow
578491b
fix end to end tests
2f42293
Generate random ID for temptorary state
b3ba3b6
Remove adding site string from onboarding
31548b9
Remove adding site string from onboarding
566ef6f
Add bug fix and improve the UI flow
4bbe32d
Centralize error handling
d180b37
Disable the add site button when a site is being added
8fe0c6c
Remove busy states from onboarding add site button
d83fd0d
Make the progress bar more dynamic for faster visual effect
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 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useI18n } from '@wordpress/react-i18n'; | ||
import { useEffect } from 'react'; | ||
import { useProgressTimer } from '../hooks/use-progress-timer'; | ||
import ProgressBar from './progress-bar'; | ||
|
||
export function SiteLoadingIndicator( { selectedSiteName }: { selectedSiteName?: string } ) { | ||
const { __ } = useI18n(); | ||
|
||
const { progress, setProgress } = useProgressTimer( { | ||
initialProgress: 20, | ||
interval: 1500, | ||
maxValue: 95, | ||
} ); | ||
|
||
useEffect( () => { | ||
const updateProgress = () => { | ||
setProgress( ( prev ) => { | ||
const increment = Math.random() * 10 + 5; | ||
return Math.min( prev + increment, 95 ); | ||
} ); | ||
}; | ||
|
||
setProgress( 50 ); | ||
const interval = setInterval( updateProgress, 1000 ); | ||
|
||
return () => clearInterval( interval ); | ||
}, [ setProgress ] ); | ||
|
||
return ( | ||
<div className="flex flex-col w-full h-full app-no-drag-region pt-8 overflow-y-auto justify-center items-center"> | ||
<div className="w-[300px] text-center"> | ||
<div className="text-black a8c-subtitle-small mb-4">{ selectedSiteName }</div> | ||
<ProgressBar value={ progress } maxValue={ 100 } /> | ||
<div className="text-a8c-gray-70 a8c-body mt-4">{ __( 'Creating site...' ) }</div> | ||
</div> | ||
katinthehatsite marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
); | ||
} |
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.
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.
Nice!