chore: apply pending dashboard and UI updates

This commit is contained in:
Felipe Coutinho
2026-02-28 15:34:54 +00:00
parent 125e0dfb4e
commit 4a88309709
16 changed files with 609 additions and 197 deletions

View File

@@ -1,3 +1,4 @@
import { Card, CardContent } from "@/components/ui/card";
import { Skeleton } from "@/components/ui/skeleton";
export default function CategoriasLoading() {
@@ -21,32 +22,40 @@ export default function CategoriasLoading() {
))}
</div>
{/* Grid de cards de categorias */}
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
{Array.from({ length: 8 }).map((_, i) => (
<div key={i} className="rounded-2xl border p-6 space-y-4">
{/* Ícone + Nome */}
<div className="flex items-center gap-3">
<Skeleton className="size-12 rounded-2xl bg-foreground/10" />
<div className="flex-1 space-y-2">
<Skeleton className="h-5 w-full rounded-2xl bg-foreground/10" />
<Skeleton className="h-4 w-16 rounded-2xl bg-foreground/10" />
{/* Tabela de categorias */}
<Card className="py-2">
<CardContent className="px-2 py-4 sm:px-4">
<div className="space-y-0">
{/* Header da tabela */}
<div className="flex items-center gap-4 border-b px-2 pb-3">
<Skeleton className="size-5 rounded bg-foreground/10" />
<Skeleton className="h-4 w-16 rounded bg-foreground/10" />
<div className="flex-1" />
<Skeleton className="h-4 w-14 rounded bg-foreground/10" />
</div>
{/* Linhas da tabela */}
{Array.from({ length: 8 }).map((_, i) => (
<div
key={i}
className="flex items-center gap-4 border-b border-dashed px-2 py-3 last:border-b-0"
>
<Skeleton className="size-8 rounded-lg bg-foreground/10" />
<Skeleton
className="h-4 rounded bg-foreground/10"
style={{ width: `${100 + (i % 4) * 30}px` }}
/>
<div className="flex-1" />
<div className="flex items-center gap-3">
<Skeleton className="h-4 w-14 rounded bg-foreground/10" />
<Skeleton className="h-4 w-16 rounded bg-foreground/10" />
<Skeleton className="h-4 w-16 rounded bg-foreground/10" />
</div>
</div>
</div>
{/* Descrição */}
{i % 3 === 0 && (
<Skeleton className="h-4 w-full rounded-2xl bg-foreground/10" />
)}
{/* Botões de ação */}
<div className="flex gap-2 pt-2 border-t">
<Skeleton className="h-9 flex-1 rounded-2xl bg-foreground/10" />
<Skeleton className="h-9 w-9 rounded-2xl bg-foreground/10" />
</div>
))}
</div>
))}
</div>
</CardContent>
</Card>
</div>
</div>
</main>

View File

@@ -1,4 +1,4 @@
import { RiFundsLine } from "@remixicon/react";
import { RiBarChart2Line } from "@remixicon/react";
import PageDescription from "@/components/page-description";
export const metadata = {
@@ -13,7 +13,7 @@ export default function RootLayout({
return (
<section className="space-y-6 pt-4">
<PageDescription
icon={<RiFundsLine />}
icon={<RiBarChart2Line />}
title="Orçamentos"
subtitle="Gerencie seus orçamentos mensais por categorias. Acompanhe o progresso do seu orçamento e faça ajustes conforme necessário."
/>

View File

@@ -21,6 +21,14 @@ const bulkDiscardSchema = z.object({
inboxItemIds: z.array(z.string().uuid()).min(1, "Selecione ao menos um item"),
});
const deleteInboxSchema = z.object({
inboxItemId: z.string().uuid("ID do item inválido"),
});
const bulkDeleteInboxSchema = z.object({
status: z.enum(["processed", "discarded"]),
});
function revalidateInbox() {
revalidatePath("/pre-lancamentos");
revalidatePath("/lancamentos");
@@ -157,3 +165,78 @@ export async function bulkDiscardInboxItemsAction(
return handleActionError(error);
}
}
export async function deleteInboxItemAction(
input: z.infer<typeof deleteInboxSchema>,
): Promise<ActionResult> {
try {
const user = await getUser();
const data = deleteInboxSchema.parse(input);
const [item] = await db
.select({ status: preLancamentos.status })
.from(preLancamentos)
.where(
and(
eq(preLancamentos.id, data.inboxItemId),
eq(preLancamentos.userId, user.id),
),
)
.limit(1);
if (!item) {
return { success: false, error: "Item não encontrado." };
}
if (item.status === "pending") {
return {
success: false,
error: "Não é possível excluir itens pendentes.",
};
}
await db
.delete(preLancamentos)
.where(
and(
eq(preLancamentos.id, data.inboxItemId),
eq(preLancamentos.userId, user.id),
),
);
revalidateInbox();
return { success: true, message: "Item excluído." };
} catch (error) {
return handleActionError(error);
}
}
export async function bulkDeleteInboxItemsAction(
input: z.infer<typeof bulkDeleteInboxSchema>,
): Promise<ActionResult> {
try {
const user = await getUser();
const data = bulkDeleteInboxSchema.parse(input);
const result = await db
.delete(preLancamentos)
.where(
and(
eq(preLancamentos.userId, user.id),
eq(preLancamentos.status, data.status),
),
)
.returning({ id: preLancamentos.id });
revalidateInbox();
const count = result.length;
return {
success: true,
message: `${count} item(s) excluído(s).`,
};
} catch (error) {
return handleActionError(error);
}
}

View File

@@ -1,4 +1,4 @@
import { RiInboxLine } from "@remixicon/react";
import { RiAtLine } from "@remixicon/react";
import PageDescription from "@/components/page-description";
export const metadata = {
@@ -13,7 +13,7 @@ export default function RootLayout({
return (
<section className="space-y-6 pt-4">
<PageDescription
icon={<RiInboxLine />}
icon={<RiAtLine />}
title="Pré-Lançamentos"
subtitle="Notificações capturadas pelo Companion"
/>

View File

@@ -343,3 +343,34 @@
[data-slot="dialog-content"][data-state="closed"] {
animation: dialog-out 0.15s ease-in;
}
/* Overdue blink: alternates two stacked labels with a smooth crossfade */
@keyframes blink-in {
0%, 40% { opacity: 1; }
50%, 90% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes blink-out {
0%, 40% { opacity: 0; }
50%, 90% { opacity: 1; }
100% { opacity: 0; }
}
.overdue-blink {
position: relative;
display: inline-flex;
}
.overdue-blink-primary {
animation: blink-in 6s ease-in-out infinite;
}
.overdue-blink-secondary {
position: absolute;
inset: 0;
display: inline-flex;
align-items: center;
justify-content: flex-end;
animation: blink-out 6s ease-in-out infinite;
}