|
|
@@ -1,8 +1,10 @@
|
|
|
import { Card } from "@/components/ui/card";
|
|
|
import { Phone, CheckCircle, Clock, TrendingUp, DollarSign, UserX, Loader2 } from "lucide-react";
|
|
|
import { useDashboard } from "./context/DashboardContext";
|
|
|
+import { useTranslation } from "react-i18next";
|
|
|
|
|
|
export function KPICards() {
|
|
|
+ const { t } = useTranslation();
|
|
|
const { stats, loading, error } = useDashboard();
|
|
|
|
|
|
if (loading) {
|
|
|
@@ -24,7 +26,7 @@ export function KPICards() {
|
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
|
|
<Card className="bg-slate-800 border-slate-700 p-6 col-span-full">
|
|
|
<div className="text-center text-slate-400">
|
|
|
- {error || 'No data available'}
|
|
|
+ {error || t('dashboard.kpi.noData')}
|
|
|
</div>
|
|
|
</Card>
|
|
|
</div>
|
|
|
@@ -33,56 +35,56 @@ export function KPICards() {
|
|
|
|
|
|
const kpiData = [
|
|
|
{
|
|
|
- title: "Total Calls",
|
|
|
+ title: t('dashboard.kpi.totalCalls'),
|
|
|
value: stats.totalCalls.value.toString(),
|
|
|
change: stats.totalCalls.change,
|
|
|
changeType: stats.totalCalls.changeType,
|
|
|
- subtitle: "vs yesterday",
|
|
|
+ subtitle: t('dashboard.kpi.vsYesterday'),
|
|
|
icon: Phone,
|
|
|
iconColor: "text-blue-500",
|
|
|
},
|
|
|
{
|
|
|
- title: "Resolved Calls",
|
|
|
+ title: t('dashboard.kpi.resolvedCalls'),
|
|
|
value: stats.resolvedCalls.value.toString(),
|
|
|
change: stats.resolvedCalls.change,
|
|
|
changeType: stats.resolvedCalls.changeType,
|
|
|
- subtitle: "vs yesterday",
|
|
|
+ subtitle: t('dashboard.kpi.vsYesterday'),
|
|
|
icon: CheckCircle,
|
|
|
iconColor: "text-green-500",
|
|
|
},
|
|
|
{
|
|
|
- title: "Avg Call Duration",
|
|
|
+ title: t('dashboard.kpi.avgCallDuration'),
|
|
|
value: stats.avgDuration.formatted,
|
|
|
change: stats.avgDuration.change,
|
|
|
changeType: stats.avgDuration.changeType,
|
|
|
- subtitle: "vs yesterday",
|
|
|
+ subtitle: t('dashboard.kpi.vsYesterday'),
|
|
|
icon: Clock,
|
|
|
iconColor: "text-orange-500",
|
|
|
},
|
|
|
{
|
|
|
- title: "Total Cost",
|
|
|
+ title: t('dashboard.kpi.totalCost'),
|
|
|
value: stats.totalCost.formatted,
|
|
|
change: stats.totalCost.change,
|
|
|
changeType: stats.totalCost.changeType,
|
|
|
- subtitle: "vs yesterday",
|
|
|
+ subtitle: t('dashboard.kpi.vsYesterday'),
|
|
|
icon: DollarSign,
|
|
|
iconColor: "text-green-500",
|
|
|
},
|
|
|
{
|
|
|
- title: "Time Saved",
|
|
|
+ title: t('dashboard.kpi.timeSaved'),
|
|
|
value: stats.timeSaved.formatted,
|
|
|
change: stats.timeSaved.change,
|
|
|
changeType: stats.timeSaved.changeType,
|
|
|
- subtitle: "vs yesterday",
|
|
|
+ subtitle: t('dashboard.kpi.vsYesterday'),
|
|
|
icon: TrendingUp,
|
|
|
iconColor: "text-purple-500",
|
|
|
},
|
|
|
{
|
|
|
- title: "Saved on Human Costs",
|
|
|
+ title: t('dashboard.kpi.savedOnHumanCosts'),
|
|
|
value: stats.humanCostSaved.formatted,
|
|
|
change: stats.humanCostSaved.change,
|
|
|
changeType: stats.humanCostSaved.changeType,
|
|
|
- subtitle: "vs yesterday",
|
|
|
+ subtitle: t('dashboard.kpi.vsYesterday'),
|
|
|
icon: UserX,
|
|
|
iconColor: "text-green-500",
|
|
|
},
|