mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-01 18:20:28 +00:00
Update sidebar component
This commit is contained in:
@@ -105,78 +105,82 @@ const Sidebar = () => {
|
|||||||
<>
|
<>
|
||||||
<Box display='flex' flexDirection='column'>
|
<Box display='flex' flexDirection='column'>
|
||||||
{projects &&
|
{projects &&
|
||||||
projects.map((project) => (
|
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}`}>
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
color={role}
|
color={role}
|
||||||
selected={new RegExp(project.id, 'i').test(
|
selected={
|
||||||
location.pathname
|
new RegExp(project.id, 'i').test(location.pathname) ||
|
||||||
)}
|
(index === 0 && location.pathname === '/project')
|
||||||
|
}
|
||||||
text={project.name[0]}
|
text={project.name[0]}
|
||||||
onClick={() => history.push(`/project/${project.id}`)}
|
onClick={() => history.push(`/project/${project.id}`)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
component={`project-${project.id}`}
|
component={`project-${project.id}`}
|
||||||
items={[{ action: () => {}, label: project.name }]}
|
items={[{ label: project.name }]}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
{templates &&
|
{templates &&
|
||||||
templates.map((template) => (
|
templates.map((template, index) => (
|
||||||
<Box marginBottom='20px' key={template.id}>
|
<Box marginBottom='20px' key={template.id}>
|
||||||
<div id={`template-${template.id}`}>
|
<div id={`template-${template.id}`}>
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
color={role}
|
color={role}
|
||||||
selected={new RegExp(template.id, 'i').test(
|
selected={
|
||||||
location.pathname
|
new RegExp(template.id, 'i').test(location.pathname) ||
|
||||||
)}
|
(index === 0 && location.pathname === '/template')
|
||||||
|
}
|
||||||
text={template.name[0]}
|
text={template.name[0]}
|
||||||
onClick={() => history.push(`/template/${template.id}`)}
|
onClick={() => history.push(`/template/${template.id}`)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
component={`template-${template.id}`}
|
component={`template-${template.id}`}
|
||||||
items={[{ action: () => {}, label: template.name }]}
|
items={[{ label: template.name }]}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
{features &&
|
{features &&
|
||||||
features.map((feature) => (
|
features.map((feature, index) => (
|
||||||
<Box marginBottom='20px' key={feature.id}>
|
<Box marginBottom='20px' key={feature.id}>
|
||||||
<div id={`feature-${feature.id}`}>
|
<div id={`feature-${feature.id}`}>
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
color={role}
|
color={role}
|
||||||
selected={new RegExp(feature.id, 'i').test(
|
selected={
|
||||||
location.pathname
|
new RegExp(feature.id, 'i').test(location.pathname) ||
|
||||||
)}
|
(index === 0 && location.pathname === '/feature')
|
||||||
|
}
|
||||||
text={feature.name[0]}
|
text={feature.name[0]}
|
||||||
onClick={() => history.push(`/feature/${feature.id}`)}
|
onClick={() => history.push(`/feature/${feature.id}`)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
component={`feature-${feature.id}`}
|
component={`feature-${feature.id}`}
|
||||||
items={[{ action: () => {}, label: feature.name }]}
|
items={[{ label: feature.name }]}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
{categories &&
|
{categories &&
|
||||||
categories.map((category) => (
|
categories.map((category, index) => (
|
||||||
<Box marginBottom='20px' key={category.id}>
|
<Box marginBottom='20px' key={category.id}>
|
||||||
<div id={`category-${category.id}`}>
|
<div id={`category-${category.id}`}>
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
color={role}
|
color={role}
|
||||||
selected={new RegExp(category.id, 'i').test(
|
selected={
|
||||||
location.pathname
|
new RegExp(category.id, 'i').test(location.pathname) ||
|
||||||
)}
|
(index === 0 && location.pathname === '/category')
|
||||||
|
}
|
||||||
text={category.name[0]}
|
text={category.name[0]}
|
||||||
onClick={() => history.push(`/category/${category.id}`)}
|
onClick={() => history.push(`/category/${category.id}`)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
component={`category-${category.id}`}
|
component={`category-${category.id}`}
|
||||||
items={[{ action: () => {}, label: category.name }]}
|
items={[{ label: category.name }]}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
))}
|
))}
|
||||||
|
|||||||
Reference in New Issue
Block a user