diff --git a/src/App.tsx b/src/App.tsx index 3839ed3..0960dc2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -28,7 +28,7 @@ import { AddProject, UpdateProject, Payments, - SupportMessaging, + Support, } from './pages'; import { GetUserByIdQuery, GetUserByIdQueryVariables } from './graphql/types'; import { GET_USER_BY_ID } from './graphql/auth.api'; @@ -136,18 +136,18 @@ const App = () => { } /> - + } /> - + } /> diff --git a/src/components/Sidebar/index.tsx b/src/components/Sidebar/index.tsx index 235d61e..75f1092 100644 --- a/src/components/Sidebar/index.tsx +++ b/src/components/Sidebar/index.tsx @@ -56,8 +56,7 @@ const Sidebar = () => { }, onCompleted({ getAllProjectsByClientId }) { setProjects(getAllProjectsByClientId); - }, - fetchPolicy: 'network-only', + } }); const [getProjects] = useLazyQuery< @@ -66,8 +65,7 @@ const Sidebar = () => { >(GET_ALL_PROJECTS, { onCompleted({ getAllProjects }) { setProjects(getAllProjects); - }, - fetchPolicy: 'network-only', + } }); const [getTemplates] = useLazyQuery< @@ -77,7 +75,6 @@ const Sidebar = () => { onCompleted({ getAllTemplates }) { setTemplates(getAllTemplates); }, - fetchPolicy: 'network-only', }); const [getFeatures] = useLazyQuery< @@ -87,7 +84,6 @@ const Sidebar = () => { onCompleted({ getAllFeatures }) { setFeatures(getAllFeatures); }, - fetchPolicy: 'network-only', }); const [getCategories] = useLazyQuery< @@ -97,7 +93,6 @@ const Sidebar = () => { onCompleted({ getAllCategories }) { setCategories(getAllCategories); }, - fetchPolicy: 'network-only', }); useEffect(() => { @@ -123,8 +118,6 @@ const Sidebar = () => { setFeatures([]); setCategories([]); }; - - // eslint-disable-next-line }, [location.pathname]); return ( @@ -133,14 +126,15 @@ const Sidebar = () => { <> {projects && - projects.map((project) => ( + new RegExp(/project/, 'i').test(location.pathname) && + projects.map((project, index) => (
navigate(`/project/${project.id}`)} /> @@ -152,6 +146,7 @@ const Sidebar = () => { ))} {templates && + new RegExp(/template/, 'i').test(location.pathname) && templates.map((template, index) => (
@@ -172,6 +167,7 @@ const Sidebar = () => { ))} {features && + new RegExp(/feature/, 'i').test(location.pathname) && features.map((feature, index) => (
@@ -192,6 +188,7 @@ const Sidebar = () => { ))} {categories && + new RegExp(/category/, 'i').test(location.pathname) && categories.map((category, index) => (
diff --git a/src/pages/AddCategory/index.tsx b/src/pages/AddCategory/index.tsx index 6c3de69..f33ef83 100644 --- a/src/pages/AddCategory/index.tsx +++ b/src/pages/AddCategory/index.tsx @@ -66,7 +66,14 @@ const AddCategory = () => { }, }); - return role === 'developer' ? ( + if (role !== 'developer') return ( + <> + {role === 'admin' && } + {['client', 'productOwer'].includes(role as string) && } + + ) + + return (