From b7e7f99f99e4d3aab6424c4d3470cabf272fbfe1 Mon Sep 17 00:00:00 2001 From: rever-tecnologia Date: Fri, 5 Dec 2025 10:11:43 -0300 Subject: [PATCH] Fix emprestimos table layout shift during filter changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace centered spinner with skeleton table rows - Maintain table structure and width during loading - Show 5 skeleton rows with proper column widths - Prevents layout collapse when changing filters 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../emprestimos/emprestimos-page-client.tsx | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/app/emprestimos/emprestimos-page-client.tsx b/src/app/emprestimos/emprestimos-page-client.tsx index d6d7746..ba7b699 100644 --- a/src/app/emprestimos/emprestimos-page-client.tsx +++ b/src/app/emprestimos/emprestimos-page-client.tsx @@ -48,6 +48,7 @@ import { 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" import { DatePicker } from "@/components/ui/date-picker" @@ -503,20 +504,15 @@ export function EmprestimosPageClient() { {/* Table Section */}
- {!emprestimos ? ( -
- - Carregando empréstimos... -
- ) : filteredEmprestimos.length === 0 ? ( + {emprestimos && filteredEmprestimos.length === 0 ? ( - Nenhum empréstimo encontrado + Nenhum emprestimo encontrado - Ajuste os filtros ou crie um novo empréstimo para começar. + Ajuste os filtros ou crie um novo emprestimo para comecar. @@ -527,17 +523,32 @@ export function EmprestimosPageClient() { Ref Cliente - Responsável + Responsavel Equipamentos - Empréstimo + Emprestimo Prevista Status Valor - Ações + Acoes - {filteredEmprestimos.map((emp) => ( + {!emprestimos ? ( + // Skeleton rows durante o loading + Array.from({ length: 5 }).map((_, idx) => ( + + + + + + + + + + + + )) + ) : filteredEmprestimos.map((emp) => (