Refactor invite state handling and add group invite message

pull/1168/head
beak2825 2025-12-26 16:38:25 -05:00 committed by GitHub
parent 41f47a1a3f
commit ce56bbebbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 2 deletions

View File

@ -82,7 +82,7 @@ export function EmbedInvite({ code }: Props) {
const [error, setError] = useState<string | undefined>(undefined);
const [joinError, setJoinError] = useState<string | undefined>(undefined);
const [invite, setInvite] = useState<
(API.InviteResponse & { type: "Server" }) | undefined
API.InviteResponse | undefined
>(undefined);
useEffect(() => {
@ -93,7 +93,7 @@ export function EmbedInvite({ code }: Props) {
client
.fetchInvite(code)
.then((data) =>
setInvite(data as API.InviteResponse & { type: "Server" }),
setInvite(data as API.InviteResponse),
)
.catch((err) => setError(takeError(err)));
}
@ -114,6 +114,17 @@ export function EmbedInvite({ code }: Props) {
);
}
if (invite.type === "Group") {
return (
<EmbedInviteBase>
<ServerIcon size={55} />
<EmbedInviteDetails>
<EmbedInviteName>Group Invites are not supported at this time.</EmbedInviteName>
</EmbedInviteDetails>
</EmbedInviteBase>
);
}
return (
<>
<EmbedInviteBase>