No teams tab for Core Tier (#1001)

* Teams tab renders for basic tier only
This commit is contained in:
RachelElysia 2021-06-07 19:17:16 -04:00 committed by GitHub
parent 8b13e354f8
commit 70e416f263
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,9 @@
import React from "react";
import { Tab, Tabs, TabList } from "react-tabs";
import { push } from "react-router-redux";
import { useDispatch } from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import { IConfig } from "interfaces/config";
import permissionUtils from "utilities/permissions";
import PATHS from "router/paths";
@ -10,6 +12,12 @@ interface ISettingSubNavItem {
pathname: string;
}
interface IRootState {
app: {
config: IConfig;
};
}
const settingsSubNav: ISettingSubNavItem[] = [
{
name: "Organization settings",
@ -19,10 +27,6 @@ const settingsSubNav: ISettingSubNavItem[] = [
name: "Users",
pathname: PATHS.ADMIN_USERS,
},
{
name: "Teams",
pathname: PATHS.ADMIN_TEAMS,
},
];
interface ISettingsWrapperProp {
@ -45,6 +49,16 @@ const SettingsWrapper = (props: ISettingsWrapperProp): JSX.Element => {
children,
location: { pathname },
} = props;
// Add Teams tab for basic tier only
const config = useSelector((state: IRootState) => state.app.config);
if (permissionUtils.isBasicTier(config)) {
settingsSubNav.push({
name: "Teams",
pathname: PATHS.ADMIN_TEAMS,
});
}
const dispatch = useDispatch();
const navigateToNav = (i: number): void => {