forked from git.gladyson/openmonetis
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" />
|
||||
|
||||
Reference in New Issue
Block a user