"use client"; import { RiAlertFill, RiArrowRightLine, RiAtLine, RiBankCardLine, RiBarChart2Line, RiCheckboxCircleFill, RiErrorWarningLine, RiFileListLine, RiNotification3Line, RiTimeLine, } from "@remixicon/react"; import Image from "next/image"; 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 { resolveLogoSrc } from "@/lib/logo"; import { formatCurrency } from "@/lib/utils/currency"; import { formatDateOnly } from "@/lib/utils/date"; import { formatPercentage } from "@/lib/utils/percentage"; import { cn } from "@/lib/utils/ui"; type NotificationBellProps = { notifications: DashboardNotification[]; totalCount: number; budgetNotifications: BudgetNotification[]; preLancamentosCount?: number; }; function formatDate(dateString: string): string { return ( formatDateOnly(dateString, { day: "2-digit", month: "short", }) ?? dateString ); } 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)} ( {formatPercentage(n.usedPercentage, { maximumFractionDigits: 0, minimumFractionDigits: 0, })} ) > ) : ( <> {n.categoryName} atingiu{" "} {formatPercentage(n.usedPercentage, { maximumFractionDigits: 0, minimumFractionDigits: 0, })} {" "} 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)} > )}