This commit is contained in:
nin0dev 2024-07-26 12:18:09 -04:00
parent ba57809c38
commit d510a40a63

View file

@ -5,7 +5,8 @@
*/ */
import { classNameFactory } from "@api/Styles"; import { classNameFactory } from "@api/Styles";
import { ModalCloseButton, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal"; import ErrorBoundary from "@components/ErrorBoundary";
import { ModalCloseButton, ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { Forms, Parser } from "@webpack/common"; import { Forms, Parser } from "@webpack/common";
import { GuildMember } from "discord-types/general"; import { GuildMember } from "discord-types/general";
@ -14,14 +15,15 @@ const cl = classNameFactory("vc-inrole-");
export function showInRoleModal(members: GuildMember[], roleId: string, channelId: string) { export function showInRoleModal(members: GuildMember[], roleId: string, channelId: string) {
openModal(props => openModal(props =>
<> <>
<ErrorBoundary>
<ModalRoot {...props} size={ModalSize.DYNAMIC} fullscreenOnMobile={true}> <ModalRoot {...props} size={ModalSize.DYNAMIC} fullscreenOnMobile={true} >
<ModalHeader className={cl("header")}> <ModalHeader className={cl("header")}>
<Forms.FormText style={{ fontSize: "1.2rem", fontWeight: "bold", marginRight: "7px" }}>Members of role { <Forms.FormText style={{ fontSize: "1.2rem", fontWeight: "bold", marginRight: "7px" }}>Members of role {
Parser.parse(`<@&${roleId}>`, true, { channelId, viewingChannelId: channelId }) Parser.parse(`<@&${roleId}>`, true, { channelId, viewingChannelId: channelId })
} ({members.length})</Forms.FormText> } ({members.length})</Forms.FormText>
<ModalCloseButton onClick={props.onClose} className={cl("close")} /> <ModalCloseButton onClick={props.onClose} className={cl("close")} />
</ModalHeader> </ModalHeader>
<ModalContent>
<div style={{ padding: "13px 20px" }} className={cl("member-list")}> <div style={{ padding: "13px 20px" }} className={cl("member-list")}>
{ {
members.length !== 0 ? members.map(member => members.length !== 0 ? members.map(member =>
@ -33,7 +35,9 @@ export function showInRoleModal(members: GuildMember[], roleId: string, channelI
) : <Forms.FormText>Looks like no online cached members with that role were found. Try scrolling down on your member list to cache more users!</Forms.FormText> ) : <Forms.FormText>Looks like no online cached members with that role were found. Try scrolling down on your member list to cache more users!</Forms.FormText>
} }
</div> </div>
</ModalContent>
</ModalRoot> </ModalRoot>
</ErrorBoundary>
</> </>
); );
} }