refactor: update icons and improve layout structure across components
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import PageDescription from "@/components/page-description";
|
||||
import { RiFileListLine } from "@remixicon/react";
|
||||
import { RiTodoLine } from "@remixicon/react";
|
||||
|
||||
export const metadata = {
|
||||
title: "Anotações | OpenSheets",
|
||||
@@ -13,7 +13,7 @@ export default function RootLayout({
|
||||
return (
|
||||
<section className="space-y-6 px-6">
|
||||
<PageDescription
|
||||
icon={<RiFileListLine />}
|
||||
icon={<RiTodoLine />}
|
||||
title="Notas"
|
||||
subtitle="Gerencie suas anotações e mantenha o controle sobre suas ideias e tarefas."
|
||||
/>
|
||||
|
||||
@@ -18,8 +18,7 @@ export type AccountData = {
|
||||
};
|
||||
|
||||
export async function fetchAccountsForUser(
|
||||
userId: string,
|
||||
currentPeriod: string
|
||||
userId: string
|
||||
): Promise<{ accounts: AccountData[]; logoOptions: LogoOption[] }> {
|
||||
const [accountRows, logoOptions] = await Promise.all([
|
||||
db
|
||||
@@ -50,14 +49,10 @@ export async function fetchAccountsForUser(
|
||||
and(
|
||||
eq(lancamentos.contaId, contas.id),
|
||||
eq(lancamentos.userId, userId),
|
||||
eq(lancamentos.period, currentPeriod),
|
||||
eq(lancamentos.isSettled, true)
|
||||
)
|
||||
)
|
||||
.leftJoin(
|
||||
pagadores,
|
||||
eq(lancamentos.pagadorId, pagadores.id)
|
||||
)
|
||||
.leftJoin(pagadores, eq(lancamentos.pagadorId, pagadores.id))
|
||||
.where(
|
||||
and(
|
||||
eq(contas.userId, userId),
|
||||
|
||||
@@ -5,14 +5,8 @@ import { fetchAccountsForUser } from "./data";
|
||||
export default async function Page() {
|
||||
const userId = await getUserId();
|
||||
const now = new Date();
|
||||
const currentPeriod = `${now.getFullYear()}-${String(
|
||||
now.getMonth() + 1
|
||||
).padStart(2, "0")}`;
|
||||
|
||||
const { accounts, logoOptions } = await fetchAccountsForUser(
|
||||
userId,
|
||||
currentPeriod
|
||||
);
|
||||
const { accounts, logoOptions } = await fetchAccountsForUser(userId);
|
||||
|
||||
return (
|
||||
<main className="flex flex-col items-start gap-6">
|
||||
|
||||
23
app/(dashboard)/dashboard/analise-parcelas/layout.tsx
Normal file
23
app/(dashboard)/dashboard/analise-parcelas/layout.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import PageDescription from "@/components/page-description";
|
||||
import { RiSecurePaymentLine } from "@remixicon/react";
|
||||
|
||||
export const metadata = {
|
||||
title: "Análise de Parcelas | OpenSheets",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className="space-y-6 px-6">
|
||||
<PageDescription
|
||||
icon={<RiSecurePaymentLine />}
|
||||
title="Análise de Parcelas"
|
||||
subtitle="Quanto você gastaria pagando suas despesas parceladas à vista?"
|
||||
/>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import { InstallmentAnalysisPage } from "@/components/dashboard/installment-analysis/installment-analysis-page";
|
||||
import { fetchInstallmentAnalysis } from "@/lib/dashboard/expenses/installment-analysis";
|
||||
import { getUser } from "@/lib/auth/server";
|
||||
import { fetchInstallmentAnalysis } from "@/lib/dashboard/expenses/installment-analysis";
|
||||
|
||||
export default async function Page() {
|
||||
const user = await getUser();
|
||||
const data = await fetchInstallmentAnalysis(user.id);
|
||||
|
||||
return (
|
||||
<main className="flex flex-col gap-4 px-4 pb-8">
|
||||
<main className="flex flex-col gap-4 pb-8">
|
||||
<InstallmentAnalysisPage data={data} />
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -2,8 +2,8 @@ import { DashboardGrid } from "@/components/dashboard/dashboard-grid";
|
||||
import { DashboardWelcome } from "@/components/dashboard/dashboard-welcome";
|
||||
import { SectionCards } from "@/components/dashboard/section-cards";
|
||||
import MonthPicker from "@/components/month-picker/month-picker";
|
||||
import { fetchDashboardData } from "@/lib/dashboard/fetch-dashboard-data";
|
||||
import { getUser } from "@/lib/auth/server";
|
||||
import { fetchDashboardData } from "@/lib/dashboard/fetch-dashboard-data";
|
||||
import { parsePeriodParam } from "@/lib/utils/period";
|
||||
|
||||
type PageSearchParams = Promise<Record<string, string | string[] | undefined>>;
|
||||
@@ -30,7 +30,7 @@ export default async function Page({ searchParams }: PageProps) {
|
||||
const data = await fetchDashboardData(user.id, selectedPeriod);
|
||||
|
||||
return (
|
||||
<main className="flex flex-col gap-4 px-4">
|
||||
<main className="flex flex-col gap-4 px-6">
|
||||
<DashboardWelcome name={user.name} />
|
||||
<MonthPicker />
|
||||
<SectionCards metrics={data.metrics} />
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { SiteHeader } from "@/components/header-dashboard";
|
||||
import { AppSidebar } from "@/components/sidebar/app-sidebar";
|
||||
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
|
||||
import { fetchDashboardNotifications } from "@/lib/dashboard/notifications";
|
||||
import { getUserSession } from "@/lib/auth/server";
|
||||
import { parsePeriodParam } from "@/lib/utils/period";
|
||||
import { PAGADOR_ROLE_ADMIN } from "@/lib/pagadores/constants";
|
||||
import { fetchDashboardNotifications } from "@/lib/dashboard/notifications";
|
||||
import { fetchPagadoresWithAccess } from "@/lib/pagadores/access";
|
||||
import { PAGADOR_ROLE_ADMIN } from "@/lib/pagadores/constants";
|
||||
import { parsePeriodParam } from "@/lib/utils/period";
|
||||
|
||||
export default async function layout({
|
||||
children,
|
||||
@@ -29,8 +29,8 @@ export default async function layout({
|
||||
typeof periodoParam === "string"
|
||||
? periodoParam
|
||||
: Array.isArray(periodoParam)
|
||||
? periodoParam[0]
|
||||
: null;
|
||||
? periodoParam[0]
|
||||
: null;
|
||||
const { period: currentPeriod } = parsePeriodParam(
|
||||
singlePeriodoParam ?? null
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user