mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-22 07:00:58 -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}>
|
||||||
<Text
|
<span style={{color}}>
|
||||||
id={`app.context_menu.${
|
<Text
|
||||||
locale ?? action.action
|
id={`app.context_menu.${
|
||||||
}`}
|
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",
|
{
|
||||||
target: server,
|
action: "kick_member",
|
||||||
user: user!,
|
target: server,
|
||||||
});
|
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",
|
{
|
||||||
target: server,
|
action: "ban_member",
|
||||||
user: user!,
|
target: server,
|
||||||
});
|
user: user!,
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
null,
|
||||||
|
"var(--error)",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue