1 import { Component } from "inferno";
2 import { GetSiteResponse } from "lemmy-js-client";
3 import { setIsoData } from "../utils";
4 import { i18n } from "../i18next";
5 import { HtmlTags } from "./html-tags";
7 interface InstancesState {
8 siteRes: GetSiteResponse;
11 export class Instances extends Component<any, InstancesState> {
12 private isoData = setIsoData(this.context);
13 private emptyState: InstancesState = {
14 siteRes: this.isoData.site_res,
17 constructor(props: any, context: any) {
18 super(props, context);
19 this.state = this.emptyState;
22 get documentTitle(): string {
23 return `${i18n.t("instances")} - ${this.state.siteRes.site_view.site.name}`;
27 let federated_instances = this.state.siteRes?.federated_instances;
29 federated_instances && (
30 <div class="container">
32 title={this.documentTitle}
33 path={this.context.router.route.match.url}
36 <div class="col-md-6">
37 <h5>{i18n.t("linked_instances")}</h5>
38 {this.itemList(federated_instances.linked)}
40 {federated_instances.allowed.length > 0 && (
41 <div class="col-md-6">
42 <h5>{i18n.t("allowed_instances")}</h5>
43 {this.itemList(federated_instances.allowed)}
46 {federated_instances.blocked.length > 0 && (
47 <div class="col-md-6">
48 <h5>{i18n.t("blocked_instances")}</h5>
49 {this.itemList(federated_instances.blocked)}
58 itemList(items: string[]) {
59 return items.length > 0 ? (
63 <a href={`https://${i}`} rel="noopener">
70 <div>{i18n.t("none_found")}</div>