-
Notifications
You must be signed in to change notification settings - Fork 385
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
Setup wizard: Done screen #4954
Conversation
assets/src/setup/pages/save/index.js
Outdated
<Phone> | ||
<iframe | ||
className="done__preview-iframe" | ||
sandbox="allow-scripts" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sandbox="allow-scripts" | |
sandbox="allow-scripts allow-forms allow-popups allow-presentation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got this in just ahead of my comment below. I'll try it in a little while.
@westonruter This PR is still WIP, but I wanted to flag for you that I made an attempt to hide the admin bar in the iframe using the This PR still has the iframe with the |
I may have been mistaken on the behavior of |
I have another idea: provide a add_action( 'wp_print_footer_scripts', function() {
if ( ! amp_is_dev_mode() || ! is_admin_bar_showing() ) {
return;
}
?>
<script data-ampdevmode>
document.addEventListener( 'DOMContentLoaded', () => {
if ( document.body.classList.contains( 'admin-bar' ) ) {
document.body.classList.remove( 'admin-bar' );
document.documentElement.style.cssText += '; margin-top: 0 !important';
document.getElementById( 'wpadminbar' ).remove();
}
} );
</script>
<?php
} ); But that would still result in a flash of the admin bar appearing momentarily. In any case, this is probably overkill. If the admin bar shows up upon navigation, that's not the end of the world 😄 |
This is very similar: /**
* Hide admin bar if the window is inside the setup wizard iframe.
*/
add_action(
'wp_print_footer_scripts',
function() {
if ( ! amp_is_dev_mode() || ! is_admin_bar_showing() ) {
return;
}
?>
<script data-ampdevmode>
document.addEventListener( 'DOMContentLoaded', function() {
if (!('name' in window) || 'amp-wizard-completion-preview' !== window.name) { // Detects whether the current window is in an iframe.
return;
}
if ( document.body.classList.contains( 'admin-bar' ) ) {
document.body.classList.remove( 'admin-bar' );
document.documentElement.style.cssText += '; margin-top: 0 !important';
document.getElementById( 'wpadminbar' ).remove();
}
});
</script>
<?php
}
); Apparently if a window is in an iframe, the iframe's I don't think this is overkill because it's no more complicated and is maybe more reliable than the query var, and works across navigations, so I'm going to add it. |
Opening this for review after making a round of CSS updates not necessarily directly related to this task. I also removed the feature flag around the setup wizard, so anyone checking out this branch or |
Plugin builds for c73edb0 are ready 🛎️!
|
@jwold The production build in the above comment should work in your local environment out of the box without having to mess with PHP constants. |
|
Now being handled in #4962 |
@westonruter @pierlon This is ready for review again. This PR has become a catch-all for everything we've discussed for the last couple days, and this afternoon while waiting for builds to run I refactored the e2e tests (to allow us to be able to sequence the tests -- which helps with testing persistent options). Sorry about the extra diff. Let me know if you see any issues. |
@johnwatkins0 I went through the wizard after having saved previously with a Reader theme.
To work around this issue I have to make a change to the mode and then switch back to Reader, and then I am taken to the theme selection and see the screenshot as expected on the summary screen. |
Thanks, @westonruter . 7ab0495 should fix that. I had to make some changes to the way options are held in the application state, so that now we have |
@johnwatkins0 When clicking the Finish button I'm getting a JS error: |
a56bd97 should fix that. |
className="done__preview-iframe" | ||
src={ previewPermalink } | ||
title={ __( 'Site preview', 'amp' ) } | ||
name="amp-wizard-completion-preview" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestion that I'm not totally sold on myself: since the admin bar gets hidden at DOMContentLoaded
there is a flash of the admin bar. This could be avoided if we hide the iframe
until the page is loaded.
name="amp-wizard-completion-preview" | |
name="amp-wizard-completion-preview" | |
style={ { opacity: 0 } } | |
onLoad={ ( event ) => { event.target.style.opacity = '1'; } } |
There's probably a more elegant way to do this however. (Including showing a spinner initially.)
Not important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9b707af
@johnwatkins0 When on the Done screen, the Close button and the Finish button do the same thing: Should the close button be removed on the Done screen then? There's no sense to “Exit” the wizard when on the Done screen as the icon implies. Also, I think the Close button should intentionally do Update: Filed as #4974. |
// Initialize page from URL `amp-setup-screen` parameter. If not set, current page is 0. | ||
// This is primarily for testing. | ||
const [ activePageIndex, setActivePageIndex ] = useState( () => { | ||
const index = pages.findIndex( ( { slug } ) => slug === getQueryArg( global.location.href, 'amp-setup-screen' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: I miss this query var 😄 It was useful to be on a screen and reload after changes to avoid having to tap Next Next Next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I put it back? I thought I was probably the only person using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please do. It's nice for development, no?
Updated in 8c320a6. I think we can just let these be button-like because they will be genuine buttons in a few weeks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality checks out. I'll merge once @pierlon gives his +1 on technical specifics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, ship it!
|
Won't other folks have this as well? We'll probably need to ensure whatever value is found is handled gracefully (by silently setting to the correct default value, for example?). |
@schlessera I think he meant the |
Summary
Fixes #4707
This adds the final screen for the setup wizard. Uses are presented with an iframe showing an AMP page on their site in a mobile viewport, along with links to view the site or customize (in Reader mode). The "Next" button becomes "Finish" and links back to AMP settings.
Checklist