Renamed the admin type to corporate
This commit is contained in:
@@ -24,7 +24,7 @@ export default function BatchCodeGenerator({user}: {user: User}) {
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (user && (user.type === "admin" || user.type === "teacher")) {
|
||||
if (user && (user.type === "corporate" || user.type === "teacher")) {
|
||||
setExpiryDate(user.subscriptionExpirationDate || null);
|
||||
}
|
||||
}, [user]);
|
||||
@@ -126,8 +126,8 @@ export default function BatchCodeGenerator({user}: {user: User}) {
|
||||
<Button
|
||||
className="w-44 2xl:w-48"
|
||||
variant="outline"
|
||||
onClick={() => generateCode("admin")}
|
||||
disabled={emails.length === 0 || isLoading || !PERMISSIONS.generateCode.admin.includes(user.type)}>
|
||||
onClick={() => generateCode("corporate")}
|
||||
disabled={emails.length === 0 || isLoading || !PERMISSIONS.generateCode.corporate.includes(user.type)}>
|
||||
Admin
|
||||
</Button>
|
||||
<Button
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function CodeGenerator({user}: {user: User}) {
|
||||
const [isExpiryDateEnabled, setIsExpiryDateEnabled] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
if (user && (user.type === "admin" || user.type === "teacher")) {
|
||||
if (user && (user.type === "corporate" || user.type === "teacher")) {
|
||||
setExpiryDate(user.subscriptionExpirationDate || null);
|
||||
}
|
||||
}, [user]);
|
||||
@@ -75,8 +75,8 @@ export default function CodeGenerator({user}: {user: User}) {
|
||||
<Button
|
||||
className="w-44 2xl:w-48"
|
||||
variant="outline"
|
||||
onClick={() => generateCode("admin")}
|
||||
disabled={!PERMISSIONS.generateCode.admin.includes(user.type) || (isExpiryDateEnabled && expiryDate === null)}>
|
||||
onClick={() => generateCode("corporate")}
|
||||
disabled={!PERMISSIONS.generateCode.corporate.includes(user.type) || (isExpiryDateEnabled && expiryDate === null)}>
|
||||
Admin
|
||||
</Button>
|
||||
<Button
|
||||
|
||||
@@ -51,7 +51,7 @@ const CreatePanel = ({user, users, group, onCreate}: CreateDialogProps) => {
|
||||
const emailUsers = [...new Set(emails)].map((x) => users.find((y) => y.email.toLowerCase() === x)).filter((x) => x !== undefined);
|
||||
const filteredUsers = emailUsers.filter(
|
||||
(x) =>
|
||||
((user.type === "developer" || user.type === "owner" || user.type === "admin") &&
|
||||
((user.type === "developer" || user.type === "owner" || user.type === "corporate") &&
|
||||
(x?.type === "student" || x?.type === "teacher")) ||
|
||||
(user.type === "teacher" && x?.type === "student"),
|
||||
);
|
||||
@@ -140,7 +140,7 @@ export default function GroupList({user}: {user: User}) {
|
||||
}, [showDisclosure]);
|
||||
|
||||
useEffect(() => {
|
||||
if (user && (user.type === "admin" || user.type === "teacher")) {
|
||||
if (user && (user.type === "corporate" || user.type === "teacher")) {
|
||||
setFilterByUser(true);
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
@@ -31,7 +31,9 @@ export default function UserList({user, filter}: {user: User; filter?: (user: Us
|
||||
useEffect(() => {
|
||||
if (user && users) {
|
||||
const filterUsers =
|
||||
user.type === "admin" || user.type === "student" ? users.filter((u) => groups.flatMap((g) => g.participants).includes(u.id)) : users;
|
||||
user.type === "corporate" || user.type === "student"
|
||||
? users.filter((u) => groups.flatMap((g) => g.participants).includes(u.id))
|
||||
: users;
|
||||
|
||||
const filteredUsers = filter ? filterUsers.filter(filter) : filterUsers;
|
||||
|
||||
@@ -141,9 +143,9 @@ export default function UserList({user, filter}: {user: User; filter?: (user: Us
|
||||
Teacher
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => updateAccountType(row.original, "admin")}
|
||||
onClick={() => updateAccountType(row.original, "corporate")}
|
||||
className="text-sm !py-2 !px-4"
|
||||
disabled={row.original.type === "admin" || !PERMISSIONS.generateCode["admin"].includes(user.type)}>
|
||||
disabled={row.original.type === "corporate" || !PERMISSIONS.generateCode["corporate"].includes(user.type)}>
|
||||
Admin
|
||||
</Button>
|
||||
<Button
|
||||
|
||||
Reference in New Issue
Block a user