mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-03-10 04:51:47 +00:00
feat: adição de novos ícones SVG e configuração do ambiente
- Adicionados ícones SVG para ChatGPT, Claude, Gemini e OpenRouter - Implementados ícones para modos claro e escuro do ChatGPT - Criado script de inicialização para PostgreSQL com extensão pgcrypto - Adicionado script de configuração de ambiente que faz backup do .env - Configurado tsconfig.json para TypeScript com opções de compilação
This commit is contained in:
61
lib/utils/icons.tsx
Normal file
61
lib/utils/icons.tsx
Normal file
@@ -0,0 +1,61 @@
|
||||
import * as RemixIcons from "@remixicon/react";
|
||||
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, "");
|
||||
|
||||
export const getIconComponent = (
|
||||
iconName: string
|
||||
): ComponentType<{ className?: string }> | null => {
|
||||
// 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 }>;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const getConditionIcon = (condition: string): ReactNode => {
|
||||
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 />,
|
||||
};
|
||||
|
||||
return registry[key] ?? null;
|
||||
};
|
||||
|
||||
export const getPaymentMethodIcon = (paymentMethod: string): ReactNode => {
|
||||
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.RiBankCardLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
cartaodedebito: (
|
||||
<RemixIcons.RiBankCardLine className={ICON_CLASS} aria-hidden />
|
||||
),
|
||||
debito: <RemixIcons.RiBankCardLine className={ICON_CLASS} aria-hidden />,
|
||||
};
|
||||
|
||||
return registry[key] ?? null;
|
||||
};
|
||||
Reference in New Issue
Block a user