Skip to content
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

Fix design issues #290

Merged
merged 18 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
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
44 changes: 5 additions & 39 deletions includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,38 +502,6 @@ public function render_onboarding() {
echo '<div id="ob-app"/>';
}


/**
* Determine if the current user is a new one.
*
* @return bool
*/
private function is_neve_new_user() {
$is_old_user = get_option( 'neve_is_old_user', false );

if ( $is_old_user ) {
return false;
}

$install_time = get_option( 'neve_install' );

if ( empty( $install_time ) ) {
update_option( 'neve_is_old_user', true );
return false;
}

$now = time();
$one_day_ago = $now - 86400; // 86400 seconds in a day (24 hours)

$is_new_user = ( $install_time >= $one_day_ago );

if ( ! $is_new_user ) {
update_option( 'neve_is_old_user', true );
}

return $is_new_user;
}

/**
* Decide if the new onboarding should load
*
Expand All @@ -554,16 +522,12 @@ private function should_load_onboarding() {
return false;
}

if ( ! $this->is_neve_new_user() ) {
return false;
}

$onboarding_done = get_option( 'tpc_onboarding_done', 'no' );
if ( $onboarding_done === 'yes' ) {
return false;
}

return true;
return get_option( 'tpc_obd_new_user', 'no' ) === 'yes';
}

/**
Expand Down Expand Up @@ -687,8 +651,10 @@ private function get_localization() {
'dismissed' => get_option( self::FEEDBACK_DISMISSED_OPT, false ),
),
'onboardingUpsell' => array(
'dashboard' => tsdk_utmify( 'https://store.themeisle.com/', 'onboarding_upsell' ),
'contact' => tsdk_utmify( 'https://themeisle.com/contact/', 'onboarding_upsell' ),
'dashboard' => tsdk_utmify( 'https://store.themeisle.com/', 'onboarding_upsell' ),
'contact' => tsdk_utmify( 'https://themeisle.com/contact/', 'onboarding_upsell' ),
'upgrade' => tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'onboarding_upsell' ),
'upgradeToast' => tsdk_utmify( 'https://themeisle.com/themes/neve/upgrade/', 'onboarding_toast' ),
),
'onboardingAllowed' => $this->should_load_onboarding(),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ const ImportOptionsControl = ( {
.join( '' );

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

Expand Down Expand Up @@ -91,6 +91,7 @@ const ImportOptionsControl = ( {
<a
href="https://wordpress.org/plugins/optimole-wp/"
target={ '_blank' }
rel="external noreferrer noopener"
style={ {
textDecoration: 'none',
display: 'inline-flex',
Expand Down Expand Up @@ -130,15 +131,13 @@ const ImportOptionsControl = ( {

const toggleOpen = () => {
setOptionsOpened( ! optionsOpened );

updateDivHeight();
const optionsContainer = document.querySelector(
'.ob-import-options-toggles'
);
const pluginsContainer = document.querySelector( '.ob-import-plugins' );

const container = document.querySelector(
'.ob-site-settings-container'
);
const container = document.querySelector( '.ob-site-settings' );
if ( ! optionsOpened ) {
const newHeight =
optionsContainer.offsetHeight +
Expand All @@ -148,8 +147,6 @@ const ImportOptionsControl = ( {
} else {
container.style.minHeight = 'auto';
}

updateDivHeight();
};

return (
Expand Down
82 changes: 43 additions & 39 deletions onboarding/src/Components/CustomizeControls/LogoControl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/compose';
import { withSelect, withDispatch } from '@wordpress/data';
import { Button, TextControl, Icon } from '@wordpress/components';
import { Button } from '@wordpress/components';
import { sendPostMessage } from '../../utils/common';
import { MediaUpload } from '@wordpress/media-utils';
import { addFilter } from '@wordpress/hooks';
Expand Down Expand Up @@ -37,51 +37,55 @@ const LogoControl = ( { userCustomSettings, handleLogoChange } ) => {
value={ siteLogo?.id || '' }
render={ ( { open } ) => (
<>
<div className="ob-media-controls">
<TextControl
value={ logo }
onChange={ () => {} }
/>
<Button isLink onClick={ open }>
{ __(
'Browse',
'templates-patterns-collection'
) }
</Button>
</div>
<div
<button
className={ classnames(
'ob-media-preview',
logo ? 'active' : ''
'ob-media',
logo ? 'has-logo' : ''
) }
onClick={ open }
>
{ ! logo &&
__(
'Select or upload image',
'templates-patterns-collection'
) }
{ logo && (
<>
<span className="ob-responsive-wrapper">
<span
style={ { paddingBottom: '150px' } }
></span>
<img
src={ logo }
alt={ __(
'Uploaded image',
'templates-patterns-collection'
) }
/>
<div className="ob-preview-overlay">
<Button
isTertiary
onClick={ () => {
setLogo( '' );
handleLogoChange( null );
} }
>
<Icon icon="no" />
{ __(
'Remove image',
'templates-patterns-collection'
) }
</Button>
</div>
</>
</span>
) }
</div>
</button>
{ logo && (
<div className="ob-media-actions">
<Button
isTertiary
onClick={ () => {
setLogo( '' );
handleLogoChange( null );
} }
>
{ __(
'Remove',
'templates-patterns-collection'
) }
</Button>
<Button isTertiary onClick={ open }>
{ __(
'Change',
'templates-patterns-collection'
) }
</Button>
</div>
) }
</>
) }
/>
Expand Down Expand Up @@ -123,13 +127,13 @@ export default compose(
: importDataDefault.theme_mods.custom_logo,
logo_logo: newLogo
? JSON.stringify( {
dark: newLogo.id,
light: newLogo.id,
same: true,
dark: newLogo.id,
light: newLogo.id,
same: true,
} )
: JSON.stringify( {
...importDataDefault.theme_mods
.logo_logo,
...importDataDefault.theme_mods
.logo_logo,
} ),
},
};
Expand Down
Loading