1 import { None } from "@sniptt/monads";
2 import { Component } from "inferno";
3 import { GetSiteResponse } from "lemmy-js-client";
4 import { i18n } from "../../i18next";
5 import { relTags, setIsoData } from "../../utils";
6 import { HtmlTags } from "../common/html-tags";
8 interface InstancesState {
9 siteRes: GetSiteResponse;
12 export class Instances extends Component<any, InstancesState> {
13 private isoData = setIsoData(this.context);
14 private emptyState: InstancesState = {
15 siteRes: this.isoData.site_res,
18 constructor(props: any, context: any) {
19 super(props, context);
20 this.state = this.emptyState;
23 get documentTitle(): string {
24 return `${i18n.t("instances")} - ${this.state.siteRes.site_view.site.name}`;
28 return this.state.siteRes.federated_instances.match({
29 some: federated_instances => (
30 <div className="container-lg">
32 title={this.documentTitle}
33 path={this.context.router.route.match.url}
38 <div className="col-md-6">
39 <h5>{i18n.t("linked_instances")}</h5>
40 {this.itemList(federated_instances.linked)}
42 {federated_instances.allowed.match({
44 allowed.length > 0 && (
45 <div className="col-md-6">
46 <h5>{i18n.t("allowed_instances")}</h5>
47 {this.itemList(allowed)}
52 {federated_instances.blocked.match({
54 blocked.length > 0 && (
55 <div className="col-md-6">
56 <h5>{i18n.t("blocked_instances")}</h5>
57 {this.itemList(blocked)}
69 itemList(items: string[]) {
70 let noneFound = <div>{i18n.t("none_found")}</div>;
71 return items.length > 0 ? (
75 <a href={`https://${i}`} rel={relTags}>