From: Dessalines Date: Fri, 29 Jan 2021 15:10:37 +0000 (-0500) Subject: Adding some active users aggregate fields. (#148) X-Git-Url: http://these/git/%22%7Burl%7D/%7B%60%24%7BghostArchiveUrl%7D/%7BelementUrl%7D?a=commitdiff_plain;h=e78862a8aec5f6a754309d2260e6d4efe87b62a9;p=lemmy-ui.git Adding some active users aggregate fields. (#148) * Adding some active users aggregate fields. * Adding active users / month to communities page. --- diff --git a/lemmy-translations b/lemmy-translations index c4cd53c..b914a96 160000 --- a/lemmy-translations +++ b/lemmy-translations @@ -1 +1 @@ -Subproject commit c4cd53cdc6ef588c1b19bc9c5ddfeb09ecae4516 +Subproject commit b914a9696bc4fadc46fdca655c94c3b4cedf3e8c diff --git a/package.json b/package.json index a52c025..216714f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/shared/components/communities.tsx b/src/shared/components/communities.tsx index 74da2b1..c852fe2 100644 --- a/src/shared/components/communities.tsx +++ b/src/shared/components/communities.tsx @@ -127,6 +127,9 @@ export class Communities extends Component { {i18n.t('name')} {i18n.t('category')} {i18n.t('subscribers')} + + {i18n.t('users')} / {i18n.t('month')} + {i18n.t('posts')} @@ -144,6 +147,7 @@ export class Communities extends Component { {cv.category.name} {cv.counts.subscribers} + {cv.counts.users_active_month} {cv.counts.posts} diff --git a/src/shared/components/main.tsx b/src/shared/components/main.tsx index 11ac87b..9e522f8 100644 --- a/src/shared/components/main.tsx +++ b/src/shared/components/main.tsx @@ -420,7 +420,7 @@ export class Main extends Component { } badges() { - let site_view = this.state.siteRes.site_view; + let counts = this.state.siteRes.site_view.counts; return (
  • @@ -428,22 +428,46 @@ export class Main extends Component {
  • {i18n.t('number_of_users', { - count: site_view.counts.users, + count: counts.users_active_day, + })}{' '} + / {i18n.t('day')} +
  • +
  • + {i18n.t('number_of_users', { + count: counts.users_active_week, + })}{' '} + / {i18n.t('week')} +
  • +
  • + {i18n.t('number_of_users', { + count: counts.users_active_month, + })}{' '} + / {i18n.t('month')} +
  • +
  • + {i18n.t('number_of_users', { + count: counts.users_active_half_year, + })}{' '} + / {i18n.t('number_of_months', { count: 6 })} +
  • +
  • + {i18n.t('number_of_subscribers', { + count: counts.users, })}
  • {i18n.t('number_of_communities', { - count: site_view.counts.communities, + count: counts.communities, })}
  • {i18n.t('number_of_posts', { - count: site_view.counts.posts, + count: counts.posts, })}
  • {i18n.t('number_of_comments', { - count: site_view.counts.comments, + count: counts.comments, })}
  • diff --git a/src/shared/components/sidebar.tsx b/src/shared/components/sidebar.tsx index 76e141f..324f3ea 100644 --- a/src/shared/components/sidebar.tsx +++ b/src/shared/components/sidebar.tsx @@ -143,24 +143,49 @@ export class Sidebar extends Component { badges() { let community_view = this.props.community_view; + let counts = community_view.counts; return (
    • {i18n.t('number_online', { count: this.props.online })}
    • +
    • + {i18n.t('number_of_users', { + count: counts.users_active_day, + })}{' '} + / {i18n.t('day')} +
    • +
    • + {i18n.t('number_of_users', { + count: counts.users_active_week, + })}{' '} + / {i18n.t('week')} +
    • +
    • + {i18n.t('number_of_users', { + count: counts.users_active_month, + })}{' '} + / {i18n.t('month')} +
    • +
    • + {i18n.t('number_of_users', { + count: counts.users_active_half_year, + })}{' '} + / {i18n.t('number_of_months', { count: 6 })} +
    • {i18n.t('number_of_subscribers', { - count: community_view.counts.subscribers, + count: counts.subscribers, })}
    • {i18n.t('number_of_posts', { - count: community_view.counts.posts, + count: counts.posts, })}
    • {i18n.t('number_of_comments', { - count: community_view.counts.comments, + count: counts.comments, })}
    • diff --git a/yarn.lock b/yarn.lock index fcc549b..298fead 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"