mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-19 05:25:43 +00:00
chore: fix member list
This commit is contained in:
parent
9259a85e69
commit
867d150a6d
@ -3,6 +3,7 @@ import { useEffect, useState } from "react";
|
|||||||
import toast from "react-hot-toast";
|
import toast from "react-hot-toast";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { User } from "@/types/proto/api/v2/user_service";
|
import { User } from "@/types/proto/api/v2/user_service";
|
||||||
|
import { convertRoleFromPb } from "@/utils/user";
|
||||||
import useUserStore from "../../stores/v1/user";
|
import useUserStore from "../../stores/v1/user";
|
||||||
import { showCommonDialog } from "../Alert";
|
import { showCommonDialog } from "../Alert";
|
||||||
import CreateUserDialog from "../CreateUserDialog";
|
import CreateUserDialog from "../CreateUserDialog";
|
||||||
@ -89,7 +90,7 @@ const MemberSection = () => {
|
|||||||
<tr key={user.email}>
|
<tr key={user.email}>
|
||||||
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-gray-900 dark:text-gray-500">{user.nickname}</td>
|
<td className="whitespace-nowrap py-4 pl-4 pr-3 text-sm text-gray-900 dark:text-gray-500">{user.nickname}</td>
|
||||||
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{user.email}</td>
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{user.email}</td>
|
||||||
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{user.role}</td>
|
<td className="whitespace-nowrap px-3 py-4 text-sm text-gray-500">{convertRoleFromPb(user.role)}</td>
|
||||||
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm">
|
<td className="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm">
|
||||||
<IconButton
|
<IconButton
|
||||||
size="sm"
|
size="sm"
|
||||||
|
11
frontend/web/src/utils/user.ts
Normal file
11
frontend/web/src/utils/user.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { Role } from "@/types/proto/api/v2/user_service";
|
||||||
|
|
||||||
|
export const convertRoleFromPb = (role: Role): string => {
|
||||||
|
if (role === Role.ADMIN) {
|
||||||
|
return "Admin";
|
||||||
|
} else if (role === Role.USER) {
|
||||||
|
return "User";
|
||||||
|
} else {
|
||||||
|
return "Unknown";
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user