mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/Card.tsx';
|
|
import SimpleBarChart from './SimpleBarChart';
|
|
|
|
type Props = {
|
|
flowsByType: Record<string, number>;
|
|
flowsBySector: Record<string, number>;
|
|
avgFlowValue: number;
|
|
totalFlowVolume: number;
|
|
t: (key: string) => string;
|
|
};
|
|
|
|
const ResourceFlowAnalyticsSection = ({
|
|
flowsByType,
|
|
flowsBySector,
|
|
avgFlowValue,
|
|
totalFlowVolume,
|
|
t,
|
|
}: Props) => {
|
|
const byType = Object.entries(flowsByType || {}).map(([label, value]) => ({ label, value }));
|
|
const bySector = Object.entries(flowsBySector || {}).map(([label, value]) => ({ label, value }));
|
|
|
|
return (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>{t('analyticsDashboard.resourceFlows')}</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<SimpleBarChart data={byType.slice(0, 6)} title={t('analyticsDashboard.flowsByType')} />
|
|
</div>
|
|
<div>
|
|
<SimpleBarChart
|
|
data={bySector.slice(0, 6)}
|
|
title={t('analyticsDashboard.flowsBySector')}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
};
|
|
|
|
export default ResourceFlowAnalyticsSection;
|