refactor: melhorar a formatação e a legibilidade do código
- Ajusta a formatação da função toggleInstallmentSelection para melhor legibilidade. - Refatora a busca de grupos de parcelas para uma única linha. - Remove a importação não utilizada do ícone RiCalculatorLine no nav-link. - Adiciona o ícone RiCalculatorLine de volta ao widget de análise de parcelas.
This commit is contained in:
@@ -76,7 +76,10 @@ export function InstallmentAnalysisPage({
|
||||
};
|
||||
|
||||
// Função para selecionar/desselecionar parcela individual
|
||||
const toggleInstallmentSelection = (seriesId: string, installmentId: string) => {
|
||||
const toggleInstallmentSelection = (
|
||||
seriesId: string,
|
||||
installmentId: string
|
||||
) => {
|
||||
const newMap = new Map(selectedInstallments);
|
||||
const current = newMap.get(seriesId) || new Set<string>();
|
||||
|
||||
@@ -101,9 +104,7 @@ export function InstallmentAnalysisPage({
|
||||
let installmentsCount = 0;
|
||||
|
||||
selectedInstallments.forEach((installmentIds, seriesId) => {
|
||||
const group = data.installmentGroups.find(
|
||||
(g) => g.seriesId === seriesId
|
||||
);
|
||||
const group = data.installmentGroups.find((g) => g.seriesId === seriesId);
|
||||
if (group) {
|
||||
installmentIds.forEach((id) => {
|
||||
const installment = group.pendingInstallments.find(
|
||||
@@ -141,8 +142,8 @@ export function InstallmentAnalysisPage({
|
||||
</div>
|
||||
|
||||
{/* Card de resumo principal */}
|
||||
<Card className="border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10">
|
||||
<CardContent className="flex flex-col items-center justify-center gap-2 py-5">
|
||||
<Card className="border-primary/20 bg-linear-to-br from-primary/5 to-primary/10">
|
||||
<CardContent className="flex flex-col items-start justify-center gap-2 py-5">
|
||||
<p className="text-xs font-medium text-muted-foreground">
|
||||
Se você pagar tudo que está selecionado:
|
||||
</p>
|
||||
@@ -151,7 +152,8 @@ export function InstallmentAnalysisPage({
|
||||
className="text-3xl font-bold text-primary"
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{selectedCount} {selectedCount === 1 ? "parcela" : "parcelas"} selecionadas
|
||||
{selectedCount} {selectedCount === 1 ? "parcela" : "parcelas"}{" "}
|
||||
selecionadas
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -52,7 +52,7 @@ export function InstallmentGroupCard({
|
||||
|
||||
return (
|
||||
<Card className={cn(isFullySelected && "border-primary/50")}>
|
||||
<CardContent className="flex flex-col gap-2 py-1">
|
||||
<CardContent className="flex flex-col gap-2">
|
||||
{/* Header do card */}
|
||||
<div className="flex items-start gap-3">
|
||||
<Checkbox
|
||||
@@ -98,8 +98,7 @@ export function InstallmentGroupCard({
|
||||
{group.paidInstallments} de {group.totalInstallments} pagas
|
||||
</span>
|
||||
<span>
|
||||
{unpaidCount}{" "}
|
||||
{unpaidCount === 1 ? "pendente" : "pendentes"}
|
||||
{unpaidCount} {unpaidCount === 1 ? "pendente" : "pendentes"}
|
||||
</span>
|
||||
</div>
|
||||
<Progress value={progress} className="h-1.5" />
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
RiArrowLeftRightLine,
|
||||
RiBankCardLine,
|
||||
RiBankLine,
|
||||
RiCalculatorLine,
|
||||
RiCalendarEventLine,
|
||||
RiDashboardLine,
|
||||
RiFileListLine,
|
||||
@@ -137,11 +136,6 @@ export function createSidebarNavData(pagadores: PagadorLike[]): SidebarNavData {
|
||||
url: "/insights",
|
||||
icon: RiSparklingLine,
|
||||
},
|
||||
{
|
||||
title: "Análise de Parcelas",
|
||||
url: "/dashboard/analise-parcelas",
|
||||
icon: RiCalculatorLine,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
RiBarChartBoxLine,
|
||||
RiBarcodeLine,
|
||||
RiBillLine,
|
||||
RiCalculatorLine,
|
||||
RiExchangeLine,
|
||||
RiLineChartLine,
|
||||
RiMoneyDollarCircleLine,
|
||||
@@ -139,8 +140,9 @@ export const widgetsConfig: WidgetConfig[] = [
|
||||
action: (
|
||||
<Link
|
||||
href="/dashboard/analise-parcelas"
|
||||
className="text-xs font-medium text-muted-foreground hover:text-primary transition-colors"
|
||||
className="text-sm font-medium text-muted-foreground hover:text-primary transition-colors"
|
||||
>
|
||||
<RiCalculatorLine className="inline mr-1 size-4" />
|
||||
Análise
|
||||
</Link>
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user