"use client"; import { RiAlertFill, RiArrowRightLine, RiBankCardLine, RiBarChart2Line, RiCheckboxCircleFill, RiErrorWarningLine, RiFileListLine, RiInboxLine, RiNotification3Line, RiTimeLine, } from "@remixicon/react"; import Link from "next/link"; import { useState } from "react"; import { Badge } from "@/components/ui/badge"; import { buttonVariants } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuLabel, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Empty, EmptyDescription, EmptyMedia, EmptyTitle, } from "@/components/ui/empty"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import type { BudgetNotification, DashboardNotification, } from "@/lib/dashboard/notifications"; import { cn } from "@/lib/utils/ui"; type NotificationBellProps = { notifications: DashboardNotification[]; totalCount: number; budgetNotifications: BudgetNotification[]; preLancamentosCount?: number; }; function formatDate(dateString: string): string { const [year, month, day] = dateString.split("-").map(Number); const date = new Date(Date.UTC(year, month - 1, day)); return date.toLocaleDateString("pt-BR", { day: "2-digit", month: "short", timeZone: "UTC", }); } function formatCurrency(amount: number): string { return new Intl.NumberFormat("pt-BR", { style: "currency", currency: "BRL", }).format(amount); } function SectionLabel({ icon, title, }: { icon: React.ReactNode; title: string; }) { return (
{preLancamentosCount === 1 ? "1 pré-lançamento aguardando revisão" : `${preLancamentosCount} pré-lançamentos aguardando revisão`}
{n.status === "exceeded" ? ( <> Orçamento de {n.categoryName}{" "} excedido —{" "} {formatCurrency(n.spentAmount)} de{" "} {formatCurrency(n.budgetAmount)} ( {Math.round(n.usedPercentage)}%) > ) : ( <> {n.categoryName} atingiu{" "} {Math.round(n.usedPercentage)}% do orçamento —{" "} {formatCurrency(n.spentAmount)} de{" "} {formatCurrency(n.budgetAmount)} > )}
{n.status === "overdue" ? ( <> A fatura de {n.name} venceu em{" "} {formatDate(n.dueDate)} {n.showAmount && n.amount > 0 && ( <> {" "} — {formatCurrency(n.amount)} > )} > ) : ( <> A fatura de {n.name} vence em{" "} {formatDate(n.dueDate)} {n.showAmount && n.amount > 0 && ( <> {" "} — {formatCurrency(n.amount)} > )} > )}
{n.status === "overdue" ? ( <> O boleto {n.name} {n.amount > 0 && ( <> {" "} — {formatCurrency(n.amount)} > )}{" "} venceu em {formatDate(n.dueDate)} > ) : ( <> O boleto {n.name} {n.amount > 0 && ( <> {" "} — {formatCurrency(n.amount)} > )}{" "} vence em {formatDate(n.dueDate)} > )}