mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-11-21 20:01:16 +00:00
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:
parent
686c773534
commit
acd202c590
1 changed files with 55 additions and 43 deletions
|
@ -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<any, any> {
|
||||
constructor(props: any, context: any) {
|
||||
super(props, context);
|
||||
|
@ -86,51 +88,61 @@ export class Instances extends Component<any, any> {
|
|||
<div>
|
||||
<h2>{header}</h2>
|
||||
<div class="row">
|
||||
{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 (
|
||||
<div class="card col-6">
|
||||
<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>
|
||||
{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 (
|
||||
<div class="card col-6">
|
||||
<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>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src={icon || "/static/assets/images/lemmy.svg"}
|
||||
/>
|
||||
<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>
|
||||
<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>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue