mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-10 01:03:36 -05:00
feat: make kick and ban red in the context menu (#350)
Co-authored-by: Paul Makles <paulmakles@gmail.com>
This commit is contained in:
parent
5735020013
commit
42771f7137
1 changed files with 30 additions and 15 deletions
|
@ -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)",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue