Skip to content

Commit 5c30549

Browse files
Merge pull request #4345 from Codeinwp/refactor/onboarding-notice
refactor: onboarding notice
2 parents e4c9da9 + d73cb1a commit 5c30549

File tree

3 files changed

+112
-105
lines changed

3 files changed

+112
-105
lines changed

assets/apps/starter-sites/src/ss-try-button/SSTryButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const SSTryButton: React.FC = () => {
8888
installing || activating ? 'is-loading' : '',
8989
]);
9090

91-
let buttonLabel = __('Try one of our ready to use Starter Sites', 'neve');
91+
let buttonLabel = __('Explore Templates and Start Building Now!', 'neve');
9292
if (installing) {
9393
buttonLabel = __('Installing', 'neve');
9494
}

e2e-tests/specs/admin/tpc-notice-install.spec.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ test.describe('Dashboard Notice', () => {
99

1010
await expect(page).toHaveURL(/wp-admin\/index.php/);
1111

12-
await expect(page.locator('button.install-now')).toContainText(
13-
'Try one of our ready to use Starter Sites'
14-
);
15-
await expect(page.locator('button.install-now')).toBeVisible();
12+
await expect(page.locator('.button.install-now')).toBeVisible();
13+
await expect(page.locator('a.ti-return-dashboard')).toBeVisible();
1614

1715
await Promise.all([
1816
page.waitForURL(/wp-admin\/admin.php\?page=neve-onboarding/),
19-
page.locator('button.install-now').click(),
20-
expect(page.locator('button.install-now')).toContainText(
17+
page.locator('.button.install-now').click(),
18+
expect(page.locator('.button.install-now')).toContainText(
2119
/(Activating|Installing)/
2220
),
2321
]);

inc/core/admin.php

+107-98
Original file line numberDiff line numberDiff line change
@@ -477,27 +477,15 @@ public function welcome_notice_content() {
477477
$theme_page = ! empty( $template ) ? $template . '-welcome' : $slug . '-welcome';
478478

479479
$notice_template = '
480+
<style>%1$s</style>
480481
<div class="nv-notice-wrapper">
481-
%1$s
482-
<hr/>
483482
<div class="nv-notice-column-container">
484483
<div class="nv-notice-column nv-notice-image">%2$s</div>
485484
<div class="nv-notice-column nv-notice-starter-sites">%3$s</div>
486-
<div class="nv-notice-column nv-notice-documentation">%4$s</div>
487485
</div>
488486
</div>
489-
<style>%5$s</style>';
490-
491-
/* translators: 1 - notice title, 2 - notice message */
492-
$notice_header = sprintf(
493-
'<h2>%1$s</h2><p class="about-description">%2$s</p></hr>',
494-
esc_html__( 'Congratulations!', 'neve' ),
495-
sprintf(
496-
/* translators: %s - theme name */
497-
esc_html__( '%s is now installed and ready to use. We\'ve assembled some links to get you started.', 'neve' ),
498-
$name
499-
)
500-
);
487+
';
488+
501489
$ob_btn_link = admin_url( 'admin.php?page=' . $theme_page . '&onboarding=yes#starter-sites' );
502490
if ( defined( 'TIOB_PATH' ) ) {
503491
$url_path = 'admin.php?page=tiob-starter-sites';
@@ -506,64 +494,70 @@ public function welcome_notice_content() {
506494
}
507495
$ob_btn_link = admin_url( $url_path );
508496
}
509-
$ob_btn = sprintf(
510-
/* translators: 1 - onboarding url, 2 - button text */
497+
498+
$onboarding_starter_sites_btn = sprintf(
511499
'<a href="%1$s" class="button button-primary button-hero install-now" >%2$s</a>',
512500
esc_url( $ob_btn_link ),
513-
sprintf( apply_filters( 'ti_onboarding_neve_start_site_cta', esc_html__( 'Try one of our ready to use Starter Sites', 'neve' ) ) )
501+
sprintf( apply_filters( 'ti_onboarding_neve_start_site_cta', esc_html__( 'Explore Templates and Start Building Now!', 'neve' ) ) )
514502
);
515-
$ob_return_dashboard = sprintf(
516-
/* translators: 1 - button text */
517-
'<a href="' . esc_url( admin_url() ) . '" class=" ti-return-dashboard button button-secondary button-hero install-now" ><span>%1$s</span></a>',
518-
__( 'Return to your dashboard', 'neve' )
503+
504+
$onboarding_notice_exit_btn = sprintf(
505+
'<a href="%1$s" class="ti-return-dashboard button button-link button-hero" >
506+
<span>%2$s</span>
507+
</a>',
508+
esc_url( admin_url( '?page=neve-welcome' ) ),
509+
__( 'I want to build this website from scratch', 'neve' )
519510
);
520-
$options_page_btn = sprintf(
521-
/* translators: 1 - options page url, 2 - button text */
522-
'<a href="%1$s" class="options-page-btn">%2$s</a>',
523-
esc_url( admin_url( 'admin.php?page=' . $theme_page ) ),
524-
esc_html__( 'or go to the theme settings', 'neve' )
511+
512+
$onboarding_thank_you_label = sprintf(
513+
// translators: %s: the name of the theme (Neve Theme).
514+
__( 'Thanks for downloading %s', 'neve' ),
515+
__( 'Neve Theme', 'neve' )
516+
) . ' 🎉';
517+
$onboarding_title_label = __( 'Create a Unique Site, Your Way', 'neve' );
518+
$onboarding_dashboard_label = __( 'Building your site shouldn\'t feel overwhelming. Choose a starter site, make it your own, and launch your website faster than ever before.', 'neve' );
519+
520+
$notice_starter_sites_container = sprintf(
521+
'
522+
<span class="nv-notice-thank-you">%1$s</span>
523+
<h2 class="nv-notice-title">%2$s</h2>
524+
<p class="about-description">%3$s</h3>
525+
<div class="nv-notice-actions">
526+
<div id="neve-ss-install">
527+
%4$s
528+
</div>
529+
%5$s
530+
</div>
531+
',
532+
$onboarding_thank_you_label,
533+
$onboarding_title_label,
534+
$onboarding_dashboard_label,
535+
$onboarding_starter_sites_btn,
536+
$onboarding_notice_exit_btn
525537
);
526-
$notice_picture = sprintf(
527-
'<picture>
528-
<source srcset="about:blank" media="(max-width: 1024px)">
529-
<img src="%1$s"/>
530-
</picture>',
538+
539+
$notice_picture = sprintf(
540+
'<img src="%1$s"/>',
531541
esc_url( $this->get_notice_picture() )
532542
);
533-
$notice_sites_list = sprintf(
534-
'<div><h3><span class="dashicons dashicons-images-alt2"></span> %1$s</h3><p>%2$s</p><p>%3$s</p></div><div> <p id="neve-ss-install">%4$s</p><p>%5$s</p> </div>',
535-
__( 'Sites Library', 'neve' ),
536-
// translators: %s - Theme name
537-
sprintf( esc_html__( '%s now comes with a sites library with various designs to pick from. Visit our collection of demos that are constantly being added.', 'neve' ), $name ),
538-
esc_html( __( 'Install the template patterns plugin to get started.', 'neve' ) ),
539-
$ob_btn,
540-
$options_page_btn
541-
);
542-
$notice_documentation = sprintf(
543-
'<div><h3><span class="dashicons dashicons-format-aside"></span> %1$s</h3><p>%2$s</p><a target="_blank" rel="external noopener noreferrer" href="%3$s"><span class="screen-reader-text">%4$s</span><svg xmlns="http://www.w3.org/2000/svg" focusable="false" role="img" viewBox="0 0 512 512" width="12" height="12" style="margin-right: 5px;"><path fill="currentColor" d="M432 320H400a16 16 0 0 0-16 16V448H64V128H208a16 16 0 0 0 16-16V80a16 16 0 0 0-16-16H48A48 48 0 0 0 0 112V464a48 48 0 0 0 48 48H400a48 48 0 0 0 48-48V336A16 16 0 0 0 432 320ZM488 0h-128c-21.4 0-32 25.9-17 41l35.7 35.7L135 320.4a24 24 0 0 0 0 34L157.7 377a24 24 0 0 0 34 0L435.3 133.3 471 169c15 15 41 4.5 41-17V24A24 24 0 0 0 488 0Z"/></svg>%5$s</a></div><div> <p>%6$s</p></div>',
544-
__( 'Documentation', 'neve' ),
545-
// translators: %s - Theme name
546-
sprintf( esc_html__( 'Need more details? Please check our full documentation for detailed information on how to use %s.', 'neve' ), $name ),
547-
'https://docs.themeisle.com/article/946-neve-doc',
548-
esc_html__( '(opens in a new tab)', 'neve' ),
549-
esc_html__( 'Read full documentation', 'neve' ),
550-
$ob_return_dashboard
551-
);
543+
552544
$style = '
553-
.nv-notice-wrapper h2{
545+
.nv-notice-wrapper .nv-notice-title {
546+
font-size: 23px;
547+
font-weight: bold;
548+
line-height: 1.5;
554549
margin: 0;
555-
font-size: 21px;
556-
font-weight: 400;
557-
line-height: 1.2;
550+
padding: 9px 0 4px;
558551
}
559552
.nv-notice-wrapper p.about-description{
560553
color: #72777c;
561-
font-size: 16px;
562-
margin: 0;
563-
padding:0px;
554+
font-size: 15px;
555+
margin: 2px 0 5px;
556+
padding: 0 2px;
557+
line-height: 1.6;
564558
}
565559
.nv-notice-wrapper{
566-
padding: 23px 10px 0;
560+
padding: 23px 10px;
567561
max-width: 1500px;
568562
}
569563
.nv-notice-wrapper hr {
@@ -581,56 +575,69 @@ public function welcome_notice_content() {
581575
}
582576
.nv-notice-text p.ti-return-dashboard {
583577
margin-top: 30px;
584-
}
585-
.nv-notice-column-container .nv-notice-column{
586-
padding-right: 40px;
587578
}
588-
.nv-notice-column-container img{
589-
margin-top: 23px;
590-
width: calc(100% - 40px);
579+
.nv-notice-column-container img {
591580
border: 1px solid #f3f4f5;
581+
max-height: 300px;
582+
width: fit-content;
592583
}
593584
.nv-notice-column-container {
594-
display: -ms-grid;
595-
display: grid;
596-
-ms-grid-columns: 24% 32% 32%;
597-
grid-template-columns: 24% 32% 32%;
598-
margin-bottom: 13px;
585+
display: flex;
586+
flex-direction: row;
587+
gap: 48px;
599588
}
600-
.nv-notice-column-container .button.button-hero:is( .button-primary, .button-secondary ) {
589+
.nv-notice-column-container .button.button-hero:is( .button-primary, .button-link ) {
601590
margin: 0px;
602591
white-space: normal;
603592
text-align: center;
604593
line-height: 1.2;
605594
padding: 12px 36px;
606595
}
607-
.nv-notice-column-container .nv-notice-column:not(.nv-notice-image) {
608-
display: -ms-grid;
609-
display: grid;
610-
-ms-grid-rows: auto 100px;
611-
grid-template-rows: auto 100px;
596+
.nv-notice-column-container .button.button-hero:is( .button-primary ) {
597+
background-color: rgb(69, 89, 217);
612598
}
613-
@media screen and (max-width: 1280px) {
614-
.nv-notice-wrapper .nv-notice-column-container {
615-
-ms-grid-columns: 50% 50%;
616-
grid-template-columns: 50% 50%;
617-
}
618-
.nv-notice-column-container a.button.button-hero.button-secondary,
619-
.nv-notice-column-container a.button.button-hero.button-primary{
620-
padding:6px 18px;
599+
.nv-notice-column-container .button.button-hero:is( .button-link ) {
600+
padding: 12px 7px;
601+
color: #72777c;
602+
text-decoration: none;
603+
}
604+
.nv-notice-column-container .nv-notice-column {
605+
display: flex;
606+
flex-direction: column;
607+
justify-content: center;
608+
}
609+
.nv-notice-actions {
610+
display: flex;
611+
flex-direction: row;
612+
gap: 10px;
613+
margin-top: 20px;
614+
}
615+
.nv-notice-starter-sites {
616+
max-width: 750px;
617+
}
618+
.nv-notice-thank-you {
619+
color:#3b5de6;
620+
font-size:14px;
621+
font-style:normal;
622+
font-weight:400;
623+
margin: 0;
624+
padding: 9px 0 4px;
625+
}
626+
@media (max-width: 1200px) {
627+
.nv-notice-column-container {
628+
flex-direction: column-reverse;
629+
gap: 10px;
630+
text-align: center;
631+
align-items: center;
621632
}
622-
.nv-notice-wrapper .nv-notice-image {
623-
display: none;
633+
.nv-notice-column-container .nv-notice-column {
634+
align-items: center;
624635
}
625636
}
626-
@media screen and (max-width: 870px) {
627-
628-
.nv-notice-wrapper .nv-notice-column-container {
629-
-ms-grid-columns: 100%;
630-
grid-template-columns: 100%;
631-
}
632-
.nv-notice-column-container a.button.button-hero.button-primary{
633-
padding:12px 36px;
637+
@media (max-width: 480px) {
638+
.nv-notice-actions {
639+
flex-direction: column;
640+
align-items: center;
634641
}
635642
}
636643
@-webkit-keyframes spin {
@@ -651,15 +658,17 @@ public function welcome_notice_content() {
651658
animation-iteration-count: infinite;
652659
animation-timing-function: linear;
653660
}
661+
.notice:has(.nv-notice-thank-you) {
662+
border-left-width: 2px;
663+
border-left-color: #c3c4c7;
664+
}
654665
';
655666

656667
echo sprintf(
657668
$notice_template, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
658-
$notice_header, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
669+
$style, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
659670
$notice_picture, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
660-
$notice_sites_list, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
661-
$notice_documentation, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
662-
$style // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
671+
$notice_starter_sites_container // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
663672
);
664673
}
665674

0 commit comments

Comments
 (0)