feat(shell): mover Calendario editorial y Pipeline RRSS al nivel principal bajo Metricas

This commit is contained in:
Marcos Fargas
2026-10-17 23:02:28 +02:00
parent cb821793cf
commit 80f8ffa655

View File

@@ -61,6 +61,20 @@ const NAV_ITEMS: NavItem[] = [
iconClass: 'text-brand-500', iconClass: 'text-brand-500',
moduleId: 'kpis', moduleId: 'kpis',
}, },
{
href: '/dashboard/calendario',
label: 'Calendario editorial',
icon: CalendarDays,
iconClass: 'text-amber-500',
moduleId: 'calendario',
},
{
href: '/dashboard/creatives',
label: 'Pipeline RRSS',
icon: Images,
iconClass: 'text-pink-500',
moduleId: 'pipeline',
},
{ {
href: '/dashboard/marca', href: '/dashboard/marca',
label: 'Zona de marca', label: 'Zona de marca',
@@ -229,11 +243,6 @@ export default function DashboardShell({
const pathname = usePathname(); const pathname = usePathname();
const showDateHeader = shouldShowDateHeader(pathname); const showDateHeader = shouldShowDateHeader(pathname);
const isSocialRoute =
pathname === '/dashboard/social' ||
pathname === '/dashboard/calendario' ||
pathname === '/dashboard/creatives';
const isAgenciaRoute = const isAgenciaRoute =
pathname === '/dashboard/agencia' || pathname === '/dashboard/agencia' ||
(pathname !== null && pathname.startsWith('/dashboard/agencia/')); (pathname !== null && pathname.startsWith('/dashboard/agencia/'));
@@ -245,23 +254,21 @@ export default function DashboardShell({
(pathname !== null && pathname.startsWith('/dashboard/crm/')) || (pathname !== null && pathname.startsWith('/dashboard/crm/')) ||
pathname === '/dashboard/ad-tracker' || pathname === '/dashboard/ad-tracker' ||
(pathname !== null && pathname.startsWith('/dashboard/ad-tracker/')) || (pathname !== null && pathname.startsWith('/dashboard/ad-tracker/')) ||
isSocialRoute || pathname === '/dashboard/social' ||
(pathname !== null && pathname.startsWith('/dashboard/social/')) ||
pathname === '/dashboard/organico' || pathname === '/dashboard/organico' ||
(pathname !== null && pathname.startsWith('/dashboard/organico/')); (pathname !== null && pathname.startsWith('/dashboard/organico/'));
const [expandedSections, setExpandedSections] = useState<Record<string, boolean>>({}); const [expandedSections, setExpandedSections] = useState<Record<string, boolean>>({});
const isMetricasOpen = expandedSections['metricas'] ?? isMetricasRoute; const isMetricasOpen = expandedSections['metricas'] ?? isMetricasRoute;
const isSocialOpen = expandedSections['social'] ?? isSocialRoute;
const isAgenciaOpen = expandedSections['agencia'] ?? isAgenciaRoute; const isAgenciaOpen = expandedSections['agencia'] ?? isAgenciaRoute;
const toggleSection = (key: 'metricas' | 'social' | 'agencia') => { const toggleSection = (key: 'metricas' | 'agencia') => {
setExpandedSections((prev) => { setExpandedSections((prev) => {
const current = const current =
key === 'metricas' key === 'metricas'
? (prev['metricas'] ?? isMetricasRoute) ? (prev['metricas'] ?? isMetricasRoute)
: key === 'social'
? (prev['social'] ?? isSocialRoute)
: (prev['agencia'] ?? isAgenciaRoute); : (prev['agencia'] ?? isAgenciaRoute);
return { return {
...prev, ...prev,
@@ -368,24 +375,11 @@ export default function DashboardShell({
) : null} ) : null}
{moduleOn('social') ? ( {moduleOn('social') ? (
<div className="space-y-0.5">
<Link <Link
href="/dashboard/social" href="/dashboard/social"
onClick={(e) => { onClick={close}
if (moduleOn('calendario') || moduleOn('pipeline')) { className={subLinkCls('/dashboard/social')}
if (pathname === '/dashboard/social') {
e.preventDefault();
toggleSection('social');
return;
} else if (!isSocialOpen) {
toggleSection('social');
}
}
close();
}}
className={`${subLinkCls('/dashboard/social')} justify-between`}
> >
<div className="flex items-center gap-2.5 min-w-0">
<Share2 <Share2
className={`h-3.5 w-3.5 shrink-0 ${ className={`h-3.5 w-3.5 shrink-0 ${
isActive(pathname, '/dashboard/social') isActive(pathname, '/dashboard/social')
@@ -394,60 +388,7 @@ export default function DashboardShell({
}`} }`}
/> />
<span className="truncate">Social</span> <span className="truncate">Social</span>
</div>
{moduleOn('calendario') || moduleOn('pipeline') ? (
<span
role="button"
tabIndex={0}
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
toggleSection('social');
}}
className="p-0.5 rounded hover:bg-white/10 text-mist-400 hover:text-white transition-colors shrink-0"
aria-label={isSocialOpen ? 'Ocultar páginas' : 'Mostrar páginas'}
>
<ChevronDown
className={`h-3 w-3 transition-transform duration-200 ${
isSocialOpen ? 'rotate-0 text-white' : '-rotate-90 text-mist-400'
}`}
/>
</span>
) : null}
</Link> </Link>
{isSocialOpen ? (
<div className="space-y-0.5 my-0.5">
{moduleOn('calendario') ? (
<Link
href="/dashboard/calendario"
onClick={close}
className={`ml-11 flex items-center gap-2 rounded-md px-2.5 py-1.5 text-[12px] font-medium transition-colors ${
isActive(pathname, '/dashboard/calendario')
? 'bg-white/[0.07] text-white'
: 'text-mist-400 hover:bg-white/[0.05] hover:text-white'
}`}
>
<CalendarDays className="h-3 w-3 shrink-0" />
<span className="truncate">Calendario editorial</span>
</Link>
) : null}
{moduleOn('pipeline') ? (
<Link
href="/dashboard/creatives"
onClick={close}
className={`ml-11 flex items-center gap-2 rounded-md px-2.5 py-1.5 text-[12px] font-medium transition-colors ${
isActive(pathname, '/dashboard/creatives')
? 'bg-white/[0.07] text-white'
: 'text-mist-400 hover:bg-white/[0.05] hover:text-white'
}`}
>
<Images className="h-3 w-3 shrink-0" />
<span className="truncate">Pipeline RRSS</span>
</Link>
) : null}
</div>
) : null}
</div>
) : null} ) : null}
{moduleOn('organico') ? ( {moduleOn('organico') ? (