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

Boost: Add cornerstone pages support #39863

Merged
merged 30 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6b3b716
Add a dummy foundation pages class
haqadn Oct 20, 2024
3546a20
changelog
haqadn Oct 20, 2024
99cd265
Boost: Implement partial cloud CSS regeneration (#39833)
haqadn Oct 21, 2024
f56920b
Boost: Add foundation pages UI (#39832)
dilirity Oct 22, 2024
aad1714
Get foundation pages from datasync
haqadn Oct 22, 2024
360d463
Feature flag the foundation pages UI
haqadn Oct 22, 2024
7a41349
Add feature flags to foundation pages class
haqadn Oct 22, 2024
e08497c
Boost: Add foundation provider (#39842)
haqadn Oct 22, 2024
aaf162f
Measure the first foundation page for speed score
haqadn Oct 22, 2024
eda54d7
Add note about blog url always included in foundation pages
dilirity Oct 22, 2024
26092a2
Merge branch 'trunk' into add/foundation-pages
haqadn Oct 23, 2024
471c195
Fix syntax
haqadn Oct 23, 2024
369c665
Update foundation pages description text
dilirity Oct 23, 2024
bcc3a51
Boost: Add "Foundation Page" state in WP's page listing scree (#39878)
dilirity Oct 23, 2024
19be673
Update page speed tooltip text
dilirity Oct 23, 2024
46f1d79
Boost: Add notice when updating a page from the foundation pages list…
dilirity Oct 23, 2024
bc0fd52
Merge remote-tracking branch 'origin/trunk' into add/foundation-pages
haqadn Oct 27, 2024
a420112
Boost: Update foundation page list instructions (#39885)
haqadn Oct 29, 2024
d9f2370
Boost: Add default URLs for foundation pages (#39884)
haqadn Oct 29, 2024
83f7e26
Merge branch 'trunk' into add/foundation-pages
dilirity Oct 30, 2024
c6d999c
Move beta element to its own component
dilirity Oct 30, 2024
256ea1a
Update foundation pages UI to include experiment tag
dilirity Oct 30, 2024
d4bdd66
Update foundation pages description to include upgrade link
dilirity Oct 30, 2024
40bd243
Replace foundation with cornerstone
dilirity Oct 30, 2024
efc8141
Remove feature flag for cornerstone pages
dilirity Oct 30, 2024
d274f58
Fix cornerstone page URLs not starting with a slash
dilirity Oct 30, 2024
b02a3a8
Fix calling undefined method
dilirity Oct 30, 2024
1d301cf
Fix cornerstone pages UI not showing
dilirity Oct 31, 2024
b93eb58
Change wording
dilirity Oct 31, 2024
470ba0d
Update cornerstone description
haqadn Nov 1, 2024
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
7 changes: 1 addition & 6 deletions projects/plugins/boost/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// PhanTypeArraySuspiciousNullable : 15+ occurrences
// PhanPluginDuplicateConditionalNullCoalescing : 10+ occurrences
// PhanTypeMismatchArgumentNullableInternal : 10+ occurrences
// PhanTypeMismatchReturnProbablyReal : 10+ occurrences
// PhanTypeArraySuspicious : 9 occurrences
// PhanTypeMismatchArgument : 8 occurrences
// PhanParamTooMany : 6 occurrences
// PhanPossiblyUndeclaredVariable : 6 occurrences
// PhanTypeMismatchReturnProbablyReal : 6 occurrences
// PhanUndeclaredConstant : 5 occurrences
// PhanUndeclaredFunction : 4 occurrences
// PhanPluginUseReturnValueInternalKnown : 3 occurrences
Expand Down Expand Up @@ -49,12 +49,7 @@
'app/data-sync/Performance_History_Entry.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspicious'],
'app/lib/class-cli.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeMismatchArgument'],
'app/lib/critical-css/Critical_CSS_State.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable'],
'app/lib/critical-css/source-providers/providers/Archive_Provider.php' => ['PhanTypeMismatchReturnProbablyReal'],
'app/lib/critical-css/source-providers/providers/Post_ID_Provider.php' => ['PhanTypeMismatchReturnProbablyReal'],
'app/lib/critical-css/source-providers/providers/Provider.php' => ['PhanTypeMismatchArgumentInternal'],
'app/lib/critical-css/source-providers/providers/Singular_Post_Provider.php' => ['PhanTypeMismatchReturnProbablyReal'],
'app/lib/critical-css/source-providers/providers/Taxonomy_Provider.php' => ['PhanTypeMismatchReturnProbablyReal'],
'app/lib/critical-css/source-providers/providers/WP_Core_Provider.php' => ['PhanTypeMismatchReturnProbablyReal'],
'app/lib/minify/Concatenate_CSS.php' => ['PhanPluginUseReturnValueInternalKnown', 'PhanTypeMismatchArgument'],
'app/lib/minify/Concatenate_JS.php' => ['PhanPluginUseReturnValueInternalKnown', 'PhanPossiblyUndeclaredVariable', 'PhanTypeInvalidUnaryOperandIncOrDec', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypePossiblyInvalidDimOffset'],
'app/lib/minify/Dependency_Path_Mapping.php' => ['PhanUndeclaredConstant'],
Expand Down
15 changes: 8 additions & 7 deletions projects/plugins/boost/app/admin/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ public function constants() {
$internal_path = apply_filters( 'jetpack_boost_asset_internal_path', 'app/assets/dist/' );

$constants = array(
'version' => JETPACK_BOOST_VERSION,
'pluginDirUrl' => untrailingslashit( JETPACK_BOOST_PLUGINS_DIR_URL ),
'assetPath' => plugins_url( $internal_path, JETPACK_BOOST_PATH ),
'canResizeImages' => wp_image_editor_supports( array( 'methods' => array( 'resize' ) ) ),
'site' => array(
'version' => JETPACK_BOOST_VERSION,
'pluginDirUrl' => untrailingslashit( JETPACK_BOOST_PLUGINS_DIR_URL ),
'assetPath' => plugins_url( $internal_path, JETPACK_BOOST_PATH ),
'canResizeImages' => wp_image_editor_supports( array( 'methods' => array( 'resize' ) ) ),
'site' => array(
'url' => get_home_url(),
'domain' => ( new Status() )->get_site_suffix(),
'online' => ! ( new Status() )->is_offline_mode() && ! ( new Status() )->is_private_site(),
'host' => ( new Host() )->get_known_host_guess(),
),
'api' => array(
'api' => array(
'namespace' => JETPACK_BOOST_REST_NAMESPACE,
'prefix' => JETPACK_BOOST_REST_PREFIX,
),
'postTypes' => (object) $this->get_custom_post_types(),
'postTypes' => (object) $this->get_custom_post_types(),
'developmentFeatures' => defined( 'JETPACK_BOOST_DEVELOPMENT_FEATURES' ) && JETPACK_BOOST_DEVELOPMENT_FEATURES,
);

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { __ } from '@wordpress/i18n';
import Meta from './meta/meta';
import SettingsItem from '$features/ui/settings-item/settings-item';
import Pill from '$features/ui/pill/pill';

const CornerstonePages = () => {
return (
<SettingsItem
title={
<>
{ __( 'Cornerstone Pages', 'jetpack-boost' ) }
<Pill text="Experimental" />
</>
}
description={
<p>
{ __(
'List the most important pages of your site. These pages will receive specially tailored optimizations, including targeted critical CSS. The Page Speed scores are based on the first cornerstone page.',
'jetpack-boost'
) }
</p>
}
>
<Meta />
</SettingsItem>
);
};

export default CornerstonePages;
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { useDataSync } from '@automattic/jetpack-react-data-sync-client';
import { z } from 'zod';

/**
* Hook to get the Cornerstone Pages.
*/
export function useCornerstonePages(): [
string[],
( newValue: string[], onSuccessCallback?: () => void ) => void,
] {
const [ { data }, { mutate } ] = useDataSync(
'jetpack_boost_ds',
'cornerstone_pages_list',
z.array( z.string() )
);

function updatePages( newValue: string[], onSuccessCallback?: () => void ) {
mutate( newValue, {
onSuccess: onSuccessCallback,
} );
}

return [ data || [], updatePages ];
}

const CornerstonePagesProperties = z.object( {
max_pages: z.number(),
} );
type CornerstonePagesProperties = z.infer< typeof CornerstonePagesProperties >;

export function useCornerstonePagesProperties(): CornerstonePagesProperties | undefined {
const [ { data } ] = useDataSync(
'jetpack_boost_ds',
'cornerstone_pages_properties',
CornerstonePagesProperties
);

return data;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
.wrapper {
font-size: 14px;
line-height: 22px;

:global(button ~ button) {
margin-left: 20px !important;
}

.head {
display: flex;
flex-direction: row;
align-items: flex-start;

:global(svg) {
fill: var(--jetpack-green-40);
}

.summary {
flex-grow: 1;
margin-right: 5px;
color: var(--gray-40);
}
}

.body {
margin-top: 16px;

.section {
padding: 16px;
border-radius: 4px;
background-color: var(--gray-0);

& ~ .section {
margin-top: 16px;
}

&.has-error {
textarea {
border-color: var( --red-40 );
}

.error-message {
display: block;
color: var( --red-40 );
}

.error {
color: var( --red-40 );
}
}

.title {
margin-bottom: 16px;
font-size: 16px;
line-height: 1;
font-weight: 600;
}

textarea {
display: block;
margin-bottom: 8px;
width: 100%;
padding: 12px 16px;
border-radius: 4px;
border: 1px solid var( --gray-10 );
background: var( --primary-white );
color: #000;
}

.error-message {
display: none;
}

.description {
margin-top: 8px;
font-size: 14px;
line-height: 1.5;
color: var( --gray-60 );
font-weight: 400;
}

label {
display: block;
font-size: 16px;
line-height: 1.5;

&:not(:last-child) {
margin-bottom: 8px;
}
}
}

.button {
margin-top: 16px;
}
}

.see-logs-link {
font-size: 16px;
line-height: 1.5;
}

.logging-toggle {
margin-right: 1em;
float: left;
}

.clearfix {
clear: both;
}
}
Loading
Loading