Minor role display refactor (#2578)

This commit is contained in:
hagen-danswer 2024-09-27 09:50:03 -07:00 committed by GitHub
parent 19e57474dc
commit 66a459234d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 10 deletions

View File

@ -1,7 +1,7 @@
"use client";
import { usePopup } from "@/components/admin/connectors/Popup";
import { useState, useEffect } from "react";
import { useState } from "react";
import { ConnectorTitle } from "@/components/admin/connectors/ConnectorTitle";
import { AddMemberForm } from "./AddMemberForm";
import { updateUserGroup, updateCuratorStatus } from "./lib";
@ -11,6 +11,7 @@ import {
User,
UserGroup,
UserRole,
USER_ROLE_LABELS,
} from "@/lib/types";
import { AddConnectorForm } from "./AddConnectorForm";
import {
@ -106,7 +107,7 @@ const UserRoleDropdown = ({
</div>
);
} else {
return <div>{localRole}</div>;
return <div>{USER_ROLE_LABELS[localRole]}</div>;
}
};

View File

@ -1,4 +1,4 @@
import { type User, UserStatus, UserRole } from "@/lib/types";
import { type User, UserStatus, UserRole, USER_ROLE_LABELS } from "@/lib/types";
import CenteredPageSelector from "./CenteredPageSelector";
import { type PageSelectorProps } from "@/components/PageSelector";
import { HidableSection } from "@/app/admin/assistants/HidableSection";
@ -21,13 +21,6 @@ import { useState } from "react";
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
import { DeleteEntityModal } from "@/components/modals/DeleteEntityModal";
const USER_ROLE_LABELS: Record<UserRole, string> = {
[UserRole.BASIC]: "Basic",
[UserRole.ADMIN]: "Admin",
[UserRole.GLOBAL_CURATOR]: "Global Curator",
[UserRole.CURATOR]: "Curator",
};
interface Props {
users: Array<User>;
setPopup: (spec: PopupSpec) => void;

View File

@ -23,6 +23,13 @@ export enum UserRole {
GLOBAL_CURATOR = "global_curator",
}
export const USER_ROLE_LABELS: Record<UserRole, string> = {
[UserRole.BASIC]: "Basic",
[UserRole.ADMIN]: "Admin",
[UserRole.GLOBAL_CURATOR]: "Global Curator",
[UserRole.CURATOR]: "Curator",
};
export interface User {
id: string;
email: string;