forked from git.gladyson/openmonetis
- Corrigir cálculo de valor na importação de lançamentos parcelados
- Exibir valor total (parcela × quantidade) ao invés do valor da parcela individual
- Permite recriar parcelamentos importados com valor correto
- Permitir que usuários compartilhados se descompartilhem de pagadores
- Adicionar componente PagadorLeaveShareCard na aba Perfil
- Usuário filho pode sair do compartilhamento sem precisar do usuário pai
- Manter autorização bidirecionada na action de remoção de share
- Implementar submenu "Inativos" para contas bancárias
- Criar página /contas/inativos seguindo padrão de cartões
- Filtrar contas ativas e inativas em páginas separadas
- Adicionar ícone e navegação no sidebar
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
"use client";
|
|
|
|
import { formatCurrency, formatPercentageChange } from "@/lib/relatorios/utils";
|
|
import { cn } from "@/lib/utils/ui";
|
|
import { RiArrowDownLine, RiArrowUpLine } from "@remixicon/react";
|
|
|
|
interface CategoryCellProps {
|
|
value: number;
|
|
previousValue: number;
|
|
categoryType: "despesa" | "receita";
|
|
isFirstMonth: boolean;
|
|
}
|
|
|
|
export function CategoryCell({
|
|
value,
|
|
previousValue,
|
|
categoryType,
|
|
isFirstMonth,
|
|
}: CategoryCellProps) {
|
|
const percentageChange =
|
|
!isFirstMonth && previousValue !== 0
|
|
? ((value - previousValue) / previousValue) * 100
|
|
: null;
|
|
|
|
const isIncrease = percentageChange !== null && percentageChange > 0;
|
|
const isDecrease = percentageChange !== null && percentageChange < 0;
|
|
|
|
return (
|
|
<div className="flex flex-col items-end gap-0.5 min-h-9">
|
|
<span className="font-medium">{formatCurrency(value)}</span>
|
|
{!isFirstMonth && percentageChange !== null && (
|
|
<div
|
|
className={cn(
|
|
"flex items-center gap-0.5 text-xs",
|
|
isIncrease && "text-red-600 dark:text-red-400",
|
|
isDecrease && "text-green-600 dark:text-green-400"
|
|
)}
|
|
>
|
|
{isIncrease && <RiArrowUpLine className="h-3 w-3" />}
|
|
{isDecrease && <RiArrowDownLine className="h-3 w-3" />}
|
|
<span>{formatPercentageChange(percentageChange)}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|