Skip to content

Commit c186685

Browse files
author
cristian-ungureanu
authored
release: new version
### Improvements - **Onboarding UX**: Enhanced the onboarding process for a smoother user experience. ### Bug Fixes - **Onboarding redirection**: Fixed the issue where users got redirected to the old onboarding if they were installing the Cloud Templates & Patterns collection plugin from the dashboard
2 parents 6d79cde + 152da28 commit c186685

30 files changed

+495
-448
lines changed

.eslintrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99
"sourceType": "module"
1010
},
1111
"rules": {
12-
"indent": [
13-
"error",
14-
"tab"
15-
],
12+
"indent": ["error", "tab", { "SwitchCase": 1 }],
1613
"linebreak-style": [
1714
"error",
1815
"unix"

assets/src/Components/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { LicensePanelContext } from './LicensePanelContext';
88

99
const App = ( { onboarding, userStatus } ) => {
1010
if ( onboarding && tiobDash.onboardingAllowed ) {
11-
window.location.href = '/wp-admin/admin.php?page=neve-onboarding';
11+
window.location.href = tiobDash.onboardingRedirect;
1212
return;
1313
}
1414

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/Admin.php

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -502,38 +502,6 @@ public function render_onboarding() {
502502
echo '<div id="ob-app"/>';
503503
}
504504

505-
506-
/**
507-
* Determine if the current user is a new one.
508-
*
509-
* @return bool
510-
*/
511-
private function is_neve_new_user() {
512-
$is_old_user = get_option( 'neve_is_old_user', false );
513-
514-
if ( $is_old_user ) {
515-
return false;
516-
}
517-
518-
$install_time = get_option( 'neve_install' );
519-
520-
if ( empty( $install_time ) ) {
521-
update_option( 'neve_is_old_user', true );
522-
return false;
523-
}
524-
525-
$now = time();
526-
$one_day_ago = $now - 86400; // 86400 seconds in a day (24 hours)
527-
528-
$is_new_user = ( $install_time >= $one_day_ago );
529-
530-
if ( ! $is_new_user ) {
531-
update_option( 'neve_is_old_user', true );
532-
}
533-
534-
return $is_new_user;
535-
}
536-
537505
/**
538506
* Decide if the new onboarding should load
539507
*
@@ -554,16 +522,12 @@ private function should_load_onboarding() {
554522
return false;
555523
}
556524

557-
if ( ! $this->is_neve_new_user() ) {
558-
return false;
559-
}
560-
561525
$onboarding_done = get_option( 'tpc_onboarding_done', 'no' );
562526
if ( $onboarding_done === 'yes' ) {
563527
return false;
564528
}
565529

566-
return true;
530+
return get_option( 'tpc_obd_new_user', 'no' ) === 'yes';
567531
}
568532

569533
/**
@@ -687,10 +651,13 @@ private function get_localization() {
687651
'dismissed' => get_option( self::FEEDBACK_DISMISSED_OPT, false ),
688652
),
689653
'onboardingUpsell' => array(
690-
'dashboard' => tsdk_utmify( 'https://store.themeisle.com/', 'onboarding_upsell' ),
691-
'contact' => tsdk_utmify( 'https://themeisle.com/contact/', 'onboarding_upsell' ),
654+
'dashboard' => tsdk_utmify( 'https://store.themeisle.com/', 'onboarding_upsell' ),
655+
'contact' => tsdk_utmify( 'https://themeisle.com/contact/', 'onboarding_upsell' ),
656+
'upgrade' => tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'onboarding_upsell' ),
657+
'upgradeToast' => tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'onboarding_toast' ),
692658
),
693659
'onboardingAllowed' => $this->should_load_onboarding(),
660+
'onboardingRedirect' => admin_url( 'admin.php?page=neve-onboarding' ),
694661
);
695662
}
696663

onboarding/src/Components/CustomizeControls/ImportOptionsControl.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,23 @@ const ImportOptionsControl = ( {
3232
.join( '' );
3333

3434
const updateDivHeight = () => {
35-
const element = document.querySelector( '.ob-settings-wrap' );
35+
const element = document.querySelector( '.ob-site-settings-container' );
3636
if ( element ) {
37-
setDivHeight( element.offsetHeight + 30 );
37+
setDivHeight( Math.max( element.offsetHeight, 480 ) );
3838
}
3939
};
4040

4141
useEffect( () => {
4242
updateDivHeight(); // Get initial height
4343

44+
const win = document.defaultView;
45+
4446
// Attach event listener for window resize
45-
window.addEventListener( 'resize', updateDivHeight );
47+
win.addEventListener( 'resize', updateDivHeight );
4648

4749
// Clean up the event listener when the component unmounts
4850
return () => {
49-
window.removeEventListener( 'resize', updateDivHeight );
51+
win.removeEventListener( 'resize', updateDivHeight );
5052
};
5153
}, [] );
5254

@@ -88,9 +90,11 @@ const ImportOptionsControl = ( {
8890
),
8991
{
9092
a: (
93+
// eslint-disable-next-line jsx-a11y/anchor-has-content
9194
<a
9295
href="https://wordpress.org/plugins/optimole-wp/"
9396
target={ '_blank' }
97+
rel="external noreferrer noopener"
9498
style={ {
9599
textDecoration: 'none',
96100
display: 'inline-flex',
@@ -130,15 +134,13 @@ const ImportOptionsControl = ( {
130134

131135
const toggleOpen = () => {
132136
setOptionsOpened( ! optionsOpened );
133-
137+
updateDivHeight();
134138
const optionsContainer = document.querySelector(
135139
'.ob-import-options-toggles'
136140
);
137141
const pluginsContainer = document.querySelector( '.ob-import-plugins' );
138142

139-
const container = document.querySelector(
140-
'.ob-site-settings-container'
141-
);
143+
const container = document.querySelector( '.ob-site-settings' );
142144
if ( ! optionsOpened ) {
143145
const newHeight =
144146
optionsContainer.offsetHeight +
@@ -148,8 +150,6 @@ const ImportOptionsControl = ( {
148150
} else {
149151
container.style.minHeight = 'auto';
150152
}
151-
152-
updateDivHeight();
153153
};
154154

155155
return (

onboarding/src/Components/CustomizeControls/LogoControl.js

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { __ } from '@wordpress/i18n';
22
import { compose } from '@wordpress/compose';
33
import { withSelect, withDispatch } from '@wordpress/data';
4-
import { Button, TextControl, Icon } from '@wordpress/components';
5-
import { sendPostMessage } from '../../utils/common';
4+
import { Button } from '@wordpress/components';
65
import { MediaUpload } from '@wordpress/media-utils';
76
import { addFilter } from '@wordpress/hooks';
87
import classnames from 'classnames';
@@ -37,51 +36,55 @@ const LogoControl = ( { userCustomSettings, handleLogoChange } ) => {
3736
value={ siteLogo?.id || '' }
3837
render={ ( { open } ) => (
3938
<>
40-
<div className="ob-media-controls">
41-
<TextControl
42-
value={ logo }
43-
onChange={ () => {} }
44-
/>
45-
<Button isLink onClick={ open }>
46-
{ __(
47-
'Browse',
48-
'templates-patterns-collection'
49-
) }
50-
</Button>
51-
</div>
52-
<div
39+
<button
5340
className={ classnames(
54-
'ob-media-preview',
55-
logo ? 'active' : ''
41+
'ob-media',
42+
logo ? 'has-logo' : ''
5643
) }
44+
onClick={ open }
5745
>
46+
{ ! logo &&
47+
__(
48+
'Select or upload image',
49+
'templates-patterns-collection'
50+
) }
5851
{ logo && (
59-
<>
52+
<span className="ob-responsive-wrapper">
53+
<span
54+
style={ { paddingBottom: '150px' } }
55+
></span>
6056
<img
6157
src={ logo }
6258
alt={ __(
6359
'Uploaded image',
6460
'templates-patterns-collection'
6561
) }
6662
/>
67-
<div className="ob-preview-overlay">
68-
<Button
69-
isTertiary
70-
onClick={ () => {
71-
setLogo( '' );
72-
handleLogoChange( null );
73-
} }
74-
>
75-
<Icon icon="no" />
76-
{ __(
77-
'Remove image',
78-
'templates-patterns-collection'
79-
) }
80-
</Button>
81-
</div>
82-
</>
63+
</span>
8364
) }
84-
</div>
65+
</button>
66+
{ logo && (
67+
<div className="ob-media-actions">
68+
<Button
69+
isTertiary
70+
onClick={ () => {
71+
setLogo( '' );
72+
handleLogoChange( null );
73+
} }
74+
>
75+
{ __(
76+
'Remove',
77+
'templates-patterns-collection'
78+
) }
79+
</Button>
80+
<Button isTertiary onClick={ open }>
81+
{ __(
82+
'Change',
83+
'templates-patterns-collection'
84+
) }
85+
</Button>
86+
</div>
87+
) }
8588
</>
8689
) }
8790
/>
@@ -102,9 +105,11 @@ export default compose(
102105
} ),
103106
withDispatch(
104107
( dispatch, { importData, userCustomSettings, importDataDefault } ) => {
105-
const { setUserCustomSettings, setImportData } = dispatch(
106-
'ti-onboarding'
107-
);
108+
const {
109+
setUserCustomSettings,
110+
setImportData,
111+
setRefresh,
112+
} = dispatch( 'ti-onboarding' );
108113

109114
return {
110115
handleLogoChange: ( newLogo ) => {
@@ -123,27 +128,18 @@ export default compose(
123128
: importDataDefault.theme_mods.custom_logo,
124129
logo_logo: newLogo
125130
? JSON.stringify( {
126-
dark: newLogo.id,
127-
light: newLogo.id,
128-
same: true,
131+
dark: newLogo.id,
132+
light: newLogo.id,
133+
same: true,
129134
} )
130135
: JSON.stringify( {
131-
...importDataDefault.theme_mods
132-
.logo_logo,
136+
...importDataDefault.theme_mods
137+
.logo_logo,
133138
} ),
134139
},
135140
};
136141
setImportData( newImportData );
137-
138-
const logoDisplay = newImportData?.theme_mods?.logo_display;
139-
140-
sendPostMessage( {
141-
type: 'updateSiteInfo',
142-
data: {
143-
...updatedSettings,
144-
logoDisplay,
145-
},
146-
} );
142+
setRefresh( true );
147143
},
148144
};
149145
}

onboarding/src/Components/CustomizeControls/PaletteControl.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { __ } from '@wordpress/i18n';
2-
import { sendPostMessage } from '../../utils/common';
32
import { compose } from '@wordpress/compose';
43
import { withDispatch, withSelect } from '@wordpress/data';
54
import { Button } from '@wordpress/components';
@@ -81,7 +80,7 @@ export default compose(
8180
};
8281
} ),
8382
withDispatch( ( dispatch, { importData, siteStyle, setSiteStyle } ) => {
84-
const { setImportData } = dispatch( 'ti-onboarding' );
83+
const { setImportData, setRefresh } = dispatch( 'ti-onboarding' );
8584

8685
return {
8786
handlePaletteClick: ( paletteKey ) => {
@@ -102,11 +101,7 @@ export default compose(
102101
},
103102
};
104103
setImportData( newImportData );
105-
106-
sendPostMessage( {
107-
type: 'styleChange',
108-
data: newStyle,
109-
} );
104+
setRefresh( true );
110105
},
111106
};
112107
} )

0 commit comments

Comments
 (0)