Skip to content

Commit cfefc88

Browse files
authored
Feat: new stackable admin page (#3633)
* move stackable settings to top level menu * update settings url, remove script after execution * update tests * chore: version bumped to 3.19.2 * move stackable settings to top level menu * update settings url, remove script after execution * update tests * redirect go premium * update test --------- Co-authored-by: [email protected] <>
1 parent c7c5f8c commit cfefc88

File tree

7 files changed

+147
-90
lines changed

7 files changed

+147
-90
lines changed

e2e/tests/admin.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ test( 'Activating Stackable should redirect to the Getting Started Page', async
1818
await activate.click()
1919

2020
try {
21-
await expect( page ).toHaveURL( /stackable-getting-started/ )
21+
await expect( page ).toHaveURL( /stackable/ )
22+
await expect( page.getByText( 'Welcome to Stackable' ) ).toBeVisible()
2223
} catch {
2324
await expect( page ).toHaveURL( /page=stackable/ )
2425
await expect( page.getByRole( 'link', { name: 'Activate Free Version' } ) ).toBeVisible()
2526
await page.getByRole( 'link', { name: 'Activate Free Version' } ).click()
2627
await page.getByRole( 'link', { name: 'Skip', exact: true } ).click()
27-
await expect( page ).toHaveURL( /stackable-getting-started/ )
28+
await expect( page ).toHaveURL( /stackable/ )
29+
await expect( page.getByText( 'Welcome to Stackable' ) ).toBeVisible()
2830
}
2931
} )
3032

@@ -36,7 +38,7 @@ test( 'Stackable settings should be saved', async ( {
3638
// Start waiting for Stackable Settings JSON Response before visiting the page
3739
let settings = stackable.waitForSettings()
3840

39-
await admin.visitAdminPage( 'options-general.php?page=stackable' )
41+
await admin.visitAdminPage( 'admin.php?page=stackable-settings' )
4042
// Make sure all Stackable settings are loaded
4143
await settings
4244

freemius.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function sugb_fs() {
2525
// Do not redirect to the getting started when in network activating
2626
// in multisite or in the mainsite because it will redirect to a 404
2727
// page.
28-
$first_path = 'options-general.php?page=stackable-getting-started';
28+
$first_path = 'admin.php?page=stackable';
2929
if ( is_multisite() && is_main_site() ) {
3030
$first_path = 'plugins.php';
3131
}
@@ -34,7 +34,7 @@ function sugb_fs() {
3434
// https://github.com/Freemius/wordpress-sdk/issues/674 If the menu
3535
// slug is options-general, for a network activated plugin, all
3636
// admin URLs will be broken. This is a temporary fix.
37-
$menu_slug = 'options-general.php';
37+
$menu_slug = 'stackable';
3838
if ( is_multisite() && is_main_site() && is_plugin_active_for_network( plugin_basename( STACKABLE_FILE ) ) ) {
3939
if ( ! empty( $_SERVER ) && isset( $_SERVER['REQUEST_URI'] ) && stripos( $_SERVER['REQUEST_URI'], '/admin.php' ) !== false ) {
4040
$menu_slug = 'admin.php';
@@ -54,8 +54,8 @@ function sugb_fs() {
5454
'menu' => array(
5555
'slug' => 'stackable',
5656
'first-path' => $first_path,
57-
'account' => true,
58-
'pricing' => true,
57+
'account' => false,
58+
'pricing' => false,
5959
'contact' => true,
6060
'support' => false,
6161
'affiliation' => false,

src/init.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public function register_block_editor_assets() {
345345
'devMode' => defined( 'WP_ENV' ) ? WP_ENV === 'development' : false,
346346
'cdnUrl' => STACKABLE_DESIGN_LIBRARY_URL,
347347
'currentTheme' => esc_html( get_template() ),
348-
'settingsUrl' => admin_url( 'options-general.php?page=stackable' ),
348+
'settingsUrl' => admin_url( 'admin.php?page=stackable-settings' ),
349349
'version' => array_shift( $version_parts ),
350350
'wpVersion' => ! empty( $wp_version ) ? preg_replace( '/-.*/', '', $wp_version ) : $wp_version, // Ensure semver, strip out after dash
351351
'adminUrl' => admin_url(),

src/welcome/admin.scss

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,16 @@ body[class*="page_stk-"] {
344344
margin-bottom: 32px;
345345
padding-bottom: 0;
346346
}
347-
body.settings_page_stackable {
347+
body.stackable_page_stackable-settings {
348348
#wpwrap {
349349
background: #fff;
350350
}
351351
.s-box {
352352
box-shadow: none !important;
353353
}
354354
}
355-
body.settings_page_stackable,
356-
body.settings_page_stackable-getting-started {
355+
body.stackable_page_stackable-settings,
356+
body.toplevel_page_stackable {
357357
// Hide admin notices to not mess up the welcome screen.
358358
.s-header > *:not(h1):not(img) {
359359
display: none !important;
@@ -369,9 +369,10 @@ body.settings_page_stackable-getting-started {
369369
padding-bottom: 0;
370370
}
371371
}
372-
body.settings_page_stackable,
373-
body.settings_page_stackable-getting-started,
374-
body.toplevel_page_stk-custom-fields {
372+
body.stackable_page_stackable-settings,
373+
body.toplevel_page_stackable,
374+
body.stackable_page_stk-custom-fields,
375+
body.stackable_page_stackable-go-premium {
375376
img {
376377
max-width: 100%;
377378
}
@@ -912,6 +913,29 @@ body.toplevel_page_stk-custom-fields {
912913
}
913914
}
914915

916+
body.stackable_page_stackable-go-premium {
917+
.s-side {
918+
display: grid;
919+
padding: 50px;
920+
grid-template-columns: 1fr 1fr;
921+
grid-template-rows: 1fr 1fr;
922+
grid-column-gap: 50px;
923+
align-items: start;
924+
}
925+
926+
.s-premium-box {
927+
grid-row: 1/3;
928+
.s-check-list {
929+
margin: auto;
930+
width: fit-content;
931+
text-align: left;
932+
}
933+
}
934+
.s-box {
935+
text-align: center;
936+
}
937+
}
938+
915939
@import "news";
916940
@import "getting-started";
917941
@import "freemius";

src/welcome/freemius.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@
128128
* Contact and pricing/checkout pages have an SSL banner on the top, add more space.
129129
*/
130130
body.stackable_page_stackable-contact {
131-
.s-header {
132-
padding-top: 65px !important;
133-
padding-bottom: 100px !important;
131+
.s-header-wrap {
132+
padding-top: 10px !important;
134133
}
135134
}
136135
body.stackable_page_stackable-pricing {

src/welcome/getting-started.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
}
1212

13-
.settings_page_stackable-getting-started {
13+
.toplevel_page_stackable {
1414
.s-body {
1515
max-width: 1200px;
1616
margin: 0 auto;

0 commit comments

Comments
 (0)