Merge branch 'main' into report-fix

This commit is contained in:
SleeplessOne1917 2023-08-29 20:27:03 +00:00 committed by GitHub
commit 9c70d3228a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,12 +6,14 @@ import {
GetSiteResponse, GetSiteResponse,
Instance, Instance,
} from "lemmy-js-client"; } from "lemmy-js-client";
import classNames from "classnames";
import { relTags } from "../../config"; import { relTags } from "../../config";
import { InitialFetchRequest } from "../../interfaces"; import { InitialFetchRequest } from "../../interfaces";
import { FirstLoadService, I18NextService } from "../../services"; import { FirstLoadService, I18NextService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon"; import { Spinner } from "../common/icon";
import Tabs from "../common/tabs";
type InstancesData = RouteDataResponse<{ type InstancesData = RouteDataResponse<{
federatedInstancesResponse: GetFederatedInstancesResponse; federatedInstancesResponse: GetFederatedInstancesResponse;
@ -85,37 +87,30 @@ export class Instances extends Component<any, InstancesState> {
case "success": { case "success": {
const instances = this.state.instancesRes.data.federated_instances; const instances = this.state.instancesRes.data.federated_instances;
return instances ? ( return instances ? (
<> <div className="row">
<h1 className="h4 mb-4">{I18NextService.i18n.t("instances")}</h1> <div className="col-lg-8">
<div className="row"> <Tabs
<div className="col-md-6"> tabs={["linked", "allowed", "blocked"]
<h2 className="h5 mb-3"> .filter(status => instances[status].length)
{I18NextService.i18n.t("linked_instances")} .map(status => ({
</h2> key: status,
{this.itemList(instances.linked)} label: I18NextService.i18n.t(`${status}_instances`),
</div> getNode: isSelected => (
<div
role="tabpanel"
className={classNames("tab-pane show", {
active: isSelected,
})}
>
{this.itemList(instances[status])}
</div>
),
}))}
/>
</div> </div>
<div className="row"> </div>
{instances.allowed && instances.allowed.length > 0 && (
<div className="col-md-6">
<h2 className="h5 mb-3">
{I18NextService.i18n.t("allowed_instances")}
</h2>
{this.itemList(instances.allowed)}
</div>
)}
{instances.blocked && instances.blocked.length > 0 && (
<div className="col-md-6">
<h2 className="h5 mb-3">
{I18NextService.i18n.t("blocked_instances")}
</h2>
{this.itemList(instances.blocked)}
</div>
)}
</div>
</>
) : ( ) : (
<></> <h5>No linked instance</h5>
); );
} }
} }