From 84ca5e64fdb30bbe067bddfb722b21126460dcfd Mon Sep 17 00:00:00 2001 From: Felipe Coutinho Date: Tue, 20 Jan 2026 16:37:00 +0000 Subject: [PATCH] =?UTF-8?q?refactor(dashboard):=20usa=20DashboardGridEdita?= =?UTF-8?q?ble=20na=20p=C3=A1gina?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Substitui DashboardGrid por DashboardGridEditable - Busca preferĂȘncias de widgets do banco de dados --- app/(dashboard)/dashboard/page.tsx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/(dashboard)/dashboard/page.tsx b/app/(dashboard)/dashboard/page.tsx index 01066b6..e7e6530 100644 --- a/app/(dashboard)/dashboard/page.tsx +++ b/app/(dashboard)/dashboard/page.tsx @@ -1,11 +1,11 @@ -import { DashboardGrid } from "@/components/dashboard/dashboard-grid"; +import { DashboardGridEditable } from "@/components/dashboard/dashboard-grid-editable"; import { DashboardWelcome } from "@/components/dashboard/dashboard-welcome"; import { SectionCards } from "@/components/dashboard/section-cards"; import MonthNavigation from "@/components/month-picker/month-navigation"; import { getUser } from "@/lib/auth/server"; import { fetchDashboardData } from "@/lib/dashboard/fetch-dashboard-data"; -import { parsePeriodParam } from "@/lib/utils/period"; import { db, schema } from "@/lib/db"; +import { parsePeriodParam } from "@/lib/utils/period"; import { eq } from "drizzle-orm"; type PageSearchParams = Promise>; @@ -16,11 +16,11 @@ type PageProps = { const getSingleParam = ( params: Record | undefined, - key: string + key: string, ) => { const value = params?.[key]; if (!value) return null; - return Array.isArray(value) ? value[0] ?? null : value; + return Array.isArray(value) ? (value[0] ?? null) : value; }; export default async function Page({ searchParams }: PageProps) { @@ -34,6 +34,7 @@ export default async function Page({ searchParams }: PageProps) { db .select({ disableMagnetlines: schema.userPreferences.disableMagnetlines, + dashboardWidgets: schema.userPreferences.dashboardWidgets, }) .from(schema.userPreferences) .where(eq(schema.userPreferences.userId, user.id)) @@ -41,13 +42,21 @@ export default async function Page({ searchParams }: PageProps) { ]); const disableMagnetlines = preferencesResult[0]?.disableMagnetlines ?? false; + const dashboardWidgets = preferencesResult[0]?.dashboardWidgets ?? null; return (
- + - +
); }