feat(rbac): implement NIP-29 room roles and permission gating (#47)

This commit is contained in:
2026-04-17 05:57:10 +05:30
parent 4a967de184
commit abc6dc2860
11 changed files with 951 additions and 140 deletions
+25
View File
@@ -0,0 +1,25 @@
<script lang="ts">
import cx from "classnames"
import {roleColorToCSS} from "@app/core/roles"
type Props = {
role: string
label?: string
color?: number
class?: string
}
const {role, label, color, ...props}: Props = $props()
const style = $derived(
color === undefined
? ""
: `color: ${roleColorToCSS(color)}; border-color: ${roleColorToCSS(color)};`,
)
const className = $derived(cx("badge badge-outline badge-sm", props.class))
</script>
<span class={className} {style}>
{label || role}
</span>