]> Untitled Git - lemmy-ui.git/commitdiff
Adding some active users aggregate fields. (#148)
authorDessalines <dessalines@users.noreply.github.com>
Fri, 29 Jan 2021 15:10:37 +0000 (10:10 -0500)
committerGitHub <noreply@github.com>
Fri, 29 Jan 2021 15:10:37 +0000 (10:10 -0500)
* Adding some active users aggregate fields.

* Adding active users / month to communities page.

lemmy-translations
package.json
src/shared/components/communities.tsx
src/shared/components/main.tsx
src/shared/components/sidebar.tsx
yarn.lock

index c4cd53cdc6ef588c1b19bc9c5ddfeb09ecae4516..b914a9696bc4fadc46fdca655c94c3b4cedf3e8c 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c4cd53cdc6ef588c1b19bc9c5ddfeb09ecae4516
+Subproject commit b914a9696bc4fadc46fdca655c94c3b4cedf3e8c
index a52c025115c26ed4fcb4aa5a07a302fe65d87a8d..216714f84055d5f5d24fb3a840761f901896766a 100644 (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",
index 74da2b116d3b4f4f6651bbc8e70243644a02dba0..c852fe254b98ffed95cff5d755363e924318f508 100644 (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>
index 11ac87bb0135ebbf5d3dcba4755092f6dd7ea7d7..9e522f805eefff01e6e2af2100339f74f98e7f80 100644 (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">
index 76e141fb602ff9aaa36249627a73baffccd5ef00..324f3eaa681b2acee8531e5f06c6690c7f717949 100644 (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">
index fcc549bd360d58b617ad9a9bb090a9d6de7ad29e..298feadcf7b57a7a2bdfe6002e5b2a64467a27f8 100644 (file)
--- 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"