Skip to content

Commit

Permalink
Boost: Add speed score popout (Automattic#36432)
Browse files Browse the repository at this point in the history
* Add speed score popout

* add changelog
  • Loading branch information
dilirity authored Apr 2, 2024
1 parent 9ff8a89 commit 25830a1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { getScoreLetter, didScoresChange } from '@automattic/jetpack-boost-score-api';
import {
getScoreLetter,
didScoresChange,
getScoreMovementPercentage,
} from '@automattic/jetpack-boost-score-api';
import { BoostScoreBar, Button } from '@automattic/jetpack-components';
import { sprintf, __ } from '@wordpress/i18n';
import ContextTooltip from './context-tooltip/context-tooltip';
Expand All @@ -15,6 +19,7 @@ import { useCriticalCssState } from '$features/critical-css/lib/stores/critical-
import { useLocalCriticalCssGeneratorStatus } from '$features/critical-css/local-generator/local-generator-provider';
import { queryClient } from '@automattic/jetpack-react-data-sync-client';
import ErrorBoundary from '$features/error-boundary/error-boundary';
import PopOut from './pop-out/pop-out';

const SpeedScore = () => {
const { site } = Jetpack_Boost;
Expand All @@ -37,6 +42,9 @@ const SpeedScore = () => {
[ data ]
);

const showScoreChangePopOut =
status === 'loaded' && ! scores.isStale && getScoreMovementPercentage( scores );

// Mark performance history data as stale when speed scores are loaded.
useEffect( () => {
if ( site.online && status === 'loaded' ) {
Expand Down Expand Up @@ -141,6 +149,8 @@ const SpeedScore = () => {
</div>
{ site.online && <PerformanceHistory /> }
</div>

<PopOut scoreChange={ showScoreChangePopOut } />
</>
);
};
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/boost/changelog/add-speed-score-prompt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

Speed Score: Add the speed changed popup back.

0 comments on commit 25830a1

Please sign in to comment.