/**
* DashboardTemplate - Master template for module dashboard pages
*
* Usage:
*
*/
import React, { ReactNode } from 'react';
interface KPICard {
title: string;
value: string | number;
description?: string;
icon?: ReactNode;
trend?: {
value: number;
isPositive: boolean;
};
}
interface WorkflowStep {
step: number;
title: string;
status: 'completed' | 'pending' | 'in_progress';
description?: string;
count?: number;
actionLabel?: string;
onAction?: () => void;
}
interface ChartConfig {
title: string;
type: 'bar' | 'line' | 'pie' | 'progress';
data: any;
}
interface DashboardTemplateProps {
title: string;
subtitle?: string;
kpiCards?: KPICard[];
workflowSteps?: WorkflowStep[];
charts?: ChartConfig[];
recentActivity?: ReactNode;
quickActions?: ReactNode;
className?: string;
}
export default function DashboardTemplate({
title,
subtitle,
kpiCards = [],
workflowSteps = [],
charts = [],
recentActivity,
quickActions,
className = '',
}: DashboardTemplateProps) {
return (
{/* Page Header */}
{title}
{subtitle && (
{subtitle}
)}
{/* KPI Cards Row */}
{kpiCards.length > 0 && (
{kpiCards.map((card, index) => (
{card.title}
{card.value}
{card.trend && (
{card.trend.isPositive ? '↑' : '↓'} {Math.abs(card.trend.value)}%
)}
{card.icon && (
{card.icon}
)}
{card.description && (
{card.description}
)}
))}
)}
{/* Quick Actions */}
{quickActions && (
{quickActions}
)}
{/* Workflow Steps */}
{workflowSteps.length > 0 && (
Workflow Steps - Track your planning progress
{workflowSteps.map((step) => (
{step.step}. {step.title}
{step.status === 'completed' ? 'Completed' : step.status === 'in_progress' ? 'In Progress' : 'Pending'}
{step.description && (
{step.description}
)}
{step.count !== undefined && (
{step.count} items
)}
{step.actionLabel && step.onAction && step.status !== 'completed' && (
)}
))}
)}
{/* Charts Row */}
{charts.length > 0 && (
{charts.map((chart, index) => (
{chart.title}
{/* Chart component would be rendered here */}
Chart: {chart.type}
))}
)}
{/* Recent Activity */}
{recentActivity && (
Recent Activity
{recentActivity}
)}
);
}