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
|
||||
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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user