Ghost/ghost/admin/app/components/dashboard/onboarding-checklist.js
Kevin Ansfield 0cd8547e23
Added confirmation modal to onboarding skip button (#19956)
closes https://linear.app/tryghost/issue/IPC-115/make-skip-onboarding-button-work

- show a confirmation modal when clicking the "Skip onboarding" button
- onboarding is only dismissed when confirm button is clicked in the modal
2024-03-28 17:50:40 +00:00

46 lines
1.1 KiB
JavaScript

import Component from '@glimmer/component';
import DismissModal from './onboarding/dismiss-modal';
import ShareModal from './onboarding/share-modal';
import {action} from '@ember/object';
import {inject} from 'ghost-admin/decorators/inject';
import {inject as service} from '@ember/service';
export default class OnboardingChecklist extends Component {
@service modals;
@service onboarding;
@inject config;
dismissModal = null;
shareModal = null;
willDestroy() {
super.willDestroy(...arguments);
this.dismissModal?.close();
this.shareModal?.close();
}
get siteUrl() {
return this.config.blogTitle;
}
@action
openShareModal() {
this.onboarding.markStepCompleted('share-publication');
this.shareModal = this.modals.open(ShareModal);
}
@action
async confirmDismiss() {
this.dismissModal = this.modals.open(DismissModal);
const reallyDismiss = await this.dismissModal;
if (reallyDismiss === true) {
this.onboarding.dismissChecklist();
} else {
this.dismissModal = null;
}
}
}