Skip to content
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

Edit Site: Update progress bar to determinate #53399

Merged
merged 2 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion packages/edit-site/src/components/canvas-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
import { privateApis as componentsPrivateApis } from '@wordpress/components';
import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -19,11 +21,20 @@ export default function CanvasLoader( { id } ) {
const { highlightedColors } = useStylesPreviewColors();
const indicatorColor =
highlightedColors[ 0 ]?.color ?? fallbackIndicatorColor;
const { elapsed, total } = useSelect( ( select ) => {
const selectorsByStatus = select( coreStore ).countSelectorsByStatus();
const resolving = selectorsByStatus.resolving ?? 0;
const finished = selectorsByStatus.finished ?? 0;
return {
elapsed: finished,
total: finished + resolving,
};
}, [] );

return (
<div className="edit-site-canvas-loader">
<Theme accent={ indicatorColor } background={ backgroundColor }>
<ProgressBar id={ id } />
<ProgressBar id={ id } max={ total } value={ elapsed } />
</Theme>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/canvas-loader/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
align-items: center;
justify-content: center;

animation: 0.5s ease 1s edit-site-canvas-loader__fade-in-animation;
animation: 0.5s ease 0.2s edit-site-canvas-loader__fade-in-animation;
animation-fill-mode: forwards;
@include reduce-motion("animation");

Expand Down