mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 19:01:47 +00:00
style(ui): refresh em badges de tipo, radio buttons e antecipação
- TransactionTypeBadge: substitui StatusDot por ícones direcionais (RiArrowRightDownLine receita, RiArrowRightUpLine despesa, RiArrowLeftRightLine transferência), adiciona borda e shadow sutil e dessaturação no dark mode; rótulo "Transferência" abreviado para "Transf." - RadioGroup: indicador trocado de RiCircleLine por RiCheckLine com fundo sólido primary no estado selecionado - Tabela de seleção de parcelas no dialog de antecipação reduzida para três colunas (estabelecimento, fatura, valor); coluna de vencimento removida e nome do estabelecimento absorve a parcela - Inter agora carrega explicitamente os pesos 500, 600 e 700 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -5,5 +5,6 @@ export const inter = Inter({
|
|||||||
display: "swap",
|
display: "swap",
|
||||||
variable: "--font-inter",
|
variable: "--font-inter",
|
||||||
fallback: ["ui-sans-serif", "system-ui"],
|
fallback: ["ui-sans-serif", "system-ui"],
|
||||||
|
weight: ["500", "600", "700"],
|
||||||
preload: true,
|
preload: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { format } from "date-fns";
|
|
||||||
import { ptBR } from "date-fns/locale";
|
|
||||||
import MoneyValues from "@/shared/components/money-values";
|
import MoneyValues from "@/shared/components/money-values";
|
||||||
import { Badge } from "@/shared/components/ui/badge";
|
import { Badge } from "@/shared/components/ui/badge";
|
||||||
import { Checkbox } from "@/shared/components/ui/checkbox";
|
import { Checkbox } from "@/shared/components/ui/checkbox";
|
||||||
@@ -44,11 +42,6 @@ export function InstallmentSelectionTable({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const formatDate = (date: Date | null) => {
|
|
||||||
if (!date) return "—";
|
|
||||||
return format(date, "dd/MM/yyyy", { locale: ptBR });
|
|
||||||
};
|
|
||||||
|
|
||||||
if (installments.length === 0) {
|
if (installments.length === 0) {
|
||||||
return (
|
return (
|
||||||
<div className="rounded-lg border border-dashed p-8 text-center">
|
<div className="rounded-lg border border-dashed p-8 text-center">
|
||||||
@@ -63,11 +56,11 @@ export function InstallmentSelectionTable({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="overflow-hidden rounded-lg border">
|
<div className="overflow-hidden">
|
||||||
<Table>
|
<Table>
|
||||||
<TableHeader>
|
<TableHeader>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableHead className="w-12">
|
<TableHead>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={
|
checked={
|
||||||
selectedIds.length === installments.length &&
|
selectedIds.length === installments.length &&
|
||||||
@@ -77,9 +70,8 @@ export function InstallmentSelectionTable({
|
|||||||
aria-label="Selecionar todas as parcelas"
|
aria-label="Selecionar todas as parcelas"
|
||||||
/>
|
/>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
<TableHead>Parcela</TableHead>
|
<TableHead>Estabelecimento</TableHead>
|
||||||
<TableHead>Período</TableHead>
|
<TableHead>Fatura</TableHead>
|
||||||
<TableHead>Vencimento</TableHead>
|
|
||||||
<TableHead className="text-right">Valor</TableHead>
|
<TableHead className="text-right">Valor</TableHead>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
@@ -103,6 +95,7 @@ export function InstallmentSelectionTable({
|
|||||||
/>
|
/>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
|
{inst.name}{" "}
|
||||||
<Badge variant="outline">
|
<Badge variant="outline">
|
||||||
{formatCurrentInstallment(
|
{formatCurrentInstallment(
|
||||||
inst.currentInstallment ?? 0,
|
inst.currentInstallment ?? 0,
|
||||||
@@ -110,12 +103,11 @@ export function InstallmentSelectionTable({
|
|||||||
)}
|
)}
|
||||||
</Badge>
|
</Badge>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|
||||||
<TableCell className="font-medium">
|
<TableCell className="font-medium">
|
||||||
{formatShortPeriodLabel(inst.period)}
|
{formatShortPeriodLabel(inst.period)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell className="text-muted-foreground">
|
|
||||||
{formatDate(inst.dueDate)}
|
|
||||||
</TableCell>
|
|
||||||
<TableCell className="text-right font-medium">
|
<TableCell className="text-right font-medium">
|
||||||
<MoneyValues amount={Number(inst.amount)} />
|
<MoneyValues amount={Number(inst.amount)} />
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
|
import {
|
||||||
|
type RemixiconComponentType,
|
||||||
|
RiArrowLeftRightLine,
|
||||||
|
RiArrowRightDownLine,
|
||||||
|
RiArrowRightUpLine,
|
||||||
|
} from "@remixicon/react";
|
||||||
import { Badge } from "@/shared/components/ui/badge";
|
import { Badge } from "@/shared/components/ui/badge";
|
||||||
import { cn } from "@/shared/utils/ui";
|
import { cn } from "@/shared/utils/ui";
|
||||||
import StatusDot from "./status-dot";
|
|
||||||
|
|
||||||
type FinancialKind =
|
type FinancialKind =
|
||||||
| "receita"
|
| "receita"
|
||||||
@@ -26,29 +31,33 @@ type TransactionTypeBadgeProps = {
|
|||||||
type BadgeConfig = {
|
type BadgeConfig = {
|
||||||
label: string;
|
label: string;
|
||||||
className: string;
|
className: string;
|
||||||
dotClassName: string;
|
Icon: RemixiconComponentType;
|
||||||
};
|
};
|
||||||
|
|
||||||
const BADGE_CONFIG: Record<FinancialKindKey, BadgeConfig> = {
|
const BADGE_CONFIG: Record<FinancialKindKey, BadgeConfig> = {
|
||||||
receita: {
|
receita: {
|
||||||
label: "Receita",
|
label: "Receita",
|
||||||
className: "bg-success/10 text-success dark:bg-success/10",
|
className:
|
||||||
dotClassName: "bg-success/80",
|
"border-success/30 bg-success/5 text-success dark:saturate-90 dark:border-success/50 dark:bg-transparent",
|
||||||
|
Icon: RiArrowRightDownLine,
|
||||||
},
|
},
|
||||||
despesa: {
|
despesa: {
|
||||||
label: "Despesa",
|
label: "Despesa",
|
||||||
className: "bg-destructive/10 text-destructive dark:bg-destructive/10",
|
className:
|
||||||
dotClassName: "bg-destructive/80",
|
"border-destructive/30 bg-destructive/5 text-destructive dark:saturate-90 dark:border-destructive/50 dark:bg-transparent",
|
||||||
|
Icon: RiArrowRightUpLine,
|
||||||
},
|
},
|
||||||
transferência: {
|
transferência: {
|
||||||
label: "Transferência",
|
label: "Transf.",
|
||||||
className: "bg-info/10 text-info dark:bg-info/10",
|
className:
|
||||||
dotClassName: "bg-info/80",
|
"border-info/30 bg-info/5 text-info dark:saturate-90 dark:border-info/50 dark:bg-transparent",
|
||||||
|
Icon: RiArrowLeftRightLine,
|
||||||
},
|
},
|
||||||
"saldo inicial": {
|
"saldo inicial": {
|
||||||
label: "Saldo Inicial",
|
label: "Saldo Inicial",
|
||||||
className: "bg-success/10 text-success dark:bg-success/10",
|
className:
|
||||||
dotClassName: "bg-success/80",
|
"border-success/30 bg-success/5 text-success dark:saturate-90 dark:border-success/50 dark:bg-transparent",
|
||||||
|
Icon: RiArrowRightDownLine,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,22 +75,20 @@ export function TransactionTypeBadge({
|
|||||||
const normalizedKind = normalizeKind(kind);
|
const normalizedKind = normalizeKind(kind);
|
||||||
const config = normalizedKind ? BADGE_CONFIG[normalizedKind] : null;
|
const config = normalizedKind ? BADGE_CONFIG[normalizedKind] : null;
|
||||||
const label = config?.label ?? kind;
|
const label = config?.label ?? kind;
|
||||||
|
const Icon = config?.Icon;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Badge
|
<Badge
|
||||||
variant="outline"
|
variant="outline"
|
||||||
data-kind={normalizedKind ?? "custom"}
|
data-kind={normalizedKind ?? "custom"}
|
||||||
className={cn(
|
className={cn(
|
||||||
"h-6 gap-1 border-none rounded-md px-2 py-0 text-xs shadow-none",
|
"h-6 gap-1 rounded-sm border px-2 py-0 text-xs font-medium shadow-xs",
|
||||||
config?.className ??
|
config?.className ??
|
||||||
"bg-muted/30 text-muted-foreground dark:bg-muted/20",
|
"border-muted-foreground/30 bg-muted/20 text-muted-foreground dark:bg-transparent",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<StatusDot
|
{Icon ? <Icon className="size-3.5" /> : null}
|
||||||
color={config?.dotClassName ?? "bg-muted-foreground/60"}
|
|
||||||
className="size-1.5"
|
|
||||||
/>
|
|
||||||
<span>{label}</span>
|
<span>{label}</span>
|
||||||
</Badge>
|
</Badge>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
||||||
import { RiCircleLine } from "@remixicon/react";
|
import { RiCheckLine } from "@remixicon/react";
|
||||||
import type * as React from "react";
|
import type * as React from "react";
|
||||||
import { cn } from "@/shared/utils/ui";
|
import { cn } from "@/shared/utils/ui";
|
||||||
|
|
||||||
@@ -26,16 +26,16 @@ function RadioGroupItem({
|
|||||||
<RadioGroupPrimitive.Item
|
<RadioGroupPrimitive.Item
|
||||||
data-slot="radio-group-item"
|
data-slot="radio-group-item"
|
||||||
className={cn(
|
className={cn(
|
||||||
"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<RadioGroupPrimitive.Indicator
|
<RadioGroupPrimitive.Indicator
|
||||||
data-slot="radio-group-indicator"
|
data-slot="radio-group-indicator"
|
||||||
className="relative flex items-center justify-center"
|
className="grid place-content-center text-current transition-none"
|
||||||
>
|
>
|
||||||
<RiCircleLine className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
|
<RiCheckLine className="size-3.5" />
|
||||||
</RadioGroupPrimitive.Indicator>
|
</RadioGroupPrimitive.Indicator>
|
||||||
</RadioGroupPrimitive.Item>
|
</RadioGroupPrimitive.Item>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user