From 32598c174c7f1b11d4e4f435bab931f9732ecd68 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 4 Aug 2026 17:15:57 +0200 Subject: [PATCH] . --- .../blocks/proforma-detail-preview-card.tsx | 27 ++-- .../src/components/form/form-section-card.tsx | 42 +++--- packages/rdx-ui/src/components/pdf-viewer.tsx | 125 ++++++++++-------- 3 files changed, 102 insertions(+), 92 deletions(-) diff --git a/modules/customer-invoices/src/web/proformas/detail/ui/blocks/proforma-detail-preview-card.tsx b/modules/customer-invoices/src/web/proformas/detail/ui/blocks/proforma-detail-preview-card.tsx index 68f90d98..2f2bcfe1 100644 --- a/modules/customer-invoices/src/web/proformas/detail/ui/blocks/proforma-detail-preview-card.tsx +++ b/modules/customer-invoices/src/web/proformas/detail/ui/blocks/proforma-detail-preview-card.tsx @@ -1,5 +1,4 @@ import { PDFViewer } from "@repo/rdx-ui/components"; -import { Card, CardContent } from "@repo/shadcn-ui/components"; type ProformaDetailPreviewCardProps = { src: string | null; @@ -19,21 +18,15 @@ export const ProformaDetailPreviewCard = ({ onPrint, }: ProformaDetailPreviewCardProps) => { return ( - - - - - + ); }; diff --git a/packages/rdx-ui/src/components/form/form-section-card.tsx b/packages/rdx-ui/src/components/form/form-section-card.tsx index 2e38acac..8c5c2cf4 100644 --- a/packages/rdx-ui/src/components/form/form-section-card.tsx +++ b/packages/rdx-ui/src/components/form/form-section-card.tsx @@ -13,6 +13,7 @@ interface FormSectionCardProps { description?: string; icon?: ReactNode; disabled?: boolean; + actions?: ReactNode; children: ReactNode; className?: string; headerClassName?: string; @@ -24,10 +25,12 @@ export const FormSectionCard = ({ description, icon, disabled = false, - children, className, headerClassName, contentClassName, + actions, + + children, }: FormSectionCardProps) => { const hasHeader = Boolean(title || description || icon); @@ -35,25 +38,28 @@ export const FormSectionCard = ({ {hasHeader && ( -
- {icon ? ( -
- {" "} - {icon}{" "} -
- ) : null} - -
- {title ? {title} : null} - {description ? ( - {description} +
+
+ {icon ? ( +
+ {" "} + {icon}{" "} +
) : null} + +
+ {title ? {title} : null} + {description ? ( + {description} + ) : null} +
+ {actions ? <>{actions} : null}
)} diff --git a/packages/rdx-ui/src/components/pdf-viewer.tsx b/packages/rdx-ui/src/components/pdf-viewer.tsx index 2dbeddb6..24692555 100644 --- a/packages/rdx-ui/src/components/pdf-viewer.tsx +++ b/packages/rdx-ui/src/components/pdf-viewer.tsx @@ -1,3 +1,4 @@ +import { FormSectionCard, FormSectionGrid } from "@repo/rdx-ui/components"; import { Button, Select, @@ -7,8 +8,14 @@ import { SelectValue, Spinner, } from "@repo/shadcn-ui/components"; -import { cn } from "@repo/shadcn-ui/lib/utils"; -import { DownloadIcon, ExternalLinkIcon, PrinterIcon, ZoomInIcon, ZoomOutIcon } from "lucide-react"; +import { + DownloadIcon, + ExternalLinkIcon, + EyeIcon, + PrinterIcon, + ZoomInIcon, + ZoomOutIcon, +} from "lucide-react"; import { useEffect, useMemo, useRef, useState } from "react"; const DEFAULT_ZOOM_OPTIONS = [50, 75, 100, 125, 150]; @@ -77,8 +84,10 @@ export function PDFViewer({ const updateFitZoom = () => { const styles = window.getComputedStyle(element); - const paddingX = Number.parseFloat(styles.paddingLeft) + Number.parseFloat(styles.paddingRight); - const paddingY = Number.parseFloat(styles.paddingTop) + Number.parseFloat(styles.paddingBottom); + const paddingX = + Number.parseFloat(styles.paddingLeft) + Number.parseFloat(styles.paddingRight); + const paddingY = + Number.parseFloat(styles.paddingTop) + Number.parseFloat(styles.paddingBottom); const availableWidth = Math.max(element.clientWidth - paddingX, 320); const availableHeight = Math.max(element.clientHeight - paddingY, 320); const widthScale = availableWidth / PDF_PAGE_WIDTH; @@ -143,13 +152,8 @@ export function PDFViewer({ }; return ( -
-
-
-

{title}

-

{description}

-
- +
-
- -
- {loading ? ( -
-
- - Cargando vista previa del PDF... + } + className="shadow-sm" + contentClassName="space-y-5" + description={description} + icon={} + title={title} + > + +
+ {loading ? ( +
+
+ + Cargando vista previa del PDF... +
-
- ) : null} + ) : null} - {!loading && error ? ( -
-
-

No se pudo cargar la vista previa

-

{error}

+ {!loading && error ? ( +
+
+

No se pudo cargar la vista previa

+

{error}

+
-
- ) : null} + ) : null} - {!(loading || error) && resolvedSrc ? ( -
-
-