refactor(dashboard): reorganiza widgets e remove magnet-lines

This commit is contained in:
Felipe Coutinho
2026-03-09 17:12:44 +00:00
parent 3e06a1d056
commit 69da27276c
106 changed files with 6072 additions and 3601 deletions

View File

@@ -2,7 +2,6 @@ import { eq } from "drizzle-orm";
import { db, schema } from "@/lib/db";
export interface UserDashboardPreferences {
disableMagnetlines: boolean;
dashboardWidgets: string | null;
}
@@ -11,7 +10,6 @@ export async function fetchUserDashboardPreferences(
): Promise<UserDashboardPreferences> {
const result = await db
.select({
disableMagnetlines: schema.preferenciasUsuario.disableMagnetlines,
dashboardWidgets: schema.preferenciasUsuario.dashboardWidgets,
})
.from(schema.preferenciasUsuario)
@@ -19,7 +17,6 @@ export async function fetchUserDashboardPreferences(
.limit(1);
return {
disableMagnetlines: result[0]?.disableMagnetlines ?? false,
dashboardWidgets: result[0]?.dashboardWidgets ?? null,
};
}

View File

@@ -4,8 +4,10 @@ import { Skeleton } from "@/components/ui/skeleton";
export default function DashboardLoading() {
return (
<main className="flex flex-col gap-4">
{/* Welcome Banner skeleton */}
<Skeleton className="h-[104px] w-full rounded-xl bg-foreground/10" />
<div className="space-y-2 px-1 py-2">
<Skeleton className="h-8 w-72 rounded-xl bg-foreground/10" />
<Skeleton className="h-5 w-56 rounded-xl bg-foreground/10" />
</div>
{/* Month Picker skeleton */}
<Skeleton className="h-[56px] w-full rounded-xl bg-foreground/10" />

View File

@@ -1,6 +1,6 @@
import { DashboardGridEditable } from "@/components/dashboard/dashboard-grid-editable";
import { DashboardMetricsCards } from "@/components/dashboard/dashboard-metrics-cards";
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";
@@ -41,7 +41,7 @@ export default async function Page({ searchParams }: PageProps) {
fetchLancamentoFilterSources(user.id),
getRecentEstablishmentsAction(),
]);
const { disableMagnetlines, dashboardWidgets } = preferences;
const { dashboardWidgets } = preferences;
const sluggedFilters = buildSluggedFilters(filterSources);
const {
pagadorOptions,
@@ -57,12 +57,9 @@ export default async function Page({ searchParams }: PageProps) {
return (
<main className="flex flex-col gap-4">
<DashboardWelcome
name={user.name}
disableMagnetlines={disableMagnetlines}
/>
<DashboardWelcome name={user.name} />
<MonthNavigation />
<SectionCards metrics={dashboardData.metrics} />
<DashboardMetricsCards metrics={dashboardData.metrics} />
<DashboardGridEditable
data={dashboardData}
period={selectedPeriod}