diff --git a/src/app/emprestimos/emprestimos-page-client.tsx b/src/app/emprestimos/emprestimos-page-client.tsx index c02084c..2f36adb 100644 --- a/src/app/emprestimos/emprestimos-page-client.tsx +++ b/src/app/emprestimos/emprestimos-page-client.tsx @@ -47,7 +47,6 @@ import { TableHeader, TableRow, } from "@/components/ui/table" -import { Spinner } from "@/components/ui/spinner" import { Skeleton } from "@/components/ui/skeleton" import { SearchableCombobox, type SearchableComboboxOption } from "@/components/ui/searchable-combobox" import { DateRangeButton, type DateRangeValue } from "@/components/date-range-button" @@ -388,13 +387,7 @@ export function EmprestimosPageClient() { setDateRange({ from: null, to: null }) }, []) - if (!tenantId || !convexUserId) { - return ( -
- -
- ) - } + const isLoading = !tenantId || !convexUserId const fieldWrap = "min-w-[180px] flex-1" const fieldTrigger = @@ -410,21 +403,37 @@ export function EmprestimosPageClient() {

Total

-

{stats?.total ?? 0}

+ {isLoading || stats === undefined ? ( + + ) : ( +

{stats.total}

+ )}

Ativos

-

{stats?.ativos ?? 0}

+ {isLoading || stats === undefined ? ( + + ) : ( +

{stats.ativos}

+ )}

Atrasados

-

{stats?.atrasados ?? 0}

+ {isLoading || stats === undefined ? ( + + ) : ( +

{stats.atrasados}

+ )}

Valor ativo

-

- R$ {(stats?.valorTotalAtivo ?? 0).toLocaleString("pt-BR", { minimumFractionDigits: 2 })} -

+ {isLoading || stats === undefined ? ( + + ) : ( +

+ R$ {stats.valorTotalAtivo.toLocaleString("pt-BR", { minimumFractionDigits: 2 })} +

+ )}
@@ -535,7 +544,7 @@ export function EmprestimosPageClient() { - {!emprestimos ? ( + {isLoading || !emprestimos ? ( // Skeleton rows durante o loading Array.from({ length: 5 }).map((_, idx) => (