feat: make kick and ban red in the context menu (#350)

Co-authored-by: Paul Makles <paulmakles@gmail.com>
This commit is contained in:
3nt3 2022-01-04 12:03:39 +01:00 committed by GitHub
parent 5735020013
commit 42771f7137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -459,15 +459,18 @@ export default function ContextMenus() {
locale?: string, locale?: string,
disabled?: boolean, disabled?: boolean,
tip?: Children, tip?: Children,
color?: string,
) { ) {
lastDivider = false; lastDivider = false;
elements.push( elements.push(
<MenuItem data={action} disabled={disabled}> <MenuItem data={action} disabled={disabled}>
<span style={{color}}>
<Text <Text
id={`app.context_menu.${ id={`app.context_menu.${
locale ?? action.action locale ?? action.action
}`} }`}
/> />
</span>
{tip && <div className="tip">{tip}</div>} {tip && <div className="tip">{tip}</div>}
</MenuItem>, </MenuItem>,
); );
@ -652,18 +655,30 @@ export default function ContextMenus() {
if ( if (
serverPermissions & ServerPermission.KickMembers serverPermissions & ServerPermission.KickMembers
) )
generateAction({ generateAction(
{
action: "kick_member", action: "kick_member",
target: server, target: server,
user: user!, user: user!,
}); },
undefined, // this is needed because generateAction uses positional, not named parameters
undefined,
null,
"var(--error)", // the only relevant part really
);
if (serverPermissions & ServerPermission.BanMembers) if (serverPermissions & ServerPermission.BanMembers)
generateAction({ generateAction(
{
action: "ban_member", action: "ban_member",
target: server, target: server,
user: user!, user: user!,
}); },
undefined,
undefined,
null,
"var(--error)",
);
} }
} }