Dont list instances with closed signups or few active users (#170)

* Dont list instances with closed signups

* Dont list instances with few active users
This commit is contained in:
Nutomic 2023-06-09 23:02:47 +02:00 committed by GitHub
parent 686c773534
commit acd202c590
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,8 @@ import { i18n } from "../i18next";
import { instance_stats } from "../instance_stats"; import { instance_stats } from "../instance_stats";
import { numToSI } from "../utils"; import { numToSI } from "../utils";
const min_monthly_users = 5;
export class Instances extends Component<any, any> { export class Instances extends Component<any, any> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
@ -86,51 +88,61 @@ export class Instances extends Component<any, any> {
<div> <div>
<h2>{header}</h2> <h2>{header}</h2>
<div class="row"> <div class="row">
{instances.map(instance => { {instances
let domain = instance.domain; .filter(
let users_active_month = i =>
instance.site_info.site_view.counts.users_active_month; i.site_info.site_view.local_site.registration_mode != "closed"
let description = instance.site_info.site_view.site.description; )
let icon = instance.site_info.site_view.site.icon; .filter(
let require_application = i =>
instance.site_info.site_view.site.require_application; i.site_info.site_view.counts.users_active_month >
return ( min_monthly_users
<div class="card col-6"> )
<header> .map(instance => {
<div class="row"> let domain = instance.domain;
<h4 class="col">{domain}</h4> let users_active_month =
<h4 class="col text-right"> instance.site_info.site_view.counts.users_active_month;
<i> let description = instance.site_info.site_view.site.description;
{i18n.t("users_active_per_month", { let icon = instance.site_info.site_view.site.icon;
count: users_active_month, let require_application =
formattedCount: numToSI(users_active_month), instance.site_info.site_view.site.require_application;
})} return (
</i> <div class="card col-6">
</h4> <header>
<div class="row">
<h4 class="col">{domain}</h4>
<h4 class="col text-right">
<i>
{i18n.t("users_active_per_month", {
count: users_active_month,
formattedCount: numToSI(users_active_month),
})}
</i>
</h4>
</div>
</header>
<div class="is-center">
<img
class="join-banner"
src={icon || "/static/assets/images/lemmy.svg"}
/>
</div> </div>
</header> <br />
<div class="is-center"> <p class="join-desc">{description}</p>
<img <footer>
class="join-banner" {require_application ? (
src={icon || "/static/assets/images/lemmy.svg"} <a class="button primary" href={`https://${domain}`}>
/> {i18n.t("apply_to_join")}
</a>
) : (
<a class="button primary" href={`https://${domain}`}>
{i18n.t("join")}
</a>
)}
</footer>
</div> </div>
<br /> );
<p class="join-desc">{description}</p> })}
<footer>
{require_application ? (
<a class="button primary" href={`https://${domain}`}>
{i18n.t("apply_to_join")}
</a>
) : (
<a class="button primary" href={`https://${domain}`}>
{i18n.t("join")}
</a>
)}
</footer>
</div>
);
})}
</div> </div>
</div> </div>
); );