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

Preview limited Global Styles by default #76661

Merged
merged 22 commits into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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 @@ -423,10 +423,10 @@ function wpcom_display_global_styles_launch_bar( $bar_controls ) {

if ( wpcom_is_previewing_global_styles() ) {
$preview_text = __( 'Turn off preview', 'full-site-editing' );
dsas marked this conversation as resolved.
Show resolved Hide resolved
$preview_location = remove_query_arg( 'preview-global-styles' );
$preview_location = add_query_arg( 'hide-global-styles', '' );
} else {
$preview_text = __( 'Turn on preview', 'full-site-editing' );
$preview_location = add_query_arg( 'preview-global-styles', '' );
$preview_location = remove_query_arg( 'hide-global-styles' );
}

ob_start(); ?>
Expand Down Expand Up @@ -534,5 +534,5 @@ function wpcom_is_previewing_global_styles( ?int $user_id = null ) {
}

// phpcs:ignore WordPress.Security.NonceVerification.Recommended
return isset( $_GET['preview-global-styles'] ) && user_can( $user_id, 'administrator' );
return ! isset( $_GET['hide-global-styles'] ) && user_can( $user_id, 'administrator' );
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import WebPreview from 'calypso/components/web-preview/component';
import { useSite } from 'calypso/landing/stepper/hooks/use-site';
import { useSitePreviewShareCode } from 'calypso/landing/stepper/hooks/use-site-preview-share-code';
import { isVideoPressFlow } from 'calypso/signup/utils';
import { usePremiumGlobalStyles } from 'calypso/state/sites/hooks/use-premium-global-styles';
import PreviewToolbar from '../design-setup/preview-toolbar';
import type { Device } from '@automattic/components';

Expand Down Expand Up @@ -45,7 +44,6 @@ const LaunchpadSitePreview = ( {
} ) => {
const translate = useTranslate();
const site = useSite();
const { globalStylesInUse } = usePremiumGlobalStyles( site?.ID );
const isInVideoPressFlow = isVideoPressFlow( flow );
const enableEditOverlay = getEnableEditOverlay( flow );

Expand Down Expand Up @@ -93,7 +91,6 @@ const LaunchpadSitePreview = ( {
// hide cookies popup
preview: true,
do_preview_no_interactions: ! isInVideoPressFlow,
...( globalStylesInUse && { 'preview-global-styles': true } ),
} );
}

Expand Down
2 changes: 1 addition & 1 deletion client/landing/stepper/hooks/use-accent-color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const useAccentColor = () => {
if ( ID ) {
wpcom.req
.get( {
path: `/sites/${ ID }/global-styles-variation/site-accent-color?preview-global-styles=true`,
path: `/sites/${ ID }/global-styles-variation/site-accent-color`,
apiNamespace: 'wpcom/v2',
} )
.then( ( color: string ) => {
Expand Down