Skip to content

Commit e442d25

Browse files
authored
Merge pull request #730 from ProgressPlanner/filip/onboarding-tweaks
New onboarding tweaks
2 parents e7323c4 + 3657119 commit e442d25

4 files changed

Lines changed: 8 additions & 158 deletions

File tree

assets/css/onboarding/onboarding.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@
298298
img, svg {
299299
height: 100%;
300300
width: auto;
301+
max-width: 100%;
301302
}
302303
}
303304

assets/js/onboarding/steps/SettingsStep.js

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
/**
2-
* Settings step - Configure About, Contact, FAQ pages, Post Types, and Login Destination
2+
* Settings step - Configure About, Contact, FAQ pages, and Post Types
33
* Multi-step process with 5 sub-steps
44
*/
55
/* global OnboardingStep, ProgressPlannerOnboardData */
66

77
class PrplSettingsStep extends OnboardingStep {
8-
subSteps = [
9-
'homepage',
10-
'about',
11-
'contact',
12-
'faq',
13-
'post-types',
14-
'login-destination',
15-
];
8+
subSteps = [ 'homepage', 'about', 'contact', 'faq', 'post-types' ];
169

1710
defaultSettings = {
1811
homepage: {
@@ -34,9 +27,6 @@ class PrplSettingsStep extends OnboardingStep {
3427
'post-types': {
3528
selectedTypes: [], // Array of selected post type slugs
3629
},
37-
'login-destination': {
38-
redirectOnLogin: false, // Checkbox state
39-
},
4030
};
4131

4232
constructor() {
@@ -137,7 +127,7 @@ class PrplSettingsStep extends OnboardingStep {
137127

138128
/**
139129
* Setup event listeners for a sub-step
140-
* @param {string} subStepName - Name of sub-step (about/contact/faq/post-types/login-destination)
130+
* @param {string} subStepName - Name of sub-step (about/contact/faq/post-types)
141131
* @param {Object} subStepData - Data for this sub-step
142132
* @param {Object} state - Wizard state
143133
*/
@@ -153,16 +143,6 @@ class PrplSettingsStep extends OnboardingStep {
153143
// Handle post types sub-step
154144
if ( subStepName === 'post-types' ) {
155145
this.setupPostTypesListeners( subStepName, subStepData, state );
156-
return;
157-
}
158-
159-
// Handle login destination sub-step
160-
if ( subStepName === 'login-destination' ) {
161-
this.setupLoginDestinationListeners(
162-
subStepName,
163-
subStepData,
164-
state
165-
);
166146
}
167147
}
168148

@@ -342,60 +322,6 @@ class PrplSettingsStep extends OnboardingStep {
342322
this.updateSaveButtonState( saveButton, subStepData );
343323
}
344324

345-
/**
346-
* Setup event listeners for login destination sub-step
347-
* @param {string} subStepName - Name of sub-step
348-
* @param {Object} subStepData - Data for this sub-step
349-
* @param {Object} state - Wizard state
350-
*/
351-
setupLoginDestinationListeners( subStepName, subStepData, state ) {
352-
const container = this.popover.querySelector(
353-
`.prpl-setting-item[data-page="${ subStepName }"]`
354-
);
355-
const saveButton = this.popover.querySelector(
356-
`#prpl-save-${ subStepName }-setting`
357-
);
358-
359-
if ( ! container || ! saveButton ) {
360-
return;
361-
}
362-
363-
// Get checkbox
364-
const checkbox = container.querySelector(
365-
'input[type="checkbox"][name="prpl-redirect-on-login"]'
366-
);
367-
368-
if ( ! checkbox ) {
369-
return;
370-
}
371-
372-
// Initialize from checkbox that is already set in template, or from saved data
373-
if ( subStepData.redirectOnLogin === undefined ) {
374-
subStepData.redirectOnLogin = checkbox.checked;
375-
} else {
376-
checkbox.checked = subStepData.redirectOnLogin;
377-
}
378-
379-
// Add change listener
380-
checkbox.addEventListener( 'change', ( e ) => {
381-
subStepData.redirectOnLogin = e.target.checked;
382-
this.updateSaveButtonState( saveButton, subStepData );
383-
384-
// Update Next/Dashboard button if on last sub-step
385-
if ( this.currentSubStep === this.subSteps.length - 1 ) {
386-
this.updateNextButton();
387-
}
388-
} );
389-
390-
// Save button handler - just advances to next sub-step
391-
saveButton.addEventListener( 'click', () => {
392-
this.advanceSubStep( state );
393-
} );
394-
395-
// Initial button state
396-
this.updateSaveButtonState( saveButton, subStepData );
397-
}
398-
399325
/**
400326
* Advance to next sub-step
401327
* @param {Object} state - Wizard state
@@ -445,11 +371,6 @@ class PrplSettingsStep extends OnboardingStep {
445371
return subStepData.selectedTypes.length > 0;
446372
}
447373

448-
// Handle login destination sub-step - always valid (checkbox is optional)
449-
if ( subStepData.redirectOnLogin !== undefined ) {
450-
return true;
451-
}
452-
453374
return false;
454375
}
455376

@@ -525,12 +446,6 @@ class PrplSettingsStep extends OnboardingStep {
525446
} );
526447
}
527448

528-
// Add login destination
529-
const loginData = state.data.settings[ 'login-destination' ];
530-
if ( loginData && loginData.redirectOnLogin ) {
531-
formDataObj.append( 'prpl-redirect-on-login', '1' );
532-
}
533-
534449
// Send single AJAX request
535450
const response = await fetch(
536451
ProgressPlannerOnboardData.adminAjaxUrl,

classes/class-plugin-upgrade-tasks.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ public function handle_activation_or_upgrade() {
8383
* @return void
8484
*/
8585
protected function add_initial_onboarding_tasks() {
86-
// Privacy policy is not accepted, so it's a fresh install.
87-
$fresh_install = ! \progress_planner()->is_privacy_policy_accepted();
86+
// Check if this is a fresh install (not a re-activation).
87+
// If the option doesn't exist, it's a fresh install.
88+
$fresh_install = false === \get_option( 'progress_planner_previous_version_task_providers', false );
8889

8990
// If this is the first time the plugin is installed, save the task providers.
9091
if ( $fresh_install ) {

views/onboarding/settings.php

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@
4242
$prpl_saved_settings = \progress_planner()->get_settings()->get_post_types_names();
4343
$prpl_post_types = \progress_planner()->get_settings()->get_public_post_types();
4444

45-
// Get redirect on login setting.
46-
$prpl_redirect_on_login = \get_user_meta( \get_current_user_id(), 'prpl_redirect_on_login', true );
47-
48-
$prpl_total_number_of_steps = 6;
45+
$prpl_total_number_of_steps = 5;
4946
$prpl_current_step_number = 0;
5047

5148
?>
@@ -200,70 +197,6 @@ class="prpl-btn prpl-save-setting-btn"
200197
</div>
201198
</div>
202199
<?php endif; ?>
203-
204-
<!-- Login Destination sub-step -->
205-
<?php ++$prpl_current_step_number; ?>
206-
<div class="prpl-setting-item" data-page="login-destination">
207-
<div class="prpl-columns-wrapper-flex">
208-
<div class="prpl-column">
209-
<div class="prpl-background-content">
210-
<p><?php echo \esc_html( $prpl_page_type['description'] ); ?></p>
211-
</div>
212-
</div>
213-
<div class="prpl-column">
214-
<div class="prpl-setting-header">
215-
<h3 class="prpl-setting-title">
216-
<?php \esc_html_e( 'Settings:', 'progress-planner' ); ?> <?php \esc_html_e( 'Default login destination', 'progress-planner' ); ?>
217-
<span class="prpl-settings-progress"><?php echo \esc_html( $prpl_current_step_number ); ?>/<?php echo \esc_html( $prpl_total_number_of_steps ); ?></span>
218-
</h3>
219-
<p>
220-
<?php
221-
/* translators: %s: Progress Planner name. */
222-
\printf( \esc_html__( 'Do you want to land on the %s dashboard after logging in? So you can start improving your site straight away!', 'progress-planner' ), \esc_html( \progress_planner()->get_ui__branding()->get_admin_menu_name() ) );
223-
?>
224-
</p>
225-
</div>
226-
227-
<div class="prpl-setting-content">
228-
<div class="prpl-settings-wrapper">
229-
<p>
230-
<?php \esc_html_e( 'Where do you want to start when you login to your site?', 'progress-planner' ); ?>
231-
</p>
232-
233-
<?php
234-
\progress_planner()->the_view(
235-
'onboarding/form-inputs/checkbox.php',
236-
[
237-
'name' => 'redirect_on_login',
238-
'current_value' => '',
239-
'options' => [
240-
[
241-
'id' => 'prpl-setting-redirect-on-login',
242-
'label' => \sprintf(
243-
/* translators: %s: Progress Planner name. */
244-
\esc_html__( 'Show the %s dashboard after login.', 'progress-planner' ),
245-
\esc_html( \progress_planner()->get_ui__branding()->get_admin_menu_name() )
246-
),
247-
'value' => '1',
248-
],
249-
],
250-
]
251-
);
252-
?>
253-
</div>
254-
</div>
255-
<div class="prpl-setting-footer">
256-
<button
257-
type="button"
258-
id="prpl-save-login-destination-setting"
259-
class="prpl-btn prpl-save-setting-btn"
260-
>
261-
<?php \esc_html_e( 'Save setting', 'progress-planner' ); ?>
262-
</button>
263-
</div>
264-
</div>
265-
</div>
266-
</div>
267200
</div>
268201
<div class="tour-footer">
269202
<div class="prpl-tour-next-wrapper">

0 commit comments

Comments
 (0)