discord: use placeholder if guild icon not available

also centers the invite on the form/user discord modal.
user-page
Harvey Tindall 1 year ago
parent 765a749959
commit 094f7cea94
No known key found for this signature in database
GPG Key ID: BBC65952848FB1A2

@ -210,7 +210,9 @@ func (d *DiscordDaemon) NewTempInvite(ageSeconds, maxUses int) (inviteURL, iconU
d.app.err.Printf("Discord: Failed to get guild: %v", err) d.app.err.Printf("Discord: Failed to get guild: %v", err)
return return
} }
// FIXME: Fix CSS, and handle no icon
iconURL = guild.IconURL("256") iconURL = guild.IconURL("256")
fmt.Println("GOT ICON", iconURL)
return return
} }

@ -49,7 +49,7 @@
<div class="card relative mx-auto my-[10%] w-4/5 lg:w-1/3"> <div class="card relative mx-auto my-[10%] w-4/5 lg:w-1/3">
<span class="heading mb-4">{{ .strings.linkDiscord }}</span> <span class="heading mb-4">{{ .strings.linkDiscord }}</span>
<p class="content mb-4"> {{ .discordSendPINMessage }}</p> <p class="content mb-4"> {{ .discordSendPINMessage }}</p>
<h1 class="text-center text-2xl mb-2">{{ .discordPIN }}</h1> <h1 class="text-center text-2xl mb-2 pin"></h1>
<a id="discord-invite"></a> <a id="discord-invite"></a>
<span class="button ~info @low full-width center mt-4" id="discord-waiting">{{ .strings.success }}</span> <span class="button ~info @low full-width center mt-4" id="discord-waiting">{{ .strings.success }}</span>
</div> </div>

@ -46,7 +46,9 @@
<span class="heading mb-4">{{ .strings.linkDiscord }}</span> <span class="heading mb-4">{{ .strings.linkDiscord }}</span>
<p class="content mb-4"> {{ .discordSendPINMessage }}</p> <p class="content mb-4"> {{ .discordSendPINMessage }}</p>
<h1 class="text-center text-2xl mb-2 pin"></h1> <h1 class="text-center text-2xl mb-2 pin"></h1>
<div class="row center">
<a id="discord-invite"></a> <a id="discord-invite"></a>
</div>
<span class="button ~info @low full-width center mt-4" id="discord-waiting">{{ .strings.success }}</span> <span class="button ~info @low full-width center mt-4" id="discord-waiting">{{ .strings.success }}</span>
</div> </div>
</div> </div>

@ -40,7 +40,8 @@ module.exports = {
d_urge: dark.d_urge, d_urge: dark.d_urge,
d_warning: dark.d_warning, d_warning: dark.d_warning,
d_info: dark.d_info, d_info: dark.d_info,
d_critical: dark.d_critical d_critical: dark.d_critical,
discord: "#5865F2"
} }
} }
}, },

@ -75,7 +75,13 @@ export class Discord {
const link = document.getElementById("discord-invite") as HTMLAnchorElement; const link = document.getElementById("discord-invite") as HTMLAnchorElement;
link.href = inv.invite; link.href = inv.invite;
link.target = "_blank"; link.target = "_blank";
if (inv.icon != "") {
link.innerHTML = `<span class="img-circle lg mr-4"><img class="img-circle" src="${inv.icon}" width="64" height="64"></span>${window.discordServerName}`; link.innerHTML = `<span class="img-circle lg mr-4"><img class="img-circle" src="${inv.icon}" width="64" height="64"></span>${window.discordServerName}`;
} else {
link.innerHTML = `
<span class="shield mr-4 bg-discord"><i class="ri-discord-fill ri-xl text-white"></i></span>${window.discordServerName}
`;
}
}); });
private _checkVerified = () => { private _checkVerified = () => {

Loading…
Cancel
Save