import { None } from "@sniptt/monads"; import { Component } from "inferno"; import { GetSiteResponse } from "lemmy-js-client"; import { i18n } from "../../i18next"; import { relTags, setIsoData } from "../../utils"; import { HtmlTags } from "../common/html-tags"; interface InstancesState { siteRes: GetSiteResponse; } export class Instances extends Component { private isoData = setIsoData(this.context); private emptyState: InstancesState = { siteRes: this.isoData.site_res, }; constructor(props: any, context: any) { super(props, context); this.state = this.emptyState; } get documentTitle(): string { return `${i18n.t("instances")} - ${this.state.siteRes.site_view.site.name}`; } render() { return this.state.siteRes.federated_instances.match({ some: federated_instances => (
{i18n.t("linked_instances")}
{this.itemList(federated_instances.linked)}
{federated_instances.allowed.match({ some: allowed => allowed.length > 0 && (
{i18n.t("allowed_instances")}
{this.itemList(allowed)}
), none: <>, })} {federated_instances.blocked.match({ some: blocked => blocked.length > 0 && (
{i18n.t("blocked_instances")}
{this.itemList(blocked)}
), none: <>, })}
), none: <>, }); } itemList(items: string[]) { let noneFound =
{i18n.t("none_found")}
; return items.length > 0 ? ( ) : ( noneFound ); } }