Hide image instead of setting it to blank

This commit is contained in:
CenTdemeern1 2025-02-12 21:55:17 +01:00
parent becaf79690
commit c1f61cfe9b

View file

@ -6,8 +6,6 @@ import { findButtonOrFail, findFormOrFail, findImageOrFail, findInputOrFail, fin
import knownSoftware from "./known_software.mjs"; import knownSoftware from "./known_software.mjs";
import { Instance } from "./storage_manager.mjs"; import { Instance } from "./storage_manager.mjs";
const blankImage = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
export function mergeHost(host: string, secure: boolean): string { export function mergeHost(host: string, secure: boolean): string {
return `http${secure ? "s" : ""}://${host}`; return `http${secure ? "s" : ""}://${host}`;
} }
@ -85,7 +83,7 @@ export class InstanceDetailsDialog extends FormDialog {
this.instanceSoftware.appendChild(option); this.instanceSoftware.appendChild(option);
} }
this.instanceIcon.src = blankImage; this.instanceIcon.hidden = true;
this.closeButton.addEventListener("click", e => this.close()); this.closeButton.addEventListener("click", e => this.close());
@ -172,7 +170,10 @@ export class InstanceDetailsDialog extends FormDialog {
this.instanceHost.value = data.host; this.instanceHost.value = data.host;
this.instanceHostSecure.checked = data.hostSecure; this.instanceHostSecure.checked = data.hostSecure;
this.instanceSoftware.value = data.software; this.instanceSoftware.value = data.software;
this.instanceIcon.src = data.iconURL ?? blankImage; if (data.iconURL !== null) {
this.instanceIcon.src = data.iconURL;
this.instanceIcon.hidden = false;
} else this.instanceIcon.hidden = true;
this.#populateDefaultsList(data.preferredFor); this.#populateDefaultsList(data.preferredFor);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {