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

Stats: Add loading spinner #28219

Merged
merged 6 commits into from
Jan 10, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Stats: add loading spinner for Stats Dashboard
2 changes: 1 addition & 1 deletion projects/packages/stats-admin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"autotagger": true,
"mirror-repo": "Automattic/jetpack-stats-admin",
"branch-alias": {
"dev-trunk": "0.2.x-dev"
"dev-trunk": "0.3.x-dev"
},
"textdomain": "jetpack-stats-admin",
"version-constants": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/stats-admin/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-stats-admin",
"version": "0.2.2-alpha",
"version": "0.3.0-alpha",
"description": "Stats Dashboard",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/stats-admin/#readme",
"bugs": {
Expand Down
12 changes: 11 additions & 1 deletion projects/packages/stats-admin/src/class-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,18 @@ public function add_wp_admin_submenu() {
*/
public function render() {
?>
<div id="wpcom" class="jp-stats-dashboard">
<div id="wpcom" class="jp-stats-dashboard" style="height: calc(100vh - 100px);">
<div class="hide-if-js"><?php esc_html_e( 'Your Jetpack Stats dashboard requires JavaScript to function properly.', 'jetpack-stats-admin' ); ?></div>
<div class="hide-if-no-js" style="height: 100%">
<img
class="jp-stats-dashboard-loading-spinner"
width="32"
height="32"
style="position: absolute; left: 50%; top: 50%;"
alt=<?php echo esc_attr( __( 'Loading', 'jetpack-stats-admin' ) ); ?>
src="//en.wordpress.com/i/loading/loading-64.gif"
/>
</div>
</div>
<script>
jQuery(document).ready(function($) {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/stats-admin/src/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Main {
/**
* Stats version.
*/
const VERSION = '0.2.2-alpha';
const VERSION = '0.3.0-alpha';

/**
* Singleton Main instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function test_init_sets_initialized() {
* Test has root dom.
*/
public function test_render() {
$this->expectOutputRegex( '/<div id="wpcom" class="jp-stats-dashboard">/i' );
$this->expectOutputRegex( '/<div id="wpcom" class="jp-stats-dashboard".*>/i' );
( new Dashboard() )->render();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


4 changes: 2 additions & 2 deletions projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.