import * as React from 'react' import { Stack, Group, Title, Text, Paper, SimpleGrid } from '@mantine/core' interface MetricConfig { label: string value: string | number delta?: { value: number; isPositive: boolean } sparklineData?: number[] } interface ChartConfig { id: string title: string type: 'line' | 'bar' | 'area' span?: 1 | 2 height?: number content: React.ReactNode } interface AnalyticsPageProps { title: string subtitle?: string dateRange?: React.ReactNode metrics: MetricConfig[] charts: ChartConfig[] actions?: React.ReactNode className?: string } export function analyticsPage({ title, subtitle, dateRange, metrics, charts, actions, }: AnalyticsPageProps): React.ReactElement { const metricCols = metrics.length <= 2 ? { base: 1, md: 2 } : metrics.length <= 3 ? { base: 1, md: 3 } : { base: 1, md: 2, lg: 4 } return ( {/* Header */} {title} {subtitle && {subtitle}} {dateRange} {actions} {/* KPI Row */} {metrics.map((metric, i) => ( {metric.label} {metric.value} {metric.delta && ( {metric.delta.value > 0 ? '+' : ''}{metric.delta.value}% )} ))} {/* Charts Grid */} {charts.map((chart) => ( {chart.title} {chart.content} ))} ) } export type { AnalyticsPageProps, MetricConfig, ChartConfig }