Adding some active users aggregate fields. (#148)

* Adding some active users aggregate fields.

* Adding active users / month to communities page.
This commit is contained in:
Dessalines 2021-01-29 10:10:37 -05:00 committed by GitHub
parent cab454dd89
commit e78862a8ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 14 deletions

@ -1 +1 @@
Subproject commit c4cd53cdc6ef588c1b19bc9c5ddfeb09ecae4516
Subproject commit b914a9696bc4fadc46fdca655c94c3b4cedf3e8c

View file

@ -67,7 +67,7 @@
"eslint": "^7.18.0",
"eslint-plugin-jane": "^9.0.6",
"husky": "^4.3.8",
"lemmy-js-client": "0.9.1-rc.1",
"lemmy-js-client": "0.9.1-rc.3",
"lint-staged": "^10.5.3",
"mini-css-extract-plugin": "^1.3.4",
"node-fetch": "^2.6.1",

View file

@ -127,6 +127,9 @@ export class Communities extends Component<any, CommunitiesState> {
<th>{i18n.t('name')}</th>
<th>{i18n.t('category')}</th>
<th class="text-right">{i18n.t('subscribers')}</th>
<th class="text-right">
{i18n.t('users')} / {i18n.t('month')}
</th>
<th class="text-right d-none d-lg-table-cell">
{i18n.t('posts')}
</th>
@ -144,6 +147,7 @@ export class Communities extends Component<any, CommunitiesState> {
</td>
<td>{cv.category.name}</td>
<td class="text-right">{cv.counts.subscribers}</td>
<td class="text-right">{cv.counts.users_active_month}</td>
<td class="text-right d-none d-lg-table-cell">
{cv.counts.posts}
</td>

View file

@ -420,7 +420,7 @@ export class Main extends Component<any, MainState> {
}
badges() {
let site_view = this.state.siteRes.site_view;
let counts = this.state.siteRes.site_view.counts;
return (
<ul class="my-2 list-inline">
<li className="list-inline-item badge badge-secondary">
@ -428,22 +428,46 @@ export class Main extends Component<any, MainState> {
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: site_view.counts.users,
count: counts.users_active_day,
})}{' '}
/ {i18n.t('day')}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: counts.users_active_week,
})}{' '}
/ {i18n.t('week')}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: counts.users_active_month,
})}{' '}
/ {i18n.t('month')}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: counts.users_active_half_year,
})}{' '}
/ {i18n.t('number_of_months', { count: 6 })}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_subscribers', {
count: counts.users,
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_communities', {
count: site_view.counts.communities,
count: counts.communities,
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_posts', {
count: site_view.counts.posts,
count: counts.posts,
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_comments', {
count: site_view.counts.comments,
count: counts.comments,
})}
</li>
<li className="list-inline-item">

View file

@ -143,24 +143,49 @@ export class Sidebar extends Component<SidebarProps, SidebarState> {
badges() {
let community_view = this.props.community_view;
let counts = community_view.counts;
return (
<ul class="my-1 list-inline">
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_online', { count: this.props.online })}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: counts.users_active_day,
})}{' '}
/ {i18n.t('day')}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: counts.users_active_week,
})}{' '}
/ {i18n.t('week')}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: counts.users_active_month,
})}{' '}
/ {i18n.t('month')}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_users', {
count: counts.users_active_half_year,
})}{' '}
/ {i18n.t('number_of_months', { count: 6 })}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_subscribers', {
count: community_view.counts.subscribers,
count: counts.subscribers,
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_posts', {
count: community_view.counts.posts,
count: counts.posts,
})}
</li>
<li className="list-inline-item badge badge-secondary">
{i18n.t('number_of_comments', {
count: community_view.counts.comments,
count: counts.comments,
})}
</li>
<li className="list-inline-item">

View file

@ -5629,10 +5629,10 @@ lcid@^1.0.0:
dependencies:
invert-kv "^1.0.0"
lemmy-js-client@0.9.1-rc.1:
version "0.9.1-rc.1"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.9.1-rc.1.tgz#afe3cb0d4852f849dd087a4756a3771bc920a907"
integrity sha512-aVvo4IeJvIPUvypipk4GnyLB6nVQVLfB0arYrMkVV4L7zrZ/0pGtpkMDLaOAj/KpA6O0u9eLmaou5RberZQolA==
lemmy-js-client@0.9.1-rc.3:
version "0.9.1-rc.3"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.9.1-rc.3.tgz#d675f2b01e57ff8f6e528e0715a0dc85ba36b002"
integrity sha512-Zie3yXLCLdPQWE88+odDQ7FrMzzNKIdzn7M7rrMTatJEAMlxVDZTPrUOZZ/cVAlO7W7DlwXSENT/PCdA35ggZw==
levn@^0.4.1:
version "0.4.1"