add visible joining indicator

This commit is contained in:
TaiAurori 2021-08-31 21:37:42 +00:00 committed by GitHub
parent a10e5100d3
commit 2f950aab53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,6 +106,11 @@ export default function EmbedInvite(props: Props) {
{invite.member_count} members {invite.member_count} members
</EmbedInviteMemberCount> </EmbedInviteMemberCount>
</EmbedInviteDetails> </EmbedInviteDetails>
{processing ? (
<div>
<Preloader type="ring" />
</div>
) : (
<Button onClick={async () => { <Button onClick={async () => {
try { try {
setProcessing(true); setProcessing(true);
@ -143,6 +148,7 @@ export default function EmbedInvite(props: Props) {
} }
await client.joinInvite(code); await client.joinInvite(code);
setProcessing(false);
} catch (err) { } catch (err) {
setError(takeError(err)); setError(takeError(err));
setProcessing(false); setProcessing(false);
@ -150,5 +156,6 @@ export default function EmbedInvite(props: Props) {
}}> }}>
{client.servers.get(invite.server_id) ? "Joined" : "Join"} {client.servers.get(invite.server_id) ? "Joined" : "Join"}
</Button> </Button>
)}
</EmbedInviteBase> </EmbedInviteBase>
} }