Web: Shared: Utils: moved getUserTypeLabel to utilities
This commit is contained in:
parent
dded438211
commit
ed76251daf
@ -37,6 +37,7 @@ import { Encoder } from "./encoder";
|
||||
import { combineUrl } from "./combineUrl";
|
||||
import { getCookie } from "./cookie";
|
||||
import { checkIsSSR } from "./device";
|
||||
import { AvatarRole } from "../components/avatar/Avatar.enums";
|
||||
|
||||
export const desktopConstants = Object.freeze({
|
||||
domain: !checkIsSSR() && window.location.origin,
|
||||
@ -85,6 +86,26 @@ export const isPublicRoom = () => {
|
||||
return window.location.pathname === "/rooms/share";
|
||||
};
|
||||
|
||||
export const getUserTypeLabel = (
|
||||
role: AvatarRole | undefined,
|
||||
t: (key: string) => string,
|
||||
) => {
|
||||
switch (role) {
|
||||
case "owner":
|
||||
return t("Common:Owner");
|
||||
case "admin":
|
||||
return t("Common:DocSpaceAdmin");
|
||||
case "manager":
|
||||
return t("Common:RoomAdmin");
|
||||
case "collaborator":
|
||||
return t("Common:PowerUser");
|
||||
case "user":
|
||||
return t("Common:User");
|
||||
default:
|
||||
return t("Common:User");
|
||||
}
|
||||
};
|
||||
|
||||
export const getShowText = () => {
|
||||
const showArticle = localStorage.getItem("showArticle");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user