From e332fcba52f5b9cf4aa8fdddb542830a8da9a7d7 Mon Sep 17 00:00:00 2001 From: David Arranz Date: Mon, 19 Oct 2026 17:54:52 +0200 Subject: [PATCH] feat: enhance chapter management and UI interactions in quotes - Implement drag-and-drop functionality for chapters using the folder icon as the activator, improving accessibility and user experience. - Refactor chapter deletion dialog to clearly separate options for keeping or deleting chapter contents, with appropriate translations and UI adjustments. - Update empty state handling for quotes without items, providing clear actions to add content. - Adjust translations for clarity and consistency across multiple languages. - Remove unnecessary empty columns in the chapter details table, streamlining the layout. - Enhance visual styling with borders and spacing adjustments for better chapter delineation. - Add tests to cover new functionalities and ensure existing features remain intact. --- .../components/AppendBlockRowButton.tsx | 1 - .../components/QuoteChaptersDataTable.tsx | 292 ++++++++++-------- .../QuoteItemsSortableDataTable.tsx | 230 ++++++++------ .../QuoteItemsSortableDataTableToolbar.tsx | 74 +++-- .../editors/QuoteChapterEditor.test.tsx | 130 ++++++-- .../editors/QuoteDetailsCardEditor.tsx | 2 + client/src/locales/ca.json | 18 +- client/src/locales/en.json | 18 +- client/src/locales/es.json | 24 +- client/src/locales/fr.json | 18 +- doc/capitulos-cotizaciones.md | 46 +++ 11 files changed, 582 insertions(+), 271 deletions(-) diff --git a/client/src/app/quotes/components/AppendBlockRowButton.tsx b/client/src/app/quotes/components/AppendBlockRowButton.tsx index 638636c..600cbf0 100644 --- a/client/src/app/quotes/components/AppendBlockRowButton.tsx +++ b/client/src/app/quotes/components/AppendBlockRowButton.tsx @@ -14,7 +14,6 @@ export const AppendBlockRowButton = forwardRef ( diff --git a/client/src/app/quotes/components/QuoteChaptersDataTable.tsx b/client/src/app/quotes/components/QuoteChaptersDataTable.tsx index 42102fa..cd71e5f 100644 --- a/client/src/app/quotes/components/QuoteChaptersDataTable.tsx +++ b/client/src/app/quotes/components/QuoteChaptersDataTable.tsx @@ -48,8 +48,15 @@ import { getCoreRowModel, useReactTable, } from "@tanstack/react-table"; -import { CopyIcon, FolderIcon, FolderOpenIcon, GripVerticalIcon, Trash2Icon } from "lucide-react"; -import { Fragment, ReactNode, useMemo, useState } from "react"; +import { + CopyIcon, + FolderIcon, + FolderOpenIcon, + FolderPlusIcon, + FolderXIcon, + Trash2Icon, +} from "lucide-react"; +import { Fragment, ReactNode, useState } from "react"; import { Controller, useFormContext } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { @@ -111,11 +118,6 @@ function ChapterContent({ children }: { children: ReactNode }) { ); } -// Reserve the expand column in detail rows so all controls stay aligned. -function ChapterSpacerCell() { - return ; -} - function EmptyChapterTarget({ id, columns, @@ -142,8 +144,7 @@ function EmptyChapterTarget({ data-empty-chapter={id} className={isOver ? "bg-accent" : ""} > - - + @@ -205,6 +206,10 @@ function ChapterGroup({ className={`bg-background [&>tr:not([data-chapter-gap]):not([data-active-item])>td]:border-b [&>tr:not([data-chapter-gap]):not([data-active-item])>td]:border-b-border + [&>tr:not([data-chapter-gap]):not([data-active-item])>:first-child]:border-l + [&>tr:not([data-chapter-gap]):not([data-active-item])>:first-child]:border-l-border + [&>tr:not([data-chapter-gap]):not([data-active-item])>:last-child]:border-r + [&>tr:not([data-chapter-gap]):not([data-active-item])>:last-child]:border-r-border [&>tr[data-active-item]>td]:border-destructive/30 [&>tr[data-active-item]>td:first-child]:border-l-4 [&>tr[data-active-item]>td:first-child]:border-l-destructive @@ -227,39 +232,50 @@ function ChapterGroup({ className='group/chapter bg-muted hover:bg-muted [&>td]:border-t [&>td]:py-3 [&>td:first-child]:rounded-tl-md [&>td:last-child]:rounded-tr-md' data-chapter-id={chapter.id} > - -
- - -
-
- +
+
+ + +
( -
+