'use client'; import React from 'react'; import { useTranslation } from 'react-i18next'; import { ThumbsUp, ThumbsDown, TrendingUp, TrendingDown, Minus, } from 'lucide-react'; interface FeedbackCardProps { title: string; value: number | string; subtitle?: string; icon: React.ReactNode; trend?: { value: number; direction: 'up' | 'down' | 'neutral'; }; variant?: 'default' | 'success' | 'warning' | 'danger'; loading?: boolean; } export function FeedbackCard({ title, value, subtitle, icon, trend, variant = 'default', loading = false, }: FeedbackCardProps) { const variantStyles = { default: 'bg-white dark:bg-[#2a2a2e] border-gray-200 dark:border-gray-700', success: 'bg-green-50 dark:bg-green-900/20 border-green-200 dark:border-green-800', warning: 'bg-yellow-50 dark:bg-yellow-900/20 border-yellow-200 dark:border-yellow-800', danger: 'bg-red-50 dark:bg-red-900/20 border-red-200 dark:border-red-800', }; const iconStyles = { default: 'text-gray-500 dark:text-gray-400', success: 'text-green-500 dark:text-green-400', warning: 'text-yellow-500 dark:text-yellow-400', danger: 'text-red-500 dark:text-red-400', }; const trendStyles = { up: 'text-green-500', down: 'text-red-500', neutral: 'text-gray-500', }; if (loading) { return (
); } return (

{title}

{value}

{subtitle && (

{subtitle}

)} {trend && (
{trend.direction === 'up' && ( )} {trend.direction === 'down' && ( )} {trend.direction === 'neutral' && ( )} {trend.value > 0 ? '+' : ''} {trend.value}%
)}
{icon}
); } interface FeedbackStatsProps { stats: { totalFeedback: number; totalLikes: number; totalDislikes: number; satisfactionRate: number; } | null; loading?: boolean; } export function FeedbackStatsCards({ stats, loading }: FeedbackStatsProps) { const { t } = useTranslation(); const cards = [ { title: t('monitoring.feedback.totalFeedback'), value: stats?.totalFeedback ?? 0, icon: ( ), variant: 'default' as const, }, { title: t('monitoring.feedback.totalLikes'), value: stats?.totalLikes ?? 0, icon: , variant: 'success' as const, }, { title: t('monitoring.feedback.totalDislikes'), value: stats?.totalDislikes ?? 0, icon: , variant: 'danger' as const, }, { title: t('monitoring.feedback.satisfactionRate'), value: stats ? `${stats.satisfactionRate}%` : '0%', icon: ( ), variant: (stats && stats.satisfactionRate >= 80 ? 'success' : stats && stats.satisfactionRate >= 50 ? 'warning' : 'danger') as 'default' | 'success' | 'warning' | 'danger', }, ]; return (
{cards.map((card, index) => ( ))}
); }