Hid launch-site link on dashboard once wizard is completed

refs https://github.com/TryGhost/Team/issues/460

- use the `user.accessibility` field via the `feature` service to add a `launchComplete` property
  - this is the best place we have currently for UI-specific concerns
- toggle the property to `true` when the "Launch!" button is clicked in the final wizard step
- hide the launch site wizard link on the dashboard if launch has been completed
This commit is contained in:
Kevin Ansfield 2021-02-04 18:35:19 +00:00
parent 5092e936cc
commit f470549e80
5 changed files with 24 additions and 2 deletions

View File

@ -6,6 +6,12 @@
</div>
<div class="gh-launch-wizard-nav-buttons">
<button type="button" class="gh-btn gh-btn-icon gh-btn-large mr2" {{on "click" @backStep}}><span>{{svg-jar "arrow-left"}}</span></button>
<LinkTo @route="dashboard" class="gh-btn gh-btn-black gh-btn-large"><span>Launch your site!</span></LinkTo>
<GhTaskButton
@task={{this.finaliseTask}}
@buttonText="Launch your site!"
@runningText="Launching..."
@class="gh-btn gh-btn-black gh-btn-large gh-btn-icon"
data-test-button="wizard-finish"
/>
</div>
</div>

View File

@ -0,0 +1,14 @@
import Component from '@glimmer/component';
import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency-decorators';
export default class GhLaunchWizardFinaliseComponent extends Component {
@service feature;
@service router;
@task
*finaliseTask() {
yield this.feature.set('launchComplete', true);
this.router.transitionTo('dashboard');
}
}

View File

@ -2,5 +2,6 @@ import Controller from '@ember/controller';
import {inject as service} from '@ember/service';
export default class DashboardController extends Controller {
@service feature;
@service session;
}

View File

@ -52,6 +52,7 @@ export default Service.extend({
emailAnalytics: feature('emailAnalytics'),
nightShift: feature('nightShift', {user: true, onChange: '_setAdminTheme'}),
launchComplete: feature('launchComplete', {user: true}),
_user: null,

View File

@ -6,7 +6,7 @@
</GhCanvasHeader>
<section class="view-container gh-main-width">
{{#if this.session.user.isOwner}}
{{#if (and this.session.user.isOwner (not this.feature.launchComplete))}}
<LinkTo @route="launch">Launch site - Finish setup</LinkTo>
{{/if}}
</section>