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
|
// 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 newMap = new Map(selectedInstallments);
|
||||||
const current = newMap.get(seriesId) || new Set<string>();
|
const current = newMap.get(seriesId) || new Set<string>();
|
||||||
|
|
||||||
@@ -101,9 +104,7 @@ export function InstallmentAnalysisPage({
|
|||||||
let installmentsCount = 0;
|
let installmentsCount = 0;
|
||||||
|
|
||||||
selectedInstallments.forEach((installmentIds, seriesId) => {
|
selectedInstallments.forEach((installmentIds, seriesId) => {
|
||||||
const group = data.installmentGroups.find(
|
const group = data.installmentGroups.find((g) => g.seriesId === seriesId);
|
||||||
(g) => g.seriesId === seriesId
|
|
||||||
);
|
|
||||||
if (group) {
|
if (group) {
|
||||||
installmentIds.forEach((id) => {
|
installmentIds.forEach((id) => {
|
||||||
const installment = group.pendingInstallments.find(
|
const installment = group.pendingInstallments.find(
|
||||||
@@ -141,8 +142,8 @@ export function InstallmentAnalysisPage({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Card de resumo principal */}
|
{/* Card de resumo principal */}
|
||||||
<Card className="border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10">
|
<Card className="border-primary/20 bg-linear-to-br from-primary/5 to-primary/10">
|
||||||
<CardContent className="flex flex-col items-center justify-center gap-2 py-5">
|
<CardContent className="flex flex-col items-start justify-center gap-2 py-5">
|
||||||
<p className="text-xs font-medium text-muted-foreground">
|
<p className="text-xs font-medium text-muted-foreground">
|
||||||
Se você pagar tudo que está selecionado:
|
Se você pagar tudo que está selecionado:
|
||||||
</p>
|
</p>
|
||||||
@@ -151,7 +152,8 @@ export function InstallmentAnalysisPage({
|
|||||||
className="text-3xl font-bold text-primary"
|
className="text-3xl font-bold text-primary"
|
||||||
/>
|
/>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
{selectedCount} {selectedCount === 1 ? "parcela" : "parcelas"} selecionadas
|
{selectedCount} {selectedCount === 1 ? "parcela" : "parcelas"}{" "}
|
||||||
|
selecionadas
|
||||||
</p>
|
</p>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export function InstallmentGroupCard({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className={cn(isFullySelected && "border-primary/50")}>
|
<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 */}
|
{/* Header do card */}
|
||||||
<div className="flex items-start gap-3">
|
<div className="flex items-start gap-3">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
@@ -98,8 +98,7 @@ export function InstallmentGroupCard({
|
|||||||
{group.paidInstallments} de {group.totalInstallments} pagas
|
{group.paidInstallments} de {group.totalInstallments} pagas
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{unpaidCount}{" "}
|
{unpaidCount} {unpaidCount === 1 ? "pendente" : "pendentes"}
|
||||||
{unpaidCount === 1 ? "pendente" : "pendentes"}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<Progress value={progress} className="h-1.5" />
|
<Progress value={progress} className="h-1.5" />
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import {
|
|||||||
RiArrowLeftRightLine,
|
RiArrowLeftRightLine,
|
||||||
RiBankCardLine,
|
RiBankCardLine,
|
||||||
RiBankLine,
|
RiBankLine,
|
||||||
RiCalculatorLine,
|
|
||||||
RiCalendarEventLine,
|
RiCalendarEventLine,
|
||||||
RiDashboardLine,
|
RiDashboardLine,
|
||||||
RiFileListLine,
|
RiFileListLine,
|
||||||
@@ -137,11 +136,6 @@ export function createSidebarNavData(pagadores: PagadorLike[]): SidebarNavData {
|
|||||||
url: "/insights",
|
url: "/insights",
|
||||||
icon: RiSparklingLine,
|
icon: RiSparklingLine,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "Análise de Parcelas",
|
|
||||||
url: "/dashboard/analise-parcelas",
|
|
||||||
icon: RiCalculatorLine,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
RiBarChartBoxLine,
|
RiBarChartBoxLine,
|
||||||
RiBarcodeLine,
|
RiBarcodeLine,
|
||||||
RiBillLine,
|
RiBillLine,
|
||||||
|
RiCalculatorLine,
|
||||||
RiExchangeLine,
|
RiExchangeLine,
|
||||||
RiLineChartLine,
|
RiLineChartLine,
|
||||||
RiMoneyDollarCircleLine,
|
RiMoneyDollarCircleLine,
|
||||||
@@ -139,8 +140,9 @@ export const widgetsConfig: WidgetConfig[] = [
|
|||||||
action: (
|
action: (
|
||||||
<Link
|
<Link
|
||||||
href="/dashboard/analise-parcelas"
|
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
|
Análise
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user