fix: Editor displayed as member in role menu

This commit is contained in:
Tom Moor
2024-04-10 23:06:30 -04:00
parent d883ba347b
commit 9c179fdd30
3 changed files with 34 additions and 19 deletions

View File

@@ -1,3 +1,4 @@
import { type TFunction } from "i18next";
import { UserRole } from "../types";
interface User {
@@ -5,6 +6,26 @@ interface User {
}
export class UserRoleHelper {
/**
* Get the display name for a role.
*
* @param role The role to get the display name for
* @param t The translation function
* @returns The display name for the role
*/
static displayName(role: UserRole, t: TFunction): string {
switch (role) {
case UserRole.Guest:
return t("Guest");
case UserRole.Viewer:
return t("Viewer");
case UserRole.Member:
return t("Editor");
case UserRole.Admin:
return t("Admin");
}
}
/**
* Check if the first role is higher than the second role.
*