diff --git a/ghost/admin/app/components/stats/charts/top-locations.hbs b/ghost/admin/app/components/stats/charts/top-locations.hbs index 670f17053f..0412079da8 100644 --- a/ghost/admin/app/components/stats/charts/top-locations.hbs +++ b/ghost/admin/app/components/stats/charts/top-locations.hbs @@ -1 +1 @@ -
+
diff --git a/ghost/admin/app/components/stats/charts/top-locations.js b/ghost/admin/app/components/stats/charts/top-locations.js index 11b0d6d8ef..363dfb5f8c 100644 --- a/ghost/admin/app/components/stats/charts/top-locations.js +++ b/ghost/admin/app/components/stats/charts/top-locations.js @@ -4,7 +4,7 @@ import moment from 'moment-timezone'; import {BarList, useQuery} from '@tinybirdco/charts'; import {inject} from 'ghost-admin/decorators/inject'; -export default class TopPages extends Component { +export default class TopLocations extends Component { @inject config; ReactComponent = (props) => { diff --git a/ghost/admin/app/controllers/stats.js b/ghost/admin/app/controllers/stats.js index 0516fc2bd2..11a8f11e43 100644 --- a/ghost/admin/app/controllers/stats.js +++ b/ghost/admin/app/controllers/stats.js @@ -1,4 +1,34 @@ import Controller from '@ember/controller'; +import {action} from '@ember/object'; +import {tracked} from '@glimmer/tracking'; + +// Options 30 and 90 need an extra day to be able to distribute ticks/gridlines evenly +const DAYS_OPTIONS = [{ + name: '7 Days', + value: 7 +}, { + name: '30 Days', + value: 30 + 1 +}, { + name: '90 Days', + value: 90 + 1 +}]; export default class StatsController extends Controller { + daysOptions = DAYS_OPTIONS; + + /** + * @type {number|'all'} + * Amount of days to load for member count and MRR related charts + */ + @tracked chartDays = 30 + 1; + + @action + onDaysChange(selected) { + this.chartDays = selected.value; + } + + get selectedDaysOption() { + return this.daysOptions.find(d => d.value === this.chartDays); + } } diff --git a/ghost/admin/app/templates/stats.hbs b/ghost/admin/app/templates/stats.hbs index 307172068a..4658e9c60e 100644 --- a/ghost/admin/app/templates/stats.hbs +++ b/ghost/admin/app/templates/stats.hbs @@ -1,8 +1,24 @@
+
+ + {{#if option.name}}{{option.name}}{{else}}Unknown option{{/if}} + +
- +
\ No newline at end of file