Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
83ea11f
Footnotes: inscrease selector specificity for anchor (#52179)
ellatrix Jun 30, 2023
2e8830c
Patterns: Include template parts for custom areas in Uncategorized ca…
aaronrobertshaw Jul 3, 2023
db15884
Fix custom patterns console error (#51947)
glendaviesnz Jun 28, 2023
6aaf269
i18n: Add context to the word "Filters" (#52198)
t-hamano Jul 1, 2023
5b1f580
Update home template icon (#52075)
jameskoster Jun 28, 2023
14c54c5
Centralise all permissions lookup in Link UI and enable (#52166)
getdave Jun 30, 2023
0528766
BlockRemovalWarningModal: Fix incorrect '_n' usage (#52164)
Mamaduka Jun 30, 2023
b8229fe
Fix fetching Nav fallback ID flushing Navigation entity cache (#52069)
getdave Jun 29, 2023
ac9cd11
Block Editor: Unify texts for Create pattern modal (#52151)
t-hamano Jun 30, 2023
b0a5943
Fix history back after entering edit mode from Patterns (#52112)
kevin940726 Jun 30, 2023
b64bc8a
Add template part icons to the library grid items (#51963)
carolinan Jun 28, 2023
0702768
Patterns: Fix sidebar tab label (#51953)
aaronrobertshaw Jun 28, 2023
70fda06
Patterns: Fix setting of sync status for fully synced patterns (#51952)
aaronrobertshaw Jun 28, 2023
b59ce7c
Library: Reinstate manage all template parts page (#51961)
aaronrobertshaw Jun 28, 2023
d739511
Command Palette: fix incorrect path and snackbar message when templat…
t-hamano Jun 30, 2023
d4d0106
Drop-indicator: remove white border. (#52122)
jasmussen Jun 29, 2023
7b8db97
Make Navigation fallback selector private (#51413)
getdave Jun 29, 2023
ea6e8c5
Focus Mode: Use the symbol icon if a pattern is being edited (#52031)
carolinan Jun 29, 2023
8064587
Footnotes: register meta field for pages (#52024)
ellatrix Jun 29, 2023
7dbdc17
Fix unintentional toggling on of distraction free (#52090)
draganescu Jun 29, 2023
97e3acf
Revert "Updating social link attributes (#51997)" (#52019)
ramonjd Jun 29, 2023
53c86fc
Update home template name (#52048)
jameskoster Jun 28, 2023
aba35cb
Removes unused call (#51988)
getdave Jun 28, 2023
0ea227a
Remove ability for user to toggle sync status after pattern creation …
glendaviesnz Jun 29, 2023
9d456e4
Fix disable DFM when opening styles command (#52165)
ntsekouras Jun 30, 2023
d45c58c
Update custom patterns label to 'My patterns' (#51949)
SaxonF Jun 28, 2023
28789fc
Library: Add sync status to pattern details screen (#51954)
aaronrobertshaw Jun 28, 2023
b40ea4a
Patterns: Rename Library to Patterns (#52102)
aaronrobertshaw Jun 30, 2023
e29a7c2
[Library] Add lock icon for theme patterns (#51990)
kevin940726 Jun 30, 2023
be810dd
Patterns: Use "detached" copy consistently (#51993)
richtabor Jun 28, 2023
ce47b98
Editor initrial appender: Zero out margins in constrained layouts. (#…
jasmussen Jun 28, 2023
61f8821
Update pattern creation modal in library (#51946)
SaxonF Jun 28, 2023
6271aae
Fix missing snackbars in Library (#52021)
kevin940726 Jun 28, 2023
ad1865a
Make the entire preview clickable in order to enter "edit" mode in fo…
getdave Jun 28, 2023
3efbff4
Page Content Focus: Add welcome guides (#52014)
noisysocks Jul 3, 2023
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
Prev Previous commit
Page Content Focus: Add welcome guides (#52014)
* Page Content Focus: Add welcome guides

* Don't show when editor guide is active

* Just use regular accent/theme color in all guides

* slight copy change page guide

* Update components changelog

* Disable new guides in E2E tests

* Use s.w.org videos

---------

Co-authored-by: Saxon Fletcher <[email protected]>
  • Loading branch information
2 people authored and tellthemachines committed Jul 3, 2023
commit 3efbff45a7beca83f37938e8043164d770533451
9 changes: 2 additions & 7 deletions packages/components/src/guide/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
*/
import { SVG, Circle } from '@wordpress/primitives';

export const PageControlIcon = ( { isSelected }: { isSelected: boolean } ) => (
export const PageControlIcon = () => (
<SVG width="8" height="8" fill="none" xmlns="http://www.w3.org/2000/svg">
<Circle
cx="4"
cy="4"
r="4"
fill={ isSelected ? '#419ECD' : '#E1E3E6' }
/>
<Circle cx="4" cy="4" r="4" />
</SVG>
);
4 changes: 4 additions & 0 deletions packages/components/src/guide/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function Guide( {
<Modal
className={ classnames( 'components-guide', className ) }
contentLabel={ contentLabel }
isDismissible={ pages.length > 1 }
onRequestClose={ onFinish }
onKeyDown={ ( event ) => {
if ( event.code === 'ArrowLeft' ) {
Expand Down Expand Up @@ -144,6 +145,7 @@ function Guide( {
{ canGoBack && (
<Button
className="components-guide__back-button"
variant="tertiary"
onClick={ goBack }
>
{ __( 'Previous' ) }
Expand All @@ -152,6 +154,7 @@ function Guide( {
{ canGoForward && (
<Button
className="components-guide__forward-button"
variant="primary"
onClick={ goForward }
>
{ __( 'Next' ) }
Expand All @@ -160,6 +163,7 @@ function Guide( {
{ ! canGoForward && (
<Button
className="components-guide__finish-button"
variant="primary"
onClick={ onFinish }
>
{ finishButtonText }
Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/guide/page-control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ export default function PageControl( {
>
<Button
key={ page }
icon={
<PageControlIcon
isSelected={ page === currentPage }
/>
}
icon={ <PageControlIcon /> }
aria-label={ sprintf(
/* translators: 1: current page number 2: total number of pages */
__( 'Page %1$d of %2$d' ),
Expand Down
32 changes: 8 additions & 24 deletions packages/components/src/guide/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

&:hover {
svg {
fill: #fff;
fill: $white;
}
}
}
Expand Down Expand Up @@ -57,7 +57,7 @@
&__footer {
align-content: center;
display: flex;
height: 30px;
height: $button-size;
justify-content: center;
margin: 0 0 $grid-unit-30 0;
padding: 0 $grid-unit-40;
Expand All @@ -78,14 +78,18 @@
height: 30px;
min-width: 20px;
margin: -6px 0;
color: $gray-200;
}

li[aria-current="step"] .components-button {
color: var(--wp-components-color-accent, var(--wp-admin-theme-color));
}
}
}

.components-modal__frame.components-guide {
border: none;
min-width: 312px;
height: 80vh;
max-height: 575px;

@media ( max-width: $break-small ) {
Expand All @@ -98,34 +102,14 @@
&.components-guide__back-button,
&.components-guide__forward-button,
&.components-guide__finish-button {
height: 30px;
position: absolute;
}

&.components-guide__back-button,
&.components-guide__forward-button {
font-size: $default-font-size;
padding: 4px 2px;

&.has-text svg {
margin: 0;
}

&:hover {
text-decoration: underline;
}
}

&.components-guide__back-button {
left: $grid-unit-40;
}

&.components-guide__forward-button {
right: $grid-unit-40;
color: #1386bf;
font-weight: bold;
}

&.components-guide__forward-button,
&.components-guide__finish-button {
right: $grid-unit-40;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ export async function visitSiteEditor(
window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideStyles', false );

window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuidePage', false );

window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideTemplate', false );
} );
}

Expand Down
77 changes: 16 additions & 61 deletions packages/e2e-test-utils/src/site-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,68 +17,23 @@ const SELECTORS = {
* Skips the welcome guide popping up to first time users of the site editor
*/
export async function disableSiteEditorWelcomeGuide() {
// This code prioritizes using the preferences store. However, performance
// tests run on older versions of the codebase where the preferences store
// doesn't exist. Some backwards compatibility has been built-in so that
// those tests continue to work there. This can be removed once WordPress
// 6.0 is released, as the older version used by the performance tests will
// then include the preferences store.
// See https://github.com/WordPress/gutenberg/pull/39300.
const isWelcomeGuideActive = await page.evaluate( () => {
// TODO - remove if statement after WordPress 6.0 is released.
if ( ! wp.data.select( 'core/preferences' ) ) {
return wp.data
.select( 'core/edit-site' )
.isFeatureActive( 'welcomeGuide' );
}

return !! wp.data
.select( 'core/preferences' )
?.get( 'core/edit-site', 'welcomeGuide' );
} );
const isWelcomeGuideStyesActive = await page.evaluate( () => {
// TODO - remove if statement after WordPress 6.0 is released.
if ( ! wp.data.select( 'core/preferences' ) ) {
return wp.data
.select( 'core/edit-site' )
.isFeatureActive( 'welcomeGuideStyles' );
}

return !! wp.data
.select( 'core/preferences' )
?.get( 'core/edit-site', 'welcomeGuideStyles' );
await page.evaluate( () => {
window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuide', false );

window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideStyles', false );

window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuidePage', false );

window.wp.data
.dispatch( 'core/preferences' )
.set( 'core/edit-site', 'welcomeGuideTemplate', false );
} );

if ( isWelcomeGuideActive ) {
await page.evaluate( () => {
// TODO - remove if statement after WordPress 6.0 is released.
if ( ! wp.data.dispatch( 'core/preferences' ) ) {
wp.data
.dispatch( 'core/edit-site' )
.toggleFeature( 'welcomeGuide' );
return;
}

wp.data
.dispatch( 'core/preferences' )
.toggle( 'core/edit-site', 'welcomeGuide' );
} );
}

if ( isWelcomeGuideStyesActive ) {
await page.evaluate( () => {
// TODO - remove if statement after WordPress 6.0 is released.
if ( ! wp.data.dispatch( 'core/preferences' ) ) {
wp.data
.dispatch( 'core/edit-site' )
.toggleFeature( 'welcomeGuideStyles' );
return;
}
wp.data
.dispatch( 'core/preferences' )
.toggle( 'core/edit-site', 'welcomeGuideStyles' );
} );
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/welcome-guide/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function WelcomeGuideEditor() {

return (
<Guide
className="edit-site-welcome-guide"
className="edit-site-welcome-guide guide-editor"
contentLabel={ __( 'Welcome to the site editor' ) }
finishButtonText={ __( 'Get started' ) }
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuide' ) }
Expand Down
4 changes: 4 additions & 0 deletions packages/edit-site/src/components/welcome-guide/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
*/
import WelcomeGuideEditor from './editor';
import WelcomeGuideStyles from './styles';
import WelcomeGuidePage from './page';
import WelcomeGuideTemplate from './template';

export default function WelcomeGuide() {
return (
<>
<WelcomeGuideEditor />
<WelcomeGuideStyles />
<WelcomeGuidePage />
<WelcomeGuideTemplate />
</>
);
}
75 changes: 75 additions & 0 deletions packages/edit-site/src/components/welcome-guide/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* WordPress dependencies
*/
import { useDispatch, useSelect } from '@wordpress/data';
import { Guide } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
*/
import { store as editSiteStore } from '../../store';

export default function WelcomeGuidePage() {
const { toggle } = useDispatch( preferencesStore );

const isVisible = useSelect( ( select ) => {
const isPageActive = !! select( preferencesStore ).get(
'core/edit-site',
'welcomeGuidePage'
);
const isEditorActive = !! select( preferencesStore ).get(
'core/edit-site',
'welcomeGuide'
);
const { hasPageContentFocus } = select( editSiteStore );
return isPageActive && ! isEditorActive && hasPageContentFocus();
}, [] );

if ( ! isVisible ) {
return null;
}

const heading = __( 'Editing your page' );

return (
<Guide
className="edit-site-welcome-guide guide-page"
contentLabel={ heading }
finishButtonText={ __( 'Continue' ) }
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuidePage' ) }
pages={ [
{
image: (
<video
className="edit-site-welcome-guide__video"
autoPlay
loop
muted
width="312"
height="240"
>
<source
src="https://s.w.org/images/block-editor/editing-your-page.mp4"
type="video/mp4"
/>
</video>
),
content: (
<>
<h1 className="edit-site-welcome-guide__heading">
{ heading }
</h1>
<p className="edit-site-welcome-guide__text">
{ __(
'We’ve recently introduced the ability to edit pages within the site editor. You can switch to editing your template using the settings sidebar.'
) }
</p>
</>
),
},
] }
/>
);
}
16 changes: 15 additions & 1 deletion packages/edit-site/src/components/welcome-guide/style.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
.edit-site-welcome-guide {
width: 312px;

&__image {
&.guide-editor .edit-site-welcome-guide__image
&.guide-styles .edit-site-welcome-guide__image {
background: #00a0d2;
}

&.guide-page .edit-site-welcome-guide__video {
border-right: #3858e9 $grid-unit-20 solid;
border-top: #3858e9 $grid-unit-20 solid;
}

&.guide-template .edit-site-welcome-guide__video {
border-left: #3858e9 $grid-unit-20 solid;
border-top: #3858e9 $grid-unit-20 solid;
}

&__image {
margin: 0 0 $grid-unit-20;
> img {
display: block;
Expand Down
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/welcome-guide/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function WelcomeGuideStyles() {

return (
<Guide
className="edit-site-welcome-guide"
className="edit-site-welcome-guide guide-styles"
contentLabel={ welcomeLabel }
finishButtonText={ __( 'Get started' ) }
onFinish={ () => toggle( 'core/edit-site', 'welcomeGuideStyles' ) }
Expand Down
Loading