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 this.state.siteRes.site_view.match({
25 some: siteView => `${i18n.t("instances")} - ${siteView.site.name}`,
31 return this.state.siteRes.federated_instances.match({
32 some: federated_instances => (
33 <div className="container-lg">
35 title={this.documentTitle}
36 path={this.context.router.route.match.url}
41 <div className="col-md-6">
42 <h5>{i18n.t("linked_instances")}</h5>
43 {this.itemList(federated_instances.linked)}
45 {federated_instances.allowed.match({
47 allowed.length > 0 && (
48 <div className="col-md-6">
49 <h5>{i18n.t("allowed_instances")}</h5>
50 {this.itemList(allowed)}
55 {federated_instances.blocked.match({
57 blocked.length > 0 && (
58 <div className="col-md-6">
59 <h5>{i18n.t("blocked_instances")}</h5>
60 {this.itemList(blocked)}
72 itemList(items: string[]) {
73 let noneFound = <div>{i18n.t("none_found")}</div>;
74 return items.length > 0 ? (
78 <a href={`https://${i}`} rel={relTags}>