feat: ficha por cliente en portafolio (conexiones, accesos, logo, módulos)
Cada tenant tiene una ficha con plataformas, invitaciones por email, logo de marca y toggles de módulos visibles en el portal cliente. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -21,12 +21,14 @@ import {
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import TenantSwitcher from '@/components/TenantSwitcher';
|
||||
import type { DashboardModuleId } from '@/lib/tenant-modules';
|
||||
|
||||
type NavItem = {
|
||||
href: string;
|
||||
label: string;
|
||||
icon: React.ComponentType<{ className?: string }>;
|
||||
iconClass: string;
|
||||
moduleId: DashboardModuleId;
|
||||
};
|
||||
|
||||
const NAV_ITEMS: NavItem[] = [
|
||||
@@ -35,54 +37,63 @@ const NAV_ITEMS: NavItem[] = [
|
||||
label: 'Métricas',
|
||||
icon: BarChart3,
|
||||
iconClass: 'text-brand-500',
|
||||
moduleId: 'kpis',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/crm',
|
||||
label: 'CRM',
|
||||
icon: Contact,
|
||||
iconClass: 'text-teal-500',
|
||||
moduleId: 'crm',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/seguimiento',
|
||||
label: 'Seguimiento',
|
||||
icon: Radio,
|
||||
iconClass: 'text-sky-500',
|
||||
moduleId: 'seguimiento',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/estrategia',
|
||||
label: 'Objetivos del Mes',
|
||||
icon: Target,
|
||||
iconClass: 'text-emerald-500',
|
||||
moduleId: 'estrategia',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/calendario',
|
||||
label: 'Calendario Editorial',
|
||||
icon: CalendarDays,
|
||||
iconClass: 'text-pink-500',
|
||||
moduleId: 'calendario',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/ad-tracker',
|
||||
label: 'Ad Tracker',
|
||||
icon: Megaphone,
|
||||
iconClass: 'text-violet-500',
|
||||
moduleId: 'ad-tracker',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/activos',
|
||||
label: 'Biblioteca de Activos',
|
||||
icon: FolderGit2,
|
||||
iconClass: 'text-blue-500',
|
||||
moduleId: 'activos',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/creatives',
|
||||
label: 'Pipeline creatividades',
|
||||
icon: FolderGit2,
|
||||
iconClass: 'text-orange-500',
|
||||
moduleId: 'creatives',
|
||||
},
|
||||
{
|
||||
href: '/dashboard/asistente',
|
||||
label: 'Asistente IA Financiero',
|
||||
icon: Bot,
|
||||
iconClass: 'text-purple-500',
|
||||
moduleId: 'asistente',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -96,7 +107,7 @@ function NavLink({
|
||||
item,
|
||||
onNavigate,
|
||||
}: {
|
||||
item: NavItem;
|
||||
item: NavItem | (Omit<NavItem, 'moduleId'> & { moduleId?: string });
|
||||
onNavigate?: () => void;
|
||||
}) {
|
||||
const pathname = usePathname();
|
||||
@@ -125,6 +136,9 @@ export default function DashboardShell({
|
||||
role,
|
||||
isAgency,
|
||||
viewName,
|
||||
enabledModules,
|
||||
clientLogoUrl,
|
||||
brandLabel,
|
||||
logoutAction,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
@@ -133,28 +147,57 @@ export default function DashboardShell({
|
||||
role: string;
|
||||
isAgency: boolean;
|
||||
viewName?: string;
|
||||
/** null = show all (agency default). */
|
||||
enabledModules?: Record<DashboardModuleId, boolean> | null;
|
||||
clientLogoUrl?: string | null;
|
||||
brandLabel?: string;
|
||||
logoutAction: () => void | Promise<void>;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const close = () => setOpen(false);
|
||||
|
||||
const visibleNav = NAV_ITEMS.filter((item) => {
|
||||
if (isAgency) return true;
|
||||
if (!enabledModules) return true;
|
||||
return enabledModules[item.moduleId] !== false;
|
||||
});
|
||||
|
||||
const showClientBrand = Boolean(clientLogoUrl);
|
||||
const title = showClientBrand ? brandLabel || company : '4VENTURES';
|
||||
const subtitle = showClientBrand
|
||||
? isAgency
|
||||
? 'Vista cliente'
|
||||
: 'Portal cliente'
|
||||
: 'Centro de Mando';
|
||||
|
||||
const sidebar = (
|
||||
<div className="flex h-full flex-col">
|
||||
<div className="flex items-center gap-3 px-2 py-3 border-b border-gray-200 mb-5">
|
||||
<Image
|
||||
src="/logo-4ventures.png"
|
||||
alt="4Ventures"
|
||||
width={40}
|
||||
height={40}
|
||||
className="rounded-lg object-cover shrink-0"
|
||||
priority
|
||||
/>
|
||||
{clientLogoUrl ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={clientLogoUrl}
|
||||
alt={title}
|
||||
width={40}
|
||||
height={40}
|
||||
className="rounded-lg object-contain shrink-0 w-10 h-10 bg-white border border-gray-100"
|
||||
/>
|
||||
) : (
|
||||
<Image
|
||||
src="/logo-4ventures.png"
|
||||
alt="4Ventures"
|
||||
width={40}
|
||||
height={40}
|
||||
className="rounded-lg object-cover shrink-0"
|
||||
priority
|
||||
/>
|
||||
)}
|
||||
<div className="min-w-0">
|
||||
<p className="font-bold text-sm tracking-wide text-gray-900 leading-tight">
|
||||
4VENTURES
|
||||
<p className="font-bold text-sm tracking-wide text-gray-900 leading-tight truncate">
|
||||
{title}
|
||||
</p>
|
||||
<p className="text-xs text-gray-500 font-medium leading-tight">
|
||||
Centro de Mando
|
||||
{subtitle}
|
||||
</p>
|
||||
</div>
|
||||
<button
|
||||
@@ -168,13 +211,13 @@ export default function DashboardShell({
|
||||
</div>
|
||||
|
||||
<nav className="flex-1 overflow-y-auto space-y-1.5 pr-1">
|
||||
{NAV_ITEMS.map((item) => (
|
||||
{visibleNav.map((item) => (
|
||||
<NavLink key={item.href} item={item} onNavigate={close} />
|
||||
))}
|
||||
|
||||
{isAgency ? (
|
||||
<div className="pt-4 mt-4 border-t border-gray-200">
|
||||
<span className="px-3 text-[10px] font-bold uppercase tracking-wider text-gray-400">
|
||||
<span className="px-3 text-[10px] font-bold uppercase tracking-wider text-gray-500">
|
||||
Agencia OS
|
||||
</span>
|
||||
<div className="mt-1">
|
||||
|
||||
Reference in New Issue
Block a user