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