feat(ui): Discord-style roles/channel perms + IDE themes
Split-pane role editor with tri-state channel overrides (roles/members). CSS-var themes (Gruvbox default + 9 IDE palettes) in top bar and settings.
This commit is contained in:
@@ -54,6 +54,37 @@ export const PERMISSION_LABELS: Record<PermissionKey, string> = {
|
||||
MENTION_EVERYONE: 'Mention @everyone',
|
||||
};
|
||||
|
||||
/** Grouped for role/channel permission UIs. ADMINISTRATOR is special-cased in editors. */
|
||||
export const PERM_CATEGORIES: { name: string; keys: PermissionKey[] }[] = [
|
||||
{
|
||||
name: 'General',
|
||||
keys: [
|
||||
'VIEW_CHANNEL',
|
||||
'SEND_MESSAGES',
|
||||
'MANAGE_MESSAGES',
|
||||
'ADD_REACTIONS',
|
||||
'EMBED_LINKS',
|
||||
'ATTACH_FILES',
|
||||
'MENTION_EVERYONE',
|
||||
'USE_EXTERNAL_EMOJIS',
|
||||
'CREATE_INSTANT_INVITE',
|
||||
'CHANGE_NICKNAME',
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Moderation',
|
||||
keys: ['KICK_MEMBERS', 'BAN_MEMBERS', 'MUTE_MEMBERS', 'MANAGE_NICKNAMES'],
|
||||
},
|
||||
{
|
||||
name: 'Server',
|
||||
keys: ['MANAGE_SERVER', 'MANAGE_CHANNELS', 'MANAGE_ROLES', 'MANAGE_WEBHOOKS'],
|
||||
},
|
||||
{
|
||||
name: 'Voice',
|
||||
keys: ['CONNECT_VOICE', 'SPEAK_VOICE', 'SHARE_SCREEN'],
|
||||
},
|
||||
];
|
||||
|
||||
export function hasPermission(perms: number, flag: number): boolean {
|
||||
// Match backend permissions.Has: all required bits must be present.
|
||||
return (perms & flag) === flag;
|
||||
|
||||
Reference in New Issue
Block a user