diff --git a/ghost/admin/app/components/dashboard/onboarding-checklist.hbs b/ghost/admin/app/components/dashboard/onboarding-checklist.hbs index 05e0eaeaa0..2a3d6e2a3b 100644 --- a/ghost/admin/app/components/dashboard/onboarding-checklist.hbs +++ b/ghost/admin/app/components/dashboard/onboarding-checklist.hbs @@ -45,7 +45,7 @@ /> {{!-- Step 5 --}} -
+
Skip onboarding {{/unless}} -
- -{{#if this.showShareModal}} - -{{/if}} \ No newline at end of file +
\ No newline at end of file diff --git a/ghost/admin/app/components/dashboard/onboarding-checklist.js b/ghost/admin/app/components/dashboard/onboarding-checklist.js index 8ff6c56204..ed3a964560 100644 --- a/ghost/admin/app/components/dashboard/onboarding-checklist.js +++ b/ghost/admin/app/components/dashboard/onboarding-checklist.js @@ -1,16 +1,31 @@ import Component from '@glimmer/component'; +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'; -import {tracked} from '@glimmer/tracking'; export default class OnboardingChecklist extends Component { + @service modals; @service onboarding; @inject config; - @tracked showMemberTierModal = false; + shareModal = null; + + willDestroy() { + super.willDestroy(...arguments); + if (this.shareModal) { + this.shareModal.close(); + } + } get siteUrl() { return this.config.blogTitle; } + + @action + openShareModal() { + this.onboarding.markStepCompleted('share-publication'); + this.shareModal = this.modals.open(ShareModal); + } } diff --git a/ghost/admin/app/components/dashboard/onboarding/share-modal.hbs b/ghost/admin/app/components/dashboard/onboarding/share-modal.hbs new file mode 100644 index 0000000000..8ee7a32f6a --- /dev/null +++ b/ghost/admin/app/components/dashboard/onboarding/share-modal.hbs @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/ghost/admin/app/components/dashboard/onboarding/share-modal.js b/ghost/admin/app/components/dashboard/onboarding/share-modal.js new file mode 100644 index 0000000000..80066f1b99 --- /dev/null +++ b/ghost/admin/app/components/dashboard/onboarding/share-modal.js @@ -0,0 +1,18 @@ +import Component from '@glimmer/component'; +import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard'; +import {inject} from 'ghost-admin/decorators/inject'; +import {task} from 'ember-concurrency'; + +export default class OnboardingShareModal extends Component { + @inject config; + + get encodedUrl() { + return encodeURIComponent(this.config.blogUrl); + } + + @task + *copySiteUrl() { + yield copyTextToClipboard(this.config.blogUrl); + return true; + } +} diff --git a/ghost/admin/app/components/modal-share.hbs b/ghost/admin/app/components/modal-share.hbs deleted file mode 100644 index eba42b5293..0000000000 --- a/ghost/admin/app/components/modal-share.hbs +++ /dev/null @@ -1,76 +0,0 @@ - - - {{svg-jar "close"}} - - - -
- {{#let (or @post.featureImage (get-setting "coverImage")) as |imageUrl|}} - {{#if imageUrl}} -
- -
- {{else}} -
- {{svg-jar "picture"}} -
- {{/if}} - -
- - -
- {{/let}} -
- - - Set your publication’s cover image and description in Settings - - - - - diff --git a/ghost/admin/app/components/modal-share.js b/ghost/admin/app/components/modal-share.js deleted file mode 100644 index 2975f5037c..0000000000 --- a/ghost/admin/app/components/modal-share.js +++ /dev/null @@ -1,31 +0,0 @@ -import ModalComponent from 'ghost-admin/components/modal-base'; -import copyTextToClipboard from 'ghost-admin/utils/copy-text-to-clipboard'; -import {inject} from 'ghost-admin/decorators/inject'; -import {task, timeout} from 'ember-concurrency'; - -export default ModalComponent.extend({ - config: inject(), - - copySiteUrl: task(function* () { - copyTextToClipboard(this.config.blogUrl); - yield timeout(1000); - return true; - }), - - get encodedUrl() { - return encodeURIComponent(this.config.blogUrl); - }, - - get facebookShareUrl() { - return `https://www.facebook.com/sharer/sharer.php?u=${this.encodedUrl}`; - }, - - get linkedInShareUrl() { - return `https://www.linkedin.com/sharing/share-offsite/?url=${this.encodedUrl}`; - }, - - get xShareUrl() { - return `https://twitter.com/intent/tweet?url=${this.encodedUrl}`; - } - -}); \ No newline at end of file