Last Updated: January 20, 2024 22:45 EST Version: 0.6.4 Status: STABLE 🟢
src/components/
├── shared/
│ ├── analytics/
│ │ ├── DetailedAnalytics.tsx
│ │ ├── SecurityMetrics.tsx
│ │ ├── PerformanceMonitor.tsx
│ │ ├── SystemHealthMonitor.tsx
│ │ ├── AIMetricsDisplay.tsx
│ │ └── index.ts
└── ui/
└── Charts/
├── DonationAllocationPieChart.tsx
├── SecurityMetricsChart.tsx
├── PerformanceChart.tsx
├── MapComponent.tsx
├── NetworkActivityChart.tsx
└── index.ts
import { DetailedAnalytics } from '@/components/shared/analytics'
// Usage
<DetailedAnalytics
timeframe="weekly"
showBreakdown={true}
includeHistorical={true}
showSecurityMetrics={true}
showPerformanceData={true}
onTimeframeChange={handleTimeframeChange}
/>
import { SecurityMetrics } from '@/components/shared/analytics'
// Usage
<SecurityMetrics
data={securityData}
refreshInterval={5000}
showThreatDetection={true}
showAIInsights={true}
onAlert={handleSecurityAlert}
/>
import { PerformanceMonitor } from '@/components/shared/analytics'
// Usage
<PerformanceMonitor
metrics={performanceMetrics}
refreshInterval={3000}
showAIMetrics={true}
showDetailedView={true}
onThresholdAlert={handleAlert}
/>
import { SystemHealthMonitor } from '@/components/shared/analytics'
// Usage
<SystemHealthMonitor
metrics={systemMetrics}
refreshInterval={5000}
showDetailedView={true}
includeAIHealth={true}
onAlert={handleSystemAlert}
/>
import { AIMetricsDisplay } from '@/components/shared/analytics'
// New Component
<AIMetricsDisplay
data={aiMetrics}
refreshInterval={3000}
showPredictions={true}
showAccuracy={true}
onModelUpdate={handleUpdate}
/>
import {
DonationAllocationPieChart,
SecurityMetricsChart,
PerformanceChart,
NetworkActivityChart
} from '@/components/ui/Charts'
// Usage with security metrics
<SecurityMetricsChart
data={securityData}
height={300}
showThreats={true}
showPredictions={true}
isLoading={isLoading}
/>
// With performance data
<PerformanceChart
data={performanceData}
height={250}
showAIMetrics={true}
isLoading={isLoading}
error={error}
onRetry={refetch}
/>
interface AnalyticsTheme {
colors: {
primary: string[];
secondary: string[];
accent: string[];
success: string[];
warning: string[];
error: string[];
ai: string[];
};
charts: {
background: string;
gridLines: string;
tooltip: {
bg: string;
text: string;
};
aiHighlight: string;
};
metrics: {
card: {
bg: string;
border: string;
};
ai: {
bg: string;
accent: string;
};
};
}
- Use consistent import paths
- Implement proper error boundaries
- Include loading states
- Handle data validation
- Maintain type safety
- Follow responsive design
- Optimize performance
- Consider accessibility
- Implement AI metrics properly
- Handle real-time updates
- Implement proper memoization
- Use lazy loading
- Optimize re-renders
- Cache API responses
- Virtual scroll for large datasets
- Optimize AI computations
- Batch real-time updates
<ErrorBoundary
fallback={<AnalyticsError onRetry={refetch} />}
onError={logError}
>
<DetailedAnalytics />
</ErrorBoundary>
<Skeleton className="h-[300px] w-full rounded-lg" />
- ARIA labels
- Keyboard navigation
- Color contrast
- Screen reader support
- Focus management
- Real-time announcements
- AI insights accessibility
For implementation details, see implementation.md For component structure, see components-structure.md