feat(rbac): implement NIP-29 room roles and permission gating (#47)
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user