import { RiPencilLine } from "@remixicon/react"; import Link from "next/link"; import { clampGoalProgress, formatGoalProgressPercentage, } from "@/features/dashboard/goals-progress/goals-progress-helpers"; import type { GoalProgressItem as GoalProgressItemData } from "@/features/dashboard/goals-progress/goals-progress-queries"; import { CategoryIconBadge } from "@/shared/components/entity-avatar"; import MoneyValues from "@/shared/components/money-values"; import { Button } from "@/shared/components/ui/button"; import { Progress } from "@/shared/components/ui/progress"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/shared/components/ui/tooltip"; import { cn } from "@/shared/utils"; import { formatPeriodForUrl } from "@/shared/utils/period"; type GoalProgressItemProps = { item: GoalProgressItemData; onEdit: (item: GoalProgressItemData) => void; }; export function GoalProgressItem({ item, onEdit }: GoalProgressItemProps) { const progressValue = clampGoalProgress(item.usedPercentage, 0, 100); const isExceeded = item.status === "exceeded"; const isCritical = item.status === "critical"; const exceededAmount = Math.max(item.spentAmount - item.budgetAmount, 0); const usedPercentageLabel = formatGoalProgressPercentage(item.usedPercentage); return (
  • {item.categoryId ? ( {item.categoryName} ) : (

    {item.categoryName}

    )}

    {" "} de{" "} · {isExceeded ? ( <> acima do limite ) : ( `${usedPercentageLabel} utilizado` )}

    Atualizar orçamento
  • ); }