Ghost/ghost/admin/app/components/dashboard/v5/charts/anchor.hbs
Simon Backx fdaf9c5614 Fixes price formatting in MRR tooltip + added support for currencies
refs https://github.com/TryGhost/Team/issues/1521

- Formatted the number correctly in the tooltip
- Correctly get the currency that is used in the MRR stats and show that symbol instead of a hardcoded $
2022-04-14 17:05:01 +02:00

104 lines
5.2 KiB
Handlebars

<section class="gh-dashboard5-section gh-dashboard5-anchor" {{did-insert this.loadCharts}}>
<article class="gh-dashboard5-box">
{{#if this.hasPaidTiers}}
<div class="gh-dashboard5-title">
<h4>{{this.chartTitle}}</h4>
</div>
{{/if}}
<div class="gh-dashboard5-hero {{unless this.hasPaidTiers 'is-solo'}}">
{{#unless this.hasPaidTiers}}
<Dashboard::v5::Parts::Metric
@label={{gh-pluralize this.totalMembers "Total member" without-count=true}}
@value={{format-number this.totalMembers}}
@trends={{this.hasTrends}}
@percentage={{this.totalMembersTrend}}
@large={{true}} />
{{/unless}}
<div class="gh-dashboard5-chart">
{{#if this.loading}}
<div class="gh-dashboard5-chart-loading" style={{html-safe (concat "height: " this.chartHeight "px;")}}/>
{{else}}
<div class="gh-dashboard5-chart-container">
{{#if (eq this.chartType 'bar')}}
<EmberChart
@type="bar"
@data={{this.chartData}}
@options={{this.chartOptions}}
@height={{if this.hasPaidTiers this.chartHeight this.chartHeightSmall}} />
{{else}}
<EmberChart
@type="line"
@data={{this.chartData}}
@options={{this.chartOptions}}
@height={{if this.hasPaidTiers this.chartHeight this.chartHeightSmall}} />
{{/if}}
</div>
<div class="gh-dashboard5-chart-ticks">
<span id="gh-dashboard5-anchor-date-start"> </span>
<span id="gh-dashboard5-anchor-date-end"> </span>
</div>
{{/if}}
</div>
{{#if this.hasPaidTiers}}
<div class="gh-dashboard5-stats{{unless this.hasPaidTiers ' is-solo'}}">
<button class="gh-dashboard5-stats-button {{if this.chartShowingTotal 'is-selected'}}" type="button" {{on "click" (fn this.changeChartDisplay "total")}}>
<Dashboard::v5::Parts::Metric
@label={{gh-pluralize this.totalMembers "Total member" without-count=true}}
@value={{format-number this.totalMembers}}
{{!-- @trends={{this.hasTrends}} --}}
{{!-- @percentage={{this.totalMembersTrend}} --}}
@center={{true}}
@large={{true}} />
</button>
<button class="gh-dashboard5-stats-button {{if this.chartShowingMrr 'is-selected'}}" type="button" {{on "click" (fn this.changeChartDisplay "mrr")}}>
<Dashboard::v5::Parts::Metric
@label="Monthly Revenue (MRR)"
@value="{{this.mrrCurrencySymbol}}{{gh-price-amount this.currentMRR}}"
{{!-- @trends={{this.hasTrends}} --}}
{{!-- @percentage={{this.mrrTrend}} --}}
@center={{true}}
@large={{true}} />
</button>
</div>
{{/if}}
</div>
<div class="gh-dashboard5-selects">
{{#if this.chartShowingMrr}}
<div class="gh-dashboard5-select">
<PowerSelect
@selected={{this.selectedPaidOption}}
@options={{this.paidOptions}}
@searchEnabled={{false}}
@onChange={{this.onPaidChange}}
@triggerComponent="gh-power-select/trigger"
@triggerClass="gh-contentfilter-menu-trigger"
@dropdownClass="gh-contentfilter-menu-dropdown"
@matchTriggerWidth={{false}}
as |option|
>
{{#if option.name}}{{option.name}}{{else}}<span class="red">Unknown option</span>{{/if}}
</PowerSelect>
</div>
{{/if}}
<div class="gh-dashboard5-select">
<PowerSelect
@selected={{this.selectedDaysOption}}
@options={{this.daysOptions}}
@searchEnabled={{false}}
@onChange={{this.onDaysChange}}
@triggerComponent="gh-power-select/trigger"
@triggerClass="gh-contentfilter-menu-trigger"
@dropdownClass="gh-contentfilter-menu-dropdown"
@matchTriggerWidth={{false}}
as |option|
>
{{#if option.name}}{{option.name}}{{else}}<span class="red">Unknown option</span>{{/if}}
</PowerSelect>
</div>
</div>
</article>
</section>