Skip to content

Commit a627522

Browse files
peterzimon9larsons
andauthored
Fixed paid members showing up in post analytics hover (#24591)
ref https://linear.app/ghost/issue/PROD-2377/analytics-growth-top-content-sources-shows-paid-related-columns - In the main post list and Analytics top post list stats popup, paid membership related columns are displayed in the Top Sources table even though paid membership is turned off for the publication. - In Analytics > Top Posts, the hover behaved similarly. - Aligned display of labels between the two hovers. --------- Co-authored-by: Steve Larson <[email protected]>
1 parent de05d32 commit a627522

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

apps/stats/src/views/Stats/Overview/components/TopPosts.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,15 @@ const TopPosts: React.FC<TopPostsProps> = ({
168168
metrics={[
169169
{
170170
icon: <LucideIcon.User className='shrink-0 text-muted-foreground' size={16} strokeWidth={1.5} />,
171-
label: 'Free members',
171+
label: 'Free',
172172
metric: post.free_members > 0 ? `+${formatNumber(post.free_members)}` : '0'
173173
},
174-
{
174+
// Only show paid members if paid members are enabled
175+
...(appSettings?.paidMembersEnabled ? [{
175176
icon: <LucideIcon.CreditCard className='shrink-0 text-muted-foreground' size={16} strokeWidth={1.5} />,
176-
label: 'Paid members',
177+
label: 'Paid',
177178
metric: post.paid_members > 0 ? `+${formatNumber(post.paid_members)}` : '0'
178-
}
179+
}] : [])
179180
]}
180181
title='New members'
181182
/>

ghost/admin/app/components/posts-list/list-item-analytics.hbs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,19 +285,21 @@
285285
{{/if}}
286286
</span>
287287
</div>
288-
<div class="metric">
289-
<div class="data">
290-
{{svg-jar "analytics-paid-members"}}
291-
Paid
288+
{{#if this.membersUtils.paidMembersEnabled}}
289+
<div class="metric">
290+
<div class="data">
291+
{{svg-jar "analytics-paid-members"}}
292+
Paid
293+
</div>
294+
<span>
295+
{{#if this.hasMemberData}}
296+
{{format-number this.memberCounts.paid}}
297+
{{else}}
298+
0
299+
{{/if}}
300+
</span>
292301
</div>
293-
<span>
294-
{{#if this.hasMemberData}}
295-
{{format-number this.memberCounts.paid}}
296-
{{else}}
297-
0
298-
{{/if}}
299-
</span>
300-
</div>
302+
{{/if}}
301303
</div>
302304
</div>
303305
<div class="gh-post-list-analytics-metric" data-test-analytics-member-conversions>

ghost/admin/app/components/posts-list/list-item-analytics.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {tracked} from '@glimmer/tracking';
77

88
export default class PostsListItemClicks extends Component {
99
@service feature;
10+
@service membersUtils;
1011
@service session;
1112
@service settings;
1213
@service postAnalytics;

0 commit comments

Comments
 (0)