Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8eb508574b | |||
| 0317a83ec6 |
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@zen/core",
|
||||
"version": "1.4.38",
|
||||
"version": "1.4.39",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@zen/core",
|
||||
"version": "1.4.38",
|
||||
"version": "1.4.39",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^2.0.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@zen/core",
|
||||
"version": "1.4.38",
|
||||
"version": "1.4.39",
|
||||
"description": "Un CMS Next.js construit sur l'essentiel, rien de plus, rien de moins.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import * as Icons from '@zen/core/shared/icons';
|
||||
import { ChevronDownIcon } from '@zen/core/shared/icons';
|
||||
|
||||
@@ -22,17 +22,10 @@ function resolveIcon(iconNameOrComponent) {
|
||||
|
||||
const AdminSidebar = ({ isMobileMenuOpen, setIsMobileMenuOpen, appName, enabledModules, navigationSections: serverNavigationSections }) => {
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
|
||||
const [collapsedSections, setCollapsedSections] = useState(new Set());
|
||||
|
||||
const toggleSection = (sectionId) => {
|
||||
const section = navigationSections.find(s => s.id === sectionId);
|
||||
|
||||
if (section && isSectionActive(section)) {
|
||||
return;
|
||||
}
|
||||
|
||||
setCollapsedSections(prev => {
|
||||
const newCollapsed = new Set(prev);
|
||||
if (newCollapsed.has(sectionId)) {
|
||||
@@ -131,12 +124,7 @@ const AdminSidebar = ({ isMobileMenuOpen, setIsMobileMenuOpen, appName, enabledM
|
||||
return (
|
||||
<div key={section.id}>
|
||||
<button
|
||||
onClick={() => {
|
||||
if (isCollapsed && section.items.length > 0) {
|
||||
router.push(section.items[0].href);
|
||||
}
|
||||
toggleSection(section.id);
|
||||
}}
|
||||
onClick={() => toggleSection(section.id)}
|
||||
className={`cursor-pointer ${parentBase} ${isActive && isCollapsed ? parentActif : isActive ? parentActifOuvert : inactive}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
|
||||
Reference in New Issue
Block a user