mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-02 02:30:29 +00:00
Navigation improvements
This commit is contained in:
@@ -72,11 +72,11 @@ const Navbar = () => {
|
|||||||
<Link
|
<Link
|
||||||
href='/template'
|
href='/template'
|
||||||
color={
|
color={
|
||||||
new RegExp('template', 'i').test(location.pathname)
|
new RegExp(/(template|prototype)/, 'i').test(location.pathname)
|
||||||
? 'developer'
|
? 'developer'
|
||||||
: 'black'
|
: 'black'
|
||||||
}
|
}
|
||||||
selected={new RegExp('template', 'i').test(location.pathname)}
|
selected={new RegExp(/(template|prototype)/, 'i').test(location.pathname)}
|
||||||
>
|
>
|
||||||
Templates
|
Templates
|
||||||
</Link>
|
</Link>
|
||||||
@@ -109,22 +109,22 @@ const Navbar = () => {
|
|||||||
<Link
|
<Link
|
||||||
href='/project'
|
href='/project'
|
||||||
color={
|
color={
|
||||||
new RegExp('project', 'i').test(location.pathname)
|
new RegExp(/(project|support)/, 'i').test(location.pathname)
|
||||||
? 'productOwner'
|
? 'productOwner'
|
||||||
: 'black'
|
: 'black'
|
||||||
}
|
}
|
||||||
selected={new RegExp('project', 'i').test(location.pathname)}
|
selected={new RegExp(/(project|support)/, 'i').test(location.pathname)}
|
||||||
>
|
>
|
||||||
Projects
|
Projects
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
href='/template'
|
href='/template'
|
||||||
color={
|
color={
|
||||||
new RegExp('template', 'i').test(location.pathname)
|
new RegExp(/(template|prototype)/, 'i').test(location.pathname)
|
||||||
? 'productOwner'
|
? 'productOwner'
|
||||||
: 'black'
|
: 'black'
|
||||||
}
|
}
|
||||||
selected={new RegExp('template', 'i').test(location.pathname)}
|
selected={new RegExp(/(template|prototype)/, 'i').test(location.pathname)}
|
||||||
>
|
>
|
||||||
Templates
|
Templates
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ const Sidebar = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (/project/i.test(location.pathname)) {
|
if (/(project|support)/i.test(location.pathname)) {
|
||||||
if (role !== 'client') getProjects();
|
if (role !== 'client') getProjects();
|
||||||
else getProjectsByClientId({ variables: { id: currentUser?.id! } });
|
else getProjectsByClientId({ variables: { id: currentUser?.id! } });
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ const Sidebar = () => {
|
|||||||
const showAddButton = (role: string, pathname: string) => {
|
const showAddButton = (role: string, pathname: string) => {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case 'client':
|
case 'client':
|
||||||
return /project/i.test(pathname);
|
return /(project|support)/i.test(pathname);
|
||||||
case 'productOwner':
|
case 'productOwner':
|
||||||
return /template/i.test(pathname);
|
return /template/i.test(pathname);
|
||||||
case 'developer':
|
case 'developer':
|
||||||
@@ -139,7 +139,7 @@ const Sidebar = () => {
|
|||||||
<>
|
<>
|
||||||
<Box display='flex' flexDirection='column'>
|
<Box display='flex' flexDirection='column'>
|
||||||
{projects &&
|
{projects &&
|
||||||
new RegExp(/project/, 'i').test(location.pathname) &&
|
new RegExp(/(project|support)/, 'i').test(location.pathname) &&
|
||||||
projects.map((project, index) => (
|
projects.map((project, index) => (
|
||||||
<Box marginBottom='20px' key={project.id}>
|
<Box marginBottom='20px' key={project.id}>
|
||||||
<div id={`project-${project.id}`}>
|
<div id={`project-${project.id}`}>
|
||||||
@@ -261,7 +261,7 @@ const Sidebar = () => {
|
|||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
{/project/i.test(location.pathname) &&
|
{/(project|support)/i.test(location.pathname) &&
|
||||||
['client', 'productOwner'].includes(role as string) && (
|
['client', 'productOwner'].includes(role as string) && (
|
||||||
<Box>
|
<Box>
|
||||||
<IconButton
|
<IconButton
|
||||||
|
|||||||
Reference in New Issue
Block a user