From acd202c5909fe85e6c4c31ce2510c3635d99ee0c Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 9 Jun 2023 23:02:47 +0200 Subject: [PATCH] Dont list instances with closed signups or few active users (#170) * Dont list instances with closed signups * Dont list instances with few active users --- src/shared/components/instances.tsx | 98 ++++++++++++++++------------- 1 file changed, 55 insertions(+), 43 deletions(-) diff --git a/src/shared/components/instances.tsx b/src/shared/components/instances.tsx index 40dcf75..36c3afd 100644 --- a/src/shared/components/instances.tsx +++ b/src/shared/components/instances.tsx @@ -4,6 +4,8 @@ import { i18n } from "../i18next"; import { instance_stats } from "../instance_stats"; import { numToSI } from "../utils"; +const min_monthly_users = 5; + export class Instances extends Component { constructor(props: any, context: any) { super(props, context); @@ -86,51 +88,61 @@ export class Instances extends Component {

{header}

- {instances.map(instance => { - let domain = instance.domain; - let users_active_month = - instance.site_info.site_view.counts.users_active_month; - let description = instance.site_info.site_view.site.description; - let icon = instance.site_info.site_view.site.icon; - let require_application = - instance.site_info.site_view.site.require_application; - return ( -
-
-
-

{domain}

-

- - {i18n.t("users_active_per_month", { - count: users_active_month, - formattedCount: numToSI(users_active_month), - })} - -

+ {instances + .filter( + i => + i.site_info.site_view.local_site.registration_mode != "closed" + ) + .filter( + i => + i.site_info.site_view.counts.users_active_month > + min_monthly_users + ) + .map(instance => { + let domain = instance.domain; + let users_active_month = + instance.site_info.site_view.counts.users_active_month; + let description = instance.site_info.site_view.site.description; + let icon = instance.site_info.site_view.site.icon; + let require_application = + instance.site_info.site_view.site.require_application; + return ( +
+
+
+

{domain}

+

+ + {i18n.t("users_active_per_month", { + count: users_active_month, + formattedCount: numToSI(users_active_month), + })} + +

+
+
+
+
-
-
- +
+

{description}

+
-
-

{description}

- -
- ); - })} + ); + })}
);