Shows a user's role on their profile, and lets those who hold user:manage
change it.
f
RoleChip(unnamed 0: { role: Role; }): React.JSX.Element | null
Renders the role badge next to the username in ProfileHeader, for
moderators and admins only.
f
RoleSwitcher(unnamed 0: RoleSwitcherProps): React.JSX.Element
Renders the user's role as a Segmented whose clicks save it to
PATCH /api/users/:id/role, which checks the permission again.
I
RoleSwitcherProps
Passed to RoleSwitcher by ProfileManageTab, which shows it only to
those who hold user:manage, on another user's profile.
- currentRole: Role
-
onSaved: (role: Role) => void
Called with the role the server kept.
- userId: string
Usage
import * as mod from "src/components/profile/RoleSwitcher.tsx";