import { type RemixiconComponentType, RiChatAi3Line, RiEyeLine, RiFlashlightLine, RiLightbulbLine, RiRocketLine, } from "@remixicon/react"; import { format } from "date-fns"; import { ptBR } from "date-fns/locale"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import type { InsightCategoryId, InsightsResponse, } from "@/lib/schemas/insights"; import { INSIGHT_CATEGORIES } from "@/lib/schemas/insights"; import { cn } from "@/lib/utils/ui"; interface InsightsGridProps { insights: InsightsResponse; } const CATEGORY_ICONS: Record = { behaviors: RiEyeLine, triggers: RiFlashlightLine, recommendations: RiLightbulbLine, improvements: RiRocketLine, }; const CATEGORY_COLORS: Record< InsightCategoryId, { titleText: string; chatAiIcon: string } > = { behaviors: { titleText: "text-orange-700 dark:text-orange-400", chatAiIcon: "text-orange-600 dark:text-orange-400", }, triggers: { titleText: "text-amber-700 dark:text-amber-400 ", chatAiIcon: "text-amber-600 dark:text-amber-400", }, recommendations: { titleText: "text-sky-700 dark:text-sky-400", chatAiIcon: "text-sky-600 dark:text-sky-400", }, improvements: { titleText: "text-emerald-700 dark:text-emerald-400", chatAiIcon: "text-emerald-600 dark:text-emerald-400", }, }; export function InsightsGrid({ insights }: InsightsGridProps) { // Formatar o período para exibição const [year, month] = insights.month.split("-"); const periodDate = new Date(parseInt(year, 10), parseInt(month, 10) - 1); const formattedPeriod = format(periodDate, "MMMM 'de' yyyy", { locale: ptBR, }); return (

No período selecionado ({formattedPeriod}), identificamos os principais comportamentos e gatilhos que impactaram seu padrão de consumo.

Segue um panorama prático com recomendações acionáveis.

{/* Grid de Cards */}
{insights.categories.map((categoryData) => { const categoryConfig = INSIGHT_CATEGORIES[categoryData.category]; const colors = CATEGORY_COLORS[categoryData.category]; const Icon = CATEGORY_ICONS[categoryData.category]; return (
{categoryConfig.title}
{categoryData.items.map((item, index) => (
{item.text}
))}
); })}
); }