Skip to content

Instantly share code, notes, and snippets.

View Luiz-Inaldo's full-sized avatar

Luiz Inaldo Luiz-Inaldo

  • Ativos-Tecnologia
  • Recife
View GitHub Profile
@Luiz-Inaldo
Luiz-Inaldo / try-catch-requests.ts
Last active February 9, 2026 00:41
TryCatchRequest Function
export async function tryCatchRequest<R, E>(fn: () => Promise<R>): Promise<[R | null, E | null]> {
try {
const result = await fn();
if (result === undefined) {
return [true as R, null];
}
return [result, null];
} catch (error) {
return [null, error as E];
@Luiz-Inaldo
Luiz-Inaldo / grafico-dashboard.tsx
Created February 2, 2026 15:10
Link componente dashboard pós
import React, { useState } from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
// Dados simulados - Histórico
const dataHistorico = [
{ mes: 'Jan', investidoCDI: 4200000, liquidoAtivos: 4300000, valorInvestido: 4100000, pnl: 2100000 },
{ mes: 'Fev', liquidoAtivos: 5000000, investidoCDI: 3500000, valorInvestido: 1200000, pnl: 3200000 },
{ mes: 'Mar', liquidoAtivos: 5800000, investidoCDI: 4300000, valorInvestido: 1800000, pnl: 4100000 },
{ mes: 'Abr', liquidoAtivos: 7600000, investidoCDI: 5800000, valorInvestido: 4200000, pnl: 5100000 },
{ mes: 'Mai', liquidoAtivos: 8200000, investidoCDI: 5500000, valorInvestido: 1500000, pnl: 5500000 },