1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00

Remove GhScheduledPostCountdown component

This commit is contained in:
Peter Zimon 2019-11-13 15:33:57 +01:00
parent a47948c705
commit 85209c9328
2 changed files with 0 additions and 31 deletions

View file

@ -1,28 +0,0 @@
import Component from '@ember/component';
import moment from 'moment';
import {computed} from '@ember/object';
import {inject as service} from '@ember/service';
export default Component.extend({
clock: service(),
post: null,
// countdown timer to show the time left until publish time for a scheduled post
// starts 15 minutes before scheduled time
countdown: computed('post.{publishedAtUTC,isScheduled}', 'clock.second', function () {
let isScheduled = this.get('post.isScheduled');
let publishTime = this.get('post.publishedAtUTC') || moment.utc();
let timeUntilPublished = publishTime.diff(moment.utc(), 'minutes', true);
let isPublishedSoon = timeUntilPublished > 0 && timeUntilPublished < 15;
// force a recompute
this.get('clock.second');
if (isScheduled && isPublishedSoon) {
return moment(publishTime).fromNow();
} else {
return false;
}
})
});

View file

@ -1,3 +0,0 @@
{{#if countdown}}
{{yield post countdown}}
{{/if}}