forked from git.gladyson/openmonetis
refactor: remover implementação de logos de cartões
- Remover cartaoLogo do tipo InstallmentGroup - Remover busca de logo na query - Remover exibição de logo e ícone fallback no componente - Simplificar interface mostrando apenas nome do grupo
This commit is contained in:
@@ -6,10 +6,9 @@ import { Card, CardContent } from "@/components/ui/card";
|
|||||||
import { Checkbox } from "@/components/ui/checkbox";
|
import { Checkbox } from "@/components/ui/checkbox";
|
||||||
import { Progress } from "@/components/ui/progress";
|
import { Progress } from "@/components/ui/progress";
|
||||||
import { cn } from "@/lib/utils/ui";
|
import { cn } from "@/lib/utils/ui";
|
||||||
import { RiArrowDownSLine, RiArrowRightSLine, RiBankCard2Line } from "@remixicon/react";
|
import { RiArrowDownSLine, RiArrowRightSLine } from "@remixicon/react";
|
||||||
import { format } from "date-fns";
|
import { format } from "date-fns";
|
||||||
import { ptBR } from "date-fns/locale";
|
import { ptBR } from "date-fns/locale";
|
||||||
import Image from "next/image";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import type { InstallmentGroup } from "./types";
|
import type { InstallmentGroup } from "./types";
|
||||||
|
|
||||||
@@ -34,14 +33,6 @@ export function InstallmentGroupCard({
|
|||||||
|
|
||||||
const unpaidCount = unpaidInstallments.length;
|
const unpaidCount = unpaidInstallments.length;
|
||||||
|
|
||||||
// Validar se o logo é uma URL válida (deve começar com / ou http:// ou https://)
|
|
||||||
const isValidLogo =
|
|
||||||
group.cartaoLogo &&
|
|
||||||
group.cartaoLogo.trim().length > 0 &&
|
|
||||||
(group.cartaoLogo.startsWith('/') ||
|
|
||||||
group.cartaoLogo.startsWith('http://') ||
|
|
||||||
group.cartaoLogo.startsWith('https://'));
|
|
||||||
|
|
||||||
const isFullySelected =
|
const isFullySelected =
|
||||||
selectedInstallments.size === unpaidInstallments.length &&
|
selectedInstallments.size === unpaidInstallments.length &&
|
||||||
unpaidInstallments.length > 0;
|
unpaidInstallments.length > 0;
|
||||||
@@ -74,22 +65,7 @@ export function InstallmentGroupCard({
|
|||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<div className="flex items-start justify-between gap-3">
|
<div className="flex items-start justify-between gap-3">
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
{isValidLogo ? (
|
|
||||||
<Image
|
|
||||||
src={group.cartaoLogo!}
|
|
||||||
alt={group.cartaoName || "Cartão"}
|
|
||||||
width={24}
|
|
||||||
height={24}
|
|
||||||
className="size-6 shrink-0 rounded"
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<div className="flex size-6 shrink-0 items-center justify-center rounded bg-muted">
|
|
||||||
<RiBankCard2Line className="size-4 text-muted-foreground" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<p className="text-sm font-bold">{group.name}</p>
|
<p className="text-sm font-bold">{group.name}</p>
|
||||||
</div>
|
|
||||||
<div className="mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground">
|
<div className="mt-0.5 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground">
|
||||||
{group.cartaoName && (
|
{group.cartaoName && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ export type InstallmentGroup = {
|
|||||||
paymentMethod: string;
|
paymentMethod: string;
|
||||||
cartaoId: string | null;
|
cartaoId: string | null;
|
||||||
cartaoName: string | null;
|
cartaoName: string | null;
|
||||||
cartaoLogo: string | null;
|
|
||||||
cartaoDueDay: string | null;
|
cartaoDueDay: string | null;
|
||||||
totalInstallments: number;
|
totalInstallments: number;
|
||||||
paidInstallments: number;
|
paidInstallments: number;
|
||||||
@@ -75,7 +74,6 @@ export async function fetchInstallmentAnalysis(
|
|||||||
purchaseDate: lancamentos.purchaseDate,
|
purchaseDate: lancamentos.purchaseDate,
|
||||||
cartaoId: lancamentos.cartaoId,
|
cartaoId: lancamentos.cartaoId,
|
||||||
cartaoName: cartoes.name,
|
cartaoName: cartoes.name,
|
||||||
cartaoLogo: cartoes.logo,
|
|
||||||
cartaoDueDay: cartoes.dueDay,
|
cartaoDueDay: cartoes.dueDay,
|
||||||
})
|
})
|
||||||
.from(lancamentos)
|
.from(lancamentos)
|
||||||
@@ -133,7 +131,6 @@ export async function fetchInstallmentAnalysis(
|
|||||||
paymentMethod: row.paymentMethod,
|
paymentMethod: row.paymentMethod,
|
||||||
cartaoId: row.cartaoId,
|
cartaoId: row.cartaoId,
|
||||||
cartaoName: row.cartaoName,
|
cartaoName: row.cartaoName,
|
||||||
cartaoLogo: row.cartaoLogo,
|
|
||||||
cartaoDueDay: row.cartaoDueDay,
|
cartaoDueDay: row.cartaoDueDay,
|
||||||
totalInstallments: row.installmentCount ?? 0,
|
totalInstallments: row.installmentCount ?? 0,
|
||||||
paidInstallments: 0,
|
paidInstallments: 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user