Navigation improvements

This commit is contained in:
Hazem Krimi
2023-05-28 16:57:03 +01:00
parent eb9b60bbf2
commit 90ad62d41f
2 changed files with 10 additions and 10 deletions
+6 -6
View File
@@ -72,11 +72,11 @@ const Navbar = () => {
<Link
href='/template'
color={
new RegExp('template', 'i').test(location.pathname)
new RegExp(/(template|prototype)/, 'i').test(location.pathname)
? 'developer'
: 'black'
}
selected={new RegExp('template', 'i').test(location.pathname)}
selected={new RegExp(/(template|prototype)/, 'i').test(location.pathname)}
>
Templates
</Link>
@@ -109,22 +109,22 @@ const Navbar = () => {
<Link
href='/project'
color={
new RegExp('project', 'i').test(location.pathname)
new RegExp(/(project|support)/, 'i').test(location.pathname)
? 'productOwner'
: 'black'
}
selected={new RegExp('project', 'i').test(location.pathname)}
selected={new RegExp(/(project|support)/, 'i').test(location.pathname)}
>
Projects
</Link>
<Link
href='/template'
color={
new RegExp('template', 'i').test(location.pathname)
new RegExp(/(template|prototype)/, 'i').test(location.pathname)
? 'productOwner'
: 'black'
}
selected={new RegExp('template', 'i').test(location.pathname)}
selected={new RegExp(/(template|prototype)/, 'i').test(location.pathname)}
>
Templates
</Link>
+4 -4
View File
@@ -96,7 +96,7 @@ const Sidebar = () => {
});
useEffect(() => {
if (/project/i.test(location.pathname)) {
if (/(project|support)/i.test(location.pathname)) {
if (role !== 'client') getProjects();
else getProjectsByClientId({ variables: { id: currentUser?.id! } });
}
@@ -123,7 +123,7 @@ const Sidebar = () => {
const showAddButton = (role: string, pathname: string) => {
switch (role) {
case 'client':
return /project/i.test(pathname);
return /(project|support)/i.test(pathname);
case 'productOwner':
return /template/i.test(pathname);
case 'developer':
@@ -139,7 +139,7 @@ const Sidebar = () => {
<>
<Box display='flex' flexDirection='column'>
{projects &&
new RegExp(/project/, 'i').test(location.pathname) &&
new RegExp(/(project|support)/, 'i').test(location.pathname) &&
projects.map((project, index) => (
<Box marginBottom='20px' key={project.id}>
<div id={`project-${project.id}`}>
@@ -261,7 +261,7 @@ const Sidebar = () => {
/>
</Box>
)}
{/project/i.test(location.pathname) &&
{/(project|support)/i.test(location.pathname) &&
['client', 'productOwner'].includes(role as string) && (
<Box>
<IconButton