Modify instances page to not link to blocked instances (#2076)

* Modified instances page to not link to blocked instances, as well as showing allowed and blocked in columns instead of one giant list

* Update src/shared/components/home/instances.tsx

Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>

* Update src/shared/components/home/instances.tsx

---------

Co-authored-by: Beehaw Dev <dev@beehaw.dev>
Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
This commit is contained in:
Security-Chief-Odo 2023-08-25 12:23:00 -05:00 committed by GitHub
parent fd8d452829
commit 3338887385
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 23 deletions

@ -1 +1 @@
Subproject commit 22637606f4a4455458e64cefe9f5ec33dccb6c52
Subproject commit cda65b80a58e24d8d397a835f67b193255e7b806

View file

@ -94,24 +94,25 @@ export class Instances extends Component<any, InstancesState> {
</h2>
{this.itemList(instances.linked)}
</div>
</div>
<div className="row">
{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 className="col-md-6">
{instances.allowed && instances.allowed.length > 0 && (
<>
<h2 className="h5 mb-3">
{I18NextService.i18n.t("allowed_instances")}
</h2>
{this.itemList(instances.allowed)}
</>
)}
{instances.blocked && instances.blocked.length > 0 && (
<>
<h2 className="h5 mb-3">
{I18NextService.i18n.t("blocked_instances")}
</h2>
{this.itemList(instances.blocked, false)}
</>
)}
</div>
</div>
</>
) : (
@ -133,7 +134,7 @@ export class Instances extends Component<any, InstancesState> {
);
}
itemList(items: Instance[]) {
itemList(items: Instance[], link = true) {
return items.length > 0 ? (
<div className="table-responsive">
<table id="instances_table" className="table table-sm table-hover">
@ -148,9 +149,15 @@ export class Instances extends Component<any, InstancesState> {
{items.map(i => (
<tr key={i.domain}>
<td>
<a href={`https://${i.domain}`} rel={relTags}>
{i.domain}
</a>
{link ? (
<a href={`https://${i.domain}`} rel={relTags}>
{" "}
{i.domain}{" "}
</a>
) : (
<span> {i.domain} </span>
)}
;
</td>
<td>{i.software}</td>
<td>{i.version}</td>