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

Image Guide Cleanup #28381

Merged
merged 6 commits into from
Jan 17, 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
Expand Up @@ -19,7 +19,7 @@

const criticalCssLink = getRedirectUrl( 'jetpack-boost-critical-css' );
const deferJsLink = getRedirectUrl( 'jetpack-boost-defer-js' );
const lazyLoadlink = getRedirectUrl( 'jetpack-boost-lazy-load' );
const lazyLoadLink = getRedirectUrl( 'jetpack-boost-lazy-load' );

// svelte-ignore unused-export-let - Ignored values supplied by svelte-navigator.
export let location, navigate;
Expand Down Expand Up @@ -102,7 +102,7 @@
`Improve page loading speed by only loading images when they are required. Read more on <link>web.dev</link>.`,
'jetpack-boost'
)}
vars={externalLinkTemplateVar( lazyLoadlink )}
vars={externalLinkTemplateVar( lazyLoadLink )}
/>
</p>
</Module>
Expand All @@ -112,7 +112,7 @@
<h3 slot="title">{__( 'Image Guide', 'jetpack-boost' )}<span class="beta">Beta</span></h3>
<p slot="description">
{__(
`This feature helps you discover the images are too large. When you browse your site, the image guide will show you an overlay with information about each image's size.`,
`This feature helps you discover images that are too large. When you browse your site, the image guide will show you an overlay with information about each image's size.`,
'jetpack-boost'
)}
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public function setup_trigger() {
}

public function enqueue_assets() {
wp_enqueue_script( 'jetpack-boost-image-guide', plugins_url( 'dist/guide.js', __FILE__ ), array(), JETPACK_BOOST_VERSION, true );
wp_enqueue_style( 'jetpack-boost-image-guide', plugins_url( 'dist/guide.css', __FILE__ ), array(), JETPACK_BOOST_VERSION, 'screen' );
wp_enqueue_script( 'jetpack-boost-guide', plugins_url( 'dist/guide.js', __FILE__ ), array(), JETPACK_BOOST_VERSION, true );
wp_enqueue_style( 'jetpack-boost-guide', plugins_url( 'dist/guide.css', __FILE__ ), array(), JETPACK_BOOST_VERSION, 'screen' );
}

/**
Expand All @@ -66,14 +66,14 @@ public function add_to_adminbar( $bar ) {

$bar->add_menu(
array(
'id' => 'jetpack-boost-image-guide',
'id' => 'jetpack-boost-guide',
'parent' => null,
'group' => null,
'title' => __( 'Jetpack Boost', 'jetpack-boost' ),
'href' => admin_url( 'admin.php?page=' . Admin::MENU_SLUG ),
'meta' => array(
'target' => '_self',
'class' => 'jetpack-boost-image-guide',
'class' => 'jetpack-boost-guide',
),
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function discardSmallImages( images: MeasurableImage[] ) {
* Initialize the AdminBarToggle component when the DOM is ready.
*/
document.addEventListener( 'DOMContentLoaded', () => {
const adminBarToggle = document.getElementById( 'wp-admin-bar-jetpack-boost-image-guide' );
const adminBarToggle = document.getElementById( 'wp-admin-bar-jetpack-boost-guide' );
const link = adminBarToggle?.querySelector( 'a' );
if ( adminBarToggle && link ) {
const href = link.getAttribute( 'href' );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { derived, Writable, writable } from 'svelte/store';
const LS_KEY = 'jetpack-boost-guide';
const store = {
active: 'Active',
always_on: 'Always On',
paused: 'Paused',
} as const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import type { GuideSize } from '../types';

export let stores: MeasurableImageStore[];
let show: number | false;
let show: number | false = false;

/**
* This onMount is triggered when the window loads
Expand All @@ -27,9 +27,7 @@
return;
}

if ( $guideState !== 'always_on' ) {
show = false;
}
show = false;
}

function getGuideSize( width = -1, height = -1 ): GuideSize {
Expand All @@ -53,7 +51,6 @@
const sizeOnPage = stores[ 0 ].sizeOnPage;
$: size = getGuideSize( $sizeOnPage.width, $sizeOnPage.height );

$: show = $guideState === 'always_on' ? 0 : false;
$: toggleBackdrop( show !== false );
let position = {
top: 0,
Expand All @@ -68,7 +65,7 @@
}
</script>

{#if $guideState === 'active' || $guideState === 'always_on'}
{#if $guideState === 'active'}
<div
class="guide {size}"
class:show={show !== false}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Minor tweaks