Ghost/ghost/admin/app/templates/stats.hbs
Peter Zimon 7cb8cbdf7a
Showing country names instead of codes in Stats (#21172)
[ANAL-53](https://linear.app/tryghost/issue/ANAL-53/10-stats-page-engineering-stuff)

- So far only country codes were displayed instead of human readable country names in the Stats page
2024-10-02 09:17:06 +02:00

141 lines
5.3 KiB
Handlebars

<section class="gh-stats gh-canvas gh-canvas-sticky">
<GhCanvasHeader class="gh-canvas-header gh-stats-header sticky break tablet post-header">
<GhCustomViewTitle @title="Stats" />
<div class="view-actions">
<Stats::Parts::AudienceFilter
@excludedAudiences={{this.excludedAudiences}}
@onChange={{this.onAudienceChange}}
/>
<PowerSelect
@selected={{this.selectedRangeOption}}
@options={{this.rangeOptions}}
@searchEnabled={{false}}
@onChange={{this.onRangeChange}}
@triggerComponent={{component "gh-power-select/trigger"}}
@triggerClass="gh-btn"
@dropdownClass="gh-contentfilter-menu-dropdown is-narrow"
@matchTriggerWidth={{false}}
@horizontalPosition="right"
as |option|
>
{{#if option.name}}{{option.name}}{{else}}<span class="red">Unknown option</span>{{/if}}
</PowerSelect>
</div>
{{#if (or this.device this.browser this.location this.source this.pathname)}}
<div class="gh-stats-filters">
{{#if this.pathname}}
<div class="gh-stats-filter-pill">
<div>Page is <span class="value">{{this.pathname}}</span></div>
</div>
{{/if}}
{{#if this.source}}
<div class="gh-stats-filter-pill">
<div>Source is <span class="value">{{this.source}}</span></div>
</div>
{{/if}}
{{#if this.location}}
<div class="gh-stats-filter-pill">
<div>Location is <span class="value">{{this.humanReadableLocation}}</span></div>
</div>
{{/if}}
{{#if this.device}}
<div class="gh-stats-filter-pill">
<div>Device is <span class="value">{{this.device}}</span></div>
</div>
{{/if}}
{{#if this.browser}}
<div class="gh-stats-filter-pill">
<div>Browser is <span class="value">{{this.browser}}</span></div>
</div>
{{/if}}
<a href="#/stats" class="gh-btn-clear-filters" {{on "click" this.clearFilters}}>{{svg-jar "close"}} <span>Clear</span></a>
</div>
{{/if}}
</GhCanvasHeader>
<section class="view-container">
{{#if this.showStats}}
<section class="gh-stats-container no-gap">
<Stats::KpisOverview
@chartRange={{this.chartRange}}
@audience={{this.audience}}
@device={{this.device}}
@browser={{this.browser}}
@location={{this.location}}
@source={{this.source}}
@pathname={{this.pathname}}/>
</section>
<section class="gh-stats-grid cols-2">
<div class="gh-stats-container">
<Stats::Charts::TopPages
@chartRange={{this.chartRange}}
@audience={{this.audience}}
@device={{this.device}}
@browser={{this.browser}}
@location={{this.location}}
@source={{this.source}}
@pathname={{this.pathname}}
/>
</div>
<div class="gh-stats-container">
<Stats::Charts::TopSources
@chartRange={{this.chartRange}}
@audience={{this.audience}}
@device={{this.device}}
@browser={{this.browser}}
@location={{this.location}}
@source={{this.source}}
@pathname={{this.pathname}}
/>
</div>
</section>
<section class="gh-stats-grid cols-2">
<div class="gh-stats-container">
<Stats::Charts::TopLocations
@chartRange={{this.chartRange}}
@audience={{this.audience}}
@device={{this.device}}
@browser={{this.browser}}
@location={{this.location}}
@source={{this.source}}
@pathname={{this.pathname}}
/>
</div>
<div class="gh-stats-container">
<Stats::TechnicalOverview
@chartRange={{this.chartRange}}
@audience={{this.audience}}
@device={{this.device}}
@browser={{this.browser}}
@location={{this.location}}
@source={{this.source}}
@pathname={{this.pathname}}
/>
</div>
</section>
{{else}}
<div class="no-posts-box">
<div class="no-posts">
{{svg-jar "stats-placeholder" class="gh-stats-placeholder"}}
<h4>No stats available for the current filter</h4>
<button type="button" class="gh-btn" {{on "click" this.clearAudienceFilter}}>
<span>See all stats</span>
</button>
</div>
</div>
No audience selected
{{/if}}
</section>
</section>