forked from git.gladyson/openmonetis
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:
@@ -4,62 +4,62 @@ import type { ComponentType, ReactNode } from "react";
|
||||
const ICON_CLASS = "h-4 w-4";
|
||||
|
||||
const normalizeKey = (value: string) =>
|
||||
value
|
||||
.normalize("NFD")
|
||||
.replace(/\p{Diacritic}/gu, "")
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]/g, "");
|
||||
value
|
||||
.normalize("NFD")
|
||||
.replace(/\p{Diacritic}/gu, "")
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]/g, "");
|
||||
|
||||
export const getIconComponent = (
|
||||
iconName: string
|
||||
iconName: string,
|
||||
): ComponentType<{ className?: string }> | null => {
|
||||
// Busca o ícone no objeto de ícones do Remix Icon
|
||||
const icon = (RemixIcons as Record<string, unknown>)[iconName];
|
||||
// Busca o ícone no objeto de ícones do Remix Icon
|
||||
const icon = (RemixIcons as Record<string, unknown>)[iconName];
|
||||
|
||||
if (icon && typeof icon === "function") {
|
||||
return icon as ComponentType<{ className?: string }>;
|
||||
}
|
||||
if (icon && typeof icon === "function") {
|
||||
return icon as ComponentType<{ className?: string }>;
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
};
|
||||
|
||||
export const getConditionIcon = (condition: string): ReactNode => {
|
||||
const key = normalizeKey(condition);
|
||||
const key = normalizeKey(condition);
|
||||
|
||||
const registry: Record<string, ReactNode> = {
|
||||
parcelado: <RemixIcons.RiLoader2Fill className={ICON_CLASS} aria-hidden />,
|
||||
recorrente: <RemixIcons.RiRefreshLine className={ICON_CLASS} aria-hidden />,
|
||||
avista: <RemixIcons.RiCheckLine className={ICON_CLASS} aria-hidden />,
|
||||
vista: <RemixIcons.RiCheckLine className={ICON_CLASS} aria-hidden />,
|
||||
};
|
||||
const registry: Record<string, ReactNode> = {
|
||||
parcelado: <RemixIcons.RiLoader2Fill className={ICON_CLASS} aria-hidden />,
|
||||
recorrente: <RemixIcons.RiRefreshLine className={ICON_CLASS} aria-hidden />,
|
||||
avista: <RemixIcons.RiCheckLine className={ICON_CLASS} aria-hidden />,
|
||||
vista: <RemixIcons.RiCheckLine className={ICON_CLASS} aria-hidden />,
|
||||
};
|
||||
|
||||
return registry[key] ?? null;
|
||||
return registry[key] ?? null;
|
||||
};
|
||||
|
||||
export const getPaymentMethodIcon = (paymentMethod: string): ReactNode => {
|
||||
const key = normalizeKey(paymentMethod);
|
||||
const key = normalizeKey(paymentMethod);
|
||||
|
||||
const registry: Record<string, ReactNode> = {
|
||||
dinheiro: (
|
||||
<RemixIcons.RiMoneyDollarCircleLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
pix: <RemixIcons.RiPixLine className={ICON_CLASS} aria-hidden />,
|
||||
boleto: <RemixIcons.RiBarcodeLine className={ICON_CLASS} aria-hidden />,
|
||||
credito: (
|
||||
<RemixIcons.RiMoneyDollarCircleLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
cartaodecredito: (
|
||||
<RemixIcons.RiBankCard2Line className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
cartaodedebito: (
|
||||
<RemixIcons.RiBankCard2Line className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
debito: <RemixIcons.RiBankCard2Line className={ICON_CLASS} aria-hidden />,
|
||||
prepagovrva: <RemixIcons.RiCouponLine className={ICON_CLASS} aria-hidden />,
|
||||
transferenciabancaria: (
|
||||
<RemixIcons.RiExchangeLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
};
|
||||
const registry: Record<string, ReactNode> = {
|
||||
dinheiro: (
|
||||
<RemixIcons.RiMoneyDollarCircleLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
pix: <RemixIcons.RiPixLine className={ICON_CLASS} aria-hidden />,
|
||||
boleto: <RemixIcons.RiBarcodeLine className={ICON_CLASS} aria-hidden />,
|
||||
credito: (
|
||||
<RemixIcons.RiMoneyDollarCircleLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
cartaodecredito: (
|
||||
<RemixIcons.RiBankCard2Line className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
cartaodedebito: (
|
||||
<RemixIcons.RiBankCard2Line className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
debito: <RemixIcons.RiBankCard2Line className={ICON_CLASS} aria-hidden />,
|
||||
prepagovrva: <RemixIcons.RiCouponLine className={ICON_CLASS} aria-hidden />,
|
||||
transferenciabancaria: (
|
||||
<RemixIcons.RiExchangeLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
};
|
||||
|
||||
return registry[key] ?? null;
|
||||
return registry[key] ?? null;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user