From e4dee19be73821b339811edadc654c1937fc33df Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Tue, 27 Jan 2026 14:03:48 +0000 Subject: [PATCH] Generated by Spark: Make dashboard use translations --- src/components/dashboard-view.tsx | 74 +++++++++++++++++-------------- src/data/translations/en.json | 29 +++++++++++- src/data/translations/es.json | 29 +++++++++++- src/data/translations/fr.json | 29 +++++++++++- 4 files changed, 121 insertions(+), 40 deletions(-) diff --git a/src/components/dashboard-view.tsx b/src/components/dashboard-view.tsx index ca17971..0cca6c3 100644 --- a/src/components/dashboard-view.tsx +++ b/src/components/dashboard-view.tsx @@ -14,42 +14,47 @@ import { } from '@phosphor-icons/react' import { cn } from '@/lib/utils' import type { DashboardMetrics } from '@/lib/types' +import { useTranslation } from '@/hooks/use-translation' interface DashboardViewProps { metrics: DashboardMetrics } export function DashboardView({ metrics }: DashboardViewProps) { + const { t } = useTranslation() + return (
-

Dashboard

-

Real-time overview of your workforce operations

+

{t('dashboard.title')}

+

{t('dashboard.subtitle')}

} trend={{ value: 12, direction: 'up' }} + trendText={t('dashboard.vsLastWeek', { value: '12' })} variant="warning" /> } variant="default" /> } trend={{ value: 5, direction: 'down' }} + trendText={t('dashboard.vsLastWeek', { value: '5' })} variant="error" /> } variant="warning" @@ -59,8 +64,8 @@ export function DashboardView({ metrics }: DashboardViewProps) {
- Monthly Revenue - Total invoiced this month + {t('dashboard.monthlyRevenue')} + {t('dashboard.monthlyRevenueDescription')}
@@ -68,15 +73,15 @@ export function DashboardView({ metrics }: DashboardViewProps) {
- 12.5% from last month + {t('dashboard.vsLastMonth', { value: '12.5' })}
- Monthly Payroll - Total payroll costs + {t('dashboard.monthlyPayroll')} + {t('dashboard.monthlyPayrollDescription')}
@@ -84,15 +89,15 @@ export function DashboardView({ metrics }: DashboardViewProps) {
- 8.3% from last month + {t('dashboard.vsLastMonth', { value: '8.3' })}
- Gross Margin - Revenue minus payroll + {t('dashboard.grossMargin')} + {t('dashboard.grossMarginDescription')}
@@ -100,7 +105,7 @@ export function DashboardView({ metrics }: DashboardViewProps) {
- 3.2% from last month + {t('dashboard.vsLastMonth', { value: '3.2' })}
@@ -109,34 +114,34 @@ export function DashboardView({ metrics }: DashboardViewProps) {
- Recent Activity - Latest timesheet and billing events + {t('dashboard.recentActivity')} + {t('dashboard.recentActivityDescription')}
} - title="Timesheet approved" + title={t('dashboard.timesheetApproved')} description="John Smith - Week ending 15 Jan 2025" - time="5 minutes ago" + time={t('dashboard.minutesAgo', { value: '5' })} /> } - title="Invoice generated" + title={t('dashboard.invoiceGenerated')} description="INV-00234 - Acme Corp - £2,450" - time="12 minutes ago" + time={t('dashboard.minutesAgo', { value: '12' })} /> } - title="Payroll completed" + title={t('dashboard.payrollCompleted')} description="Weekly run - 45 workers - £28,900" - time="1 hour ago" + time={t('dashboard.hourAgo', { value: '1' })} /> } - title="Document expiring soon" - description="DBS check for Sarah Johnson - 14 days" - time="2 hours ago" + title={t('dashboard.documentExpiringSoon')} + description={`DBS check for Sarah Johnson - ${t('dashboard.days', { value: '14' })}`} + time={t('dashboard.hoursAgo', { value: '2' })} />
@@ -144,25 +149,25 @@ export function DashboardView({ metrics }: DashboardViewProps) { - Quick Actions - Common tasks and workflows + {t('dashboard.quickActions')} + {t('dashboard.quickActionsDescription')} @@ -176,10 +181,11 @@ interface MetricCardProps { value: number icon: React.ReactNode trend?: { value: number; direction: 'up' | 'down' } + trendText?: string variant?: 'default' | 'success' | 'warning' | 'error' } -function MetricCard({ title, value, icon, trend, variant = 'default' }: MetricCardProps) { +function MetricCard({ title, value, icon, trend, trendText, variant = 'default' }: MetricCardProps) { const borderColors = { default: 'border-border', success: 'border-success/20', @@ -207,7 +213,7 @@ function MetricCard({ title, value, icon, trend, variant = 'default' }: MetricCa ) : ( )} - {trend.value}% vs last week + {trendText || `${trend.value}% vs last week`}
)} diff --git a/src/data/translations/en.json b/src/data/translations/en.json index 82e6c6e..7b9c260 100644 --- a/src/data/translations/en.json +++ b/src/data/translations/en.json @@ -80,13 +80,38 @@ }, "dashboard": { "title": "Dashboard", - "subtitle": "Overview of key metrics and activities", + "subtitle": "Real-time overview of your workforce operations", "welcomeBack": "Welcome back", "recentActivity": "Recent Activity", + "recentActivityDescription": "Latest timesheet and billing events", "quickActions": "Quick Actions", + "quickActionsDescription": "Common tasks and workflows", "notifications": "Notifications", "pendingApprovals": "Pending Approvals", - "upcomingDeadlines": "Upcoming Deadlines" + "pendingExpenses": "Pending Expenses", + "overdueInvoices": "Overdue Invoices", + "complianceAlerts": "Compliance Alerts", + "upcomingDeadlines": "Upcoming Deadlines", + "monthlyRevenue": "Monthly Revenue", + "monthlyRevenueDescription": "Total invoiced this month", + "monthlyPayroll": "Monthly Payroll", + "monthlyPayrollDescription": "Total payroll costs", + "grossMargin": "Gross Margin", + "grossMarginDescription": "Revenue minus payroll", + "createTimesheet": "Create Timesheet", + "generateInvoice": "Generate Invoice", + "runPayroll": "Run Payroll", + "exportReports": "Export Reports", + "timesheetApproved": "Timesheet approved", + "invoiceGenerated": "Invoice generated", + "payrollCompleted": "Payroll completed", + "documentExpiringSoon": "Document expiring soon", + "vsLastWeek": "{{value}}% vs last week", + "vsLastMonth": "{{value}}% from last month", + "minutesAgo": "{{value}} minutes ago", + "hourAgo": "{{value}} hour ago", + "hoursAgo": "{{value}} hours ago", + "days": "{{value}} days" }, "timesheets": { "title": "Timesheets", diff --git a/src/data/translations/es.json b/src/data/translations/es.json index 1701ee6..949e12c 100644 --- a/src/data/translations/es.json +++ b/src/data/translations/es.json @@ -80,13 +80,38 @@ }, "dashboard": { "title": "Panel de Control", - "subtitle": "Resumen de métricas y actividades clave", + "subtitle": "Vista general en tiempo real de sus operaciones de fuerza laboral", "welcomeBack": "Bienvenido de nuevo", "recentActivity": "Actividad Reciente", + "recentActivityDescription": "Últimos eventos de hojas de tiempo y facturación", "quickActions": "Acciones Rápidas", + "quickActionsDescription": "Tareas y flujos de trabajo comunes", "notifications": "Notificaciones", "pendingApprovals": "Aprobaciones Pendientes", - "upcomingDeadlines": "Plazos Próximos" + "pendingExpenses": "Gastos Pendientes", + "overdueInvoices": "Facturas Vencidas", + "complianceAlerts": "Alertas de Cumplimiento", + "upcomingDeadlines": "Plazos Próximos", + "monthlyRevenue": "Ingresos Mensuales", + "monthlyRevenueDescription": "Total facturado este mes", + "monthlyPayroll": "Nómina Mensual", + "monthlyPayrollDescription": "Costos totales de nómina", + "grossMargin": "Margen Bruto", + "grossMarginDescription": "Ingresos menos nómina", + "createTimesheet": "Crear Hoja de Tiempo", + "generateInvoice": "Generar Factura", + "runPayroll": "Ejecutar Nómina", + "exportReports": "Exportar Informes", + "timesheetApproved": "Hoja de tiempo aprobada", + "invoiceGenerated": "Factura generada", + "payrollCompleted": "Nómina completada", + "documentExpiringSoon": "Documento por vencer pronto", + "vsLastWeek": "{{value}}% vs semana pasada", + "vsLastMonth": "{{value}}% desde el mes pasado", + "minutesAgo": "hace {{value}} minutos", + "hourAgo": "hace {{value}} hora", + "hoursAgo": "hace {{value}} horas", + "days": "{{value}} días" }, "timesheets": { "title": "Hojas de Tiempo", diff --git a/src/data/translations/fr.json b/src/data/translations/fr.json index 19fa030..7b4d167 100644 --- a/src/data/translations/fr.json +++ b/src/data/translations/fr.json @@ -80,13 +80,38 @@ }, "dashboard": { "title": "Tableau de Bord", - "subtitle": "Aperçu des métriques et activités clés", + "subtitle": "Aperçu en temps réel de vos opérations de main-d'œuvre", "welcomeBack": "Bon retour", "recentActivity": "Activité Récente", + "recentActivityDescription": "Derniers événements de feuilles de temps et de facturation", "quickActions": "Actions Rapides", + "quickActionsDescription": "Tâches et flux de travail courants", "notifications": "Notifications", "pendingApprovals": "Approbations en Attente", - "upcomingDeadlines": "Échéances à Venir" + "pendingExpenses": "Dépenses en Attente", + "overdueInvoices": "Factures en Retard", + "complianceAlerts": "Alertes de Conformité", + "upcomingDeadlines": "Échéances à Venir", + "monthlyRevenue": "Revenus Mensuels", + "monthlyRevenueDescription": "Total facturé ce mois-ci", + "monthlyPayroll": "Paie Mensuelle", + "monthlyPayrollDescription": "Coûts totaux de la paie", + "grossMargin": "Marge Brute", + "grossMarginDescription": "Revenus moins paie", + "createTimesheet": "Créer une Feuille de Temps", + "generateInvoice": "Générer une Facture", + "runPayroll": "Exécuter la Paie", + "exportReports": "Exporter les Rapports", + "timesheetApproved": "Feuille de temps approuvée", + "invoiceGenerated": "Facture générée", + "payrollCompleted": "Paie terminée", + "documentExpiringSoon": "Document expirant bientôt", + "vsLastWeek": "{{value}}% par rapport à la semaine dernière", + "vsLastMonth": "{{value}}% par rapport au mois dernier", + "minutesAgo": "il y a {{value}} minutes", + "hourAgo": "il y a {{value}} heure", + "hoursAgo": "il y a {{value}} heures", + "days": "{{value}} jours" }, "timesheets": { "title": "Feuilles de Temps",