Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor role display refactor #2578

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions web/src/app/ee/admin/groups/[groupId]/GroupDisplay.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -11,6 +11,7 @@ import {
User,
UserGroup,
UserRole,
USER_ROLE_LABELS,
} from "@/lib/types";
import { AddConnectorForm } from "./AddConnectorForm";
import {
Expand Down Expand Up @@ -106,7 +107,7 @@ const UserRoleDropdown = ({
</div>
);
} else {
return <div>{localRole}</div>;
return <div>{USER_ROLE_LABELS[localRole]}</div>;
}
};

Expand Down
9 changes: 1 addition & 8 deletions web/src/components/admin/users/SignedUpUserTable.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions web/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading