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