mirror of
https://github.com/felipegcoutinho/openmonetis.git
synced 2026-05-09 11:01:45 +00:00
refactor(dashboard): reorganiza widgets e remove magnet-lines
This commit is contained in:
@@ -54,7 +54,6 @@ const deleteAccountSchema = z.object({
|
||||
});
|
||||
|
||||
const updatePreferencesSchema = z.object({
|
||||
disableMagnetlines: z.boolean(),
|
||||
extratoNoteAsColumn: z.boolean(),
|
||||
lancamentosColumnOrder: z.array(z.string()).nullable(),
|
||||
systemFont: z.enum(FONT_KEYS).default(DEFAULT_FONT_KEY),
|
||||
@@ -403,7 +402,6 @@ export async function updatePreferencesAction(
|
||||
await db
|
||||
.update(schema.preferenciasUsuario)
|
||||
.set({
|
||||
disableMagnetlines: validated.disableMagnetlines,
|
||||
extratoNoteAsColumn: validated.extratoNoteAsColumn,
|
||||
lancamentosColumnOrder: validated.lancamentosColumnOrder,
|
||||
systemFont: validated.systemFont,
|
||||
@@ -415,7 +413,6 @@ export async function updatePreferencesAction(
|
||||
// Create new preferences
|
||||
await db.insert(schema.preferenciasUsuario).values({
|
||||
userId: session.user.id,
|
||||
disableMagnetlines: validated.disableMagnetlines,
|
||||
extratoNoteAsColumn: validated.extratoNoteAsColumn,
|
||||
lancamentosColumnOrder: validated.lancamentosColumnOrder,
|
||||
systemFont: validated.systemFont,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { db, schema } from "@/lib/db";
|
||||
import { type FontKey, normalizeFontKey } from "@/public/fonts/font_index";
|
||||
|
||||
export interface UserPreferences {
|
||||
disableMagnetlines: boolean;
|
||||
extratoNoteAsColumn: boolean;
|
||||
lancamentosColumnOrder: string[] | null;
|
||||
systemFont: FontKey;
|
||||
@@ -34,7 +33,6 @@ export async function fetchUserPreferences(
|
||||
): Promise<UserPreferences | null> {
|
||||
const result = await db
|
||||
.select({
|
||||
disableMagnetlines: schema.preferenciasUsuario.disableMagnetlines,
|
||||
extratoNoteAsColumn: schema.preferenciasUsuario.extratoNoteAsColumn,
|
||||
lancamentosColumnOrder: schema.preferenciasUsuario.lancamentosColumnOrder,
|
||||
systemFont: schema.preferenciasUsuario.systemFont,
|
||||
|
||||
@@ -67,9 +67,6 @@ export default async function Page() {
|
||||
</p>
|
||||
</div>
|
||||
<PreferencesForm
|
||||
disableMagnetlines={
|
||||
userPreferences?.disableMagnetlines ?? false
|
||||
}
|
||||
extratoNoteAsColumn={
|
||||
userPreferences?.extratoNoteAsColumn ?? false
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user