refactor(cartoes): adiciona layout e limpa página de relatório
- Cria layout.tsx com PageDescription - Remove header duplicado da página - Passa dados do cartão para CardUsageChart
This commit is contained in:
23
app/(dashboard)/relatorios/cartoes/layout.tsx
Normal file
23
app/(dashboard)/relatorios/cartoes/layout.tsx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import PageDescription from "@/components/page-description";
|
||||||
|
import { RiBankCard2Line } from "@remixicon/react";
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
title: "Relatório de Cartões | Opensheets",
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function RootLayout({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<section className="space-y-6 px-6">
|
||||||
|
<PageDescription
|
||||||
|
icon={<RiBankCard2Line />}
|
||||||
|
title="Relatório de Cartões"
|
||||||
|
subtitle="Análise detalhada do uso dos seus cartões de crédito."
|
||||||
|
/>
|
||||||
|
{children}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
|
import MonthNavigation from "@/components/month-picker/month-navigation";
|
||||||
import { CardCategoryBreakdown } from "@/components/relatorios/cartoes/card-category-breakdown";
|
import { CardCategoryBreakdown } from "@/components/relatorios/cartoes/card-category-breakdown";
|
||||||
import { CardInvoiceStatus } from "@/components/relatorios/cartoes/card-invoice-status";
|
import { CardInvoiceStatus } from "@/components/relatorios/cartoes/card-invoice-status";
|
||||||
import { CardTopExpenses } from "@/components/relatorios/cartoes/card-top-expenses";
|
import { CardTopExpenses } from "@/components/relatorios/cartoes/card-top-expenses";
|
||||||
import { CardUsageChart } from "@/components/relatorios/cartoes/card-usage-chart";
|
import { CardUsageChart } from "@/components/relatorios/cartoes/card-usage-chart";
|
||||||
import { CardsOverview } from "@/components/relatorios/cartoes/cards-overview";
|
import { CardsOverview } from "@/components/relatorios/cartoes/cards-overview";
|
||||||
import MonthNavigation from "@/components/month-picker/month-navigation";
|
|
||||||
import { getUser } from "@/lib/auth/server";
|
import { getUser } from "@/lib/auth/server";
|
||||||
import { fetchCartoesReportData } from "@/lib/relatorios/cartoes-report";
|
import { fetchCartoesReportData } from "@/lib/relatorios/cartoes-report";
|
||||||
import { parsePeriodParam } from "@/lib/utils/period";
|
import { parsePeriodParam } from "@/lib/utils/period";
|
||||||
@@ -40,16 +40,7 @@ export default async function RelatorioCartoesPage({
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex flex-col gap-4 px-6">
|
<main className="flex flex-col gap-4">
|
||||||
<div className="flex flex-col gap-1">
|
|
||||||
<h1 className="text-2xl font-semibold tracking-tight">
|
|
||||||
Relatório de Cartões
|
|
||||||
</h1>
|
|
||||||
<p className="text-sm text-muted-foreground">
|
|
||||||
Análise detalhada do uso dos seus cartões de crédito.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<MonthNavigation />
|
<MonthNavigation />
|
||||||
|
|
||||||
<div className="grid gap-4 lg:grid-cols-3">
|
<div className="grid gap-4 lg:grid-cols-3">
|
||||||
@@ -60,15 +51,13 @@ export default async function RelatorioCartoesPage({
|
|||||||
<div className="lg:col-span-2 space-y-4">
|
<div className="lg:col-span-2 space-y-4">
|
||||||
{data.selectedCard ? (
|
{data.selectedCard ? (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center gap-2 pb-2 border-b">
|
|
||||||
<h2 className="text-lg font-semibold">
|
|
||||||
{data.selectedCard.card.name}
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<CardUsageChart
|
<CardUsageChart
|
||||||
data={data.selectedCard.monthlyUsage}
|
data={data.selectedCard.monthlyUsage}
|
||||||
limit={data.selectedCard.card.limit}
|
limit={data.selectedCard.card.limit}
|
||||||
|
card={{
|
||||||
|
name: data.selectedCard.card.name,
|
||||||
|
logo: data.selectedCard.card.logo,
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="grid gap-4 md:grid-cols-2">
|
<div className="grid gap-4 md:grid-cols-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user