refactor: migrate from ESLint to Biome and extract SQL queries to data.ts

- Replace ESLint with Biome for linting and formatting
- Configure Biome with tabs, double quotes, and organized imports
- Move all SQL/Drizzle queries from page.tsx files to data.ts files
- Create new data.ts files for: ajustes, dashboard, relatorios/categorias
- Update existing data.ts files: extrato, fatura (add lancamentos queries)
- Remove all drizzle-orm imports from page.tsx files
- Update README.md with new tooling info

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Felipe Coutinho
2026-01-27 13:15:37 +00:00
parent 8ffe61c59b
commit a7f63fb77a
442 changed files with 66141 additions and 69292 deletions

View File

@@ -1,145 +1,145 @@
"use client";
import { format } from "date-fns";
import { ptBR } from "date-fns/locale";
import MoneyValues from "@/components/money-values";
import { TypeBadge } from "@/components/type-badge";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogClose,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
Dialog,
DialogClose,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Separator } from "@/components/ui/separator";
import { cn } from "@/lib/utils/ui";
import { format } from "date-fns";
import { ptBR } from "date-fns/locale";
import type { InboxItem } from "./types";
interface InboxDetailsDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
item: InboxItem | null;
open: boolean;
onOpenChange: (open: boolean) => void;
item: InboxItem | null;
}
export function InboxDetailsDialog({
open,
onOpenChange,
item,
open,
onOpenChange,
item,
}: InboxDetailsDialogProps) {
if (!item) return null;
if (!item) return null;
const amount = item.parsedAmount ? parseFloat(item.parsedAmount) : null;
const isReceita = item.parsedTransactionType === "Receita";
const amount = item.parsedAmount ? parseFloat(item.parsedAmount) : null;
const isReceita = item.parsedTransactionType === "Receita";
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Detalhes da Notificação</DialogTitle>
</DialogHeader>
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className="sm:max-w-lg">
<DialogHeader>
<DialogTitle>Detalhes da Notificação</DialogTitle>
</DialogHeader>
<div className="space-y-4">
{/* Dados da fonte */}
<div>
<div className="grid gap-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">ID</span>
<span className="font-mono text-xs">{item.id}</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">App</span>
<span>{item.sourceAppName || item.sourceApp}</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Package</span>
<span className="font-mono text-xs">{item.sourceApp}</span>
</div>
</div>
</div>
<div className="space-y-4">
{/* Dados da fonte */}
<div>
<div className="grid gap-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">ID</span>
<span className="font-mono text-xs">{item.id}</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">App</span>
<span>{item.sourceAppName || item.sourceApp}</span>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Package</span>
<span className="font-mono text-xs">{item.sourceApp}</span>
</div>
</div>
</div>
<Separator />
<Separator />
{/* Texto original */}
<div>
<h4 className="mb-1 text-sm font-medium text-muted-foreground">
Notificação Original
</h4>
{/* Texto original */}
<div>
<h4 className="mb-1 text-sm font-medium text-muted-foreground">
Notificação Original
</h4>
{item.originalTitle && (
<p className="mb-1 font-medium">{item.originalTitle}</p>
)}
<p className="text-sm">{item.originalText}</p>
</div>
{item.originalTitle && (
<p className="mb-1 font-medium">{item.originalTitle}</p>
)}
<p className="text-sm">{item.originalText}</p>
</div>
<Separator />
<Separator />
{/* Dados parseados */}
<div>
<div className="grid gap-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">Estabelecimento</span>
<span>{item.parsedName || "Não extraído"}</span>
</div>
<div className="flex justify-between items-center">
<span className="text-muted-foreground">Valor</span>
{amount !== null ? (
<MoneyValues
amount={isReceita ? amount : -amount}
showPositiveSign={isReceita}
className={cn(
"text-sm",
isReceita
? "text-green-600 dark:text-green-400"
: "text-foreground",
)}
/>
) : (
<span className="text-muted-foreground">Não extraído</span>
)}
</div>
<div className="flex justify-between items-center">
<span className="text-muted-foreground">Tipo</span>
{item.parsedTransactionType ? (
<TypeBadge type={item.parsedTransactionType} />
) : (
<span className="text-muted-foreground">
Não identificado
</span>
)}
</div>
</div>
</div>
{/* Dados parseados */}
<div>
<div className="grid gap-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">Estabelecimento</span>
<span>{item.parsedName || "Não extraído"}</span>
</div>
<div className="flex justify-between items-center">
<span className="text-muted-foreground">Valor</span>
{amount !== null ? (
<MoneyValues
amount={isReceita ? amount : -amount}
showPositiveSign={isReceita}
className={cn(
"text-sm",
isReceita
? "text-green-600 dark:text-green-400"
: "text-foreground",
)}
/>
) : (
<span className="text-muted-foreground">Não extraído</span>
)}
</div>
<div className="flex justify-between items-center">
<span className="text-muted-foreground">Tipo</span>
{item.parsedTransactionType ? (
<TypeBadge type={item.parsedTransactionType} />
) : (
<span className="text-muted-foreground">
Não identificado
</span>
)}
</div>
</div>
</div>
<Separator />
<Separator />
{/* Metadados */}
<div>
<div className="grid gap-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">Status</span>
<Badge variant="outline">{item.status}</Badge>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Criado em</span>
<span>
{format(new Date(item.createdAt), "PPpp", { locale: ptBR })}
</span>
</div>
</div>
</div>
</div>
{/* Metadados */}
<div>
<div className="grid gap-2 text-sm">
<div className="flex justify-between">
<span className="text-muted-foreground">Status</span>
<Badge variant="outline">{item.status}</Badge>
</div>
<div className="flex justify-between">
<span className="text-muted-foreground">Criado em</span>
<span>
{format(new Date(item.createdAt), "PPpp", { locale: ptBR })}
</span>
</div>
</div>
</div>
</div>
<DialogFooter>
<DialogClose asChild>
<Button className="w-full mt-2" type="button">
Entendi
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
);
<DialogFooter>
<DialogClose asChild>
<Button className="w-full mt-2" type="button">
Entendi
</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
);
}