From 6e2b3d72f17bdd83d355107c0bcb441592dcc187 Mon Sep 17 00:00:00 2001 From: Guillermo Arrieta Medina Date: Mon, 27 Oct 2025 17:14:50 -0600 Subject: [PATCH] =?UTF-8?q?Se=20env=C3=ADan=20correctamente=20los=20ids=20?= =?UTF-8?q?de=20los=20archivos=20de=20referencia=20para=20su=20procesamien?= =?UTF-8?q?to=20en=20el=20backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/planes/CreatePlanDialog.tsx | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/components/planes/CreatePlanDialog.tsx b/src/components/planes/CreatePlanDialog.tsx index 32962e1..c7df82a 100644 --- a/src/components/planes/CreatePlanDialog.tsx +++ b/src/components/planes/CreatePlanDialog.tsx @@ -118,35 +118,35 @@ export function CreatePlanDialog({ open, onOpenChange }: { open: boolean; onOpen const isSelected = useCallback((path: string) => selectedFiles.includes(path), [selectedFiles]); - const toggleSelected = useCallback((path: string) => { - setSelectedFiles(prev => prev.includes(path) ? prev.filter(p => p !== path) : [...prev, path]); + const toggleSelected = useCallback((id: string) => { + setSelectedFiles(prev => prev.includes(id) ? prev.filter(p => p !== id) : [...prev, id]); }, []); - const replaceSelection = useCallback((path: string) => { - setSelectedFiles([path]); + const replaceSelection = useCallback((id: string) => { + setSelectedFiles([id]); }, []); const rangeSelect = useCallback((start: number, end: number) => { const [s, e] = start < end ? [start, end] : [end, start]; - const paths = dbFiles.slice(s, e + 1).map(f => f.s3_file_path); - setSelectedFiles(prev => Array.from(new Set([...prev, ...paths]))); + const ids = dbFiles.slice(s, e + 1).map(f => f.id); + setSelectedFiles(prev => Array.from(new Set([...prev, ...ids]))); }, [dbFiles]); - const handleCardClick = useCallback((e: React.MouseEvent, index: number, file: { s3_file_path: string }) => { - const path = file.s3_file_path; + const handleCardClick = useCallback((e: React.MouseEvent, index: number, file: { id: string }) => { + const id = file.id; if (e.shiftKey && lastSelectedIndex !== null) { rangeSelect(lastSelectedIndex, index); } else if (e.metaKey || e.ctrlKey) { - toggleSelected(path); + toggleSelected(id); setLastSelectedIndex(index); } else { - if (isSelected(path) && selectedFiles.length === 1) { + if (isSelected(id) && selectedFiles.length === 1) { // si ya es el Ășnico seleccionado, des-selecciona setSelectedFiles([]); setLastSelectedIndex(null); } else { - replaceSelection(path); + replaceSelection(id); setLastSelectedIndex(index); } } @@ -167,7 +167,7 @@ export function CreatePlanDialog({ open, onOpenChange }: { open: boolean; onOpen prompt: prompt, insert: true, files: selectedFiles, - uuid: auth.user?.id, + created_by: auth.user?.id, }) const newId = (res as any)?.id || (res as any)?.plan?.id || (res as any)?.data?.id if (newId) { @@ -261,7 +261,7 @@ export function CreatePlanDialog({ open, onOpenChange }: { open: boolean; onOpen
{dbFiles.map((file, index) => { const ext = fileExt(file.titulo); - const selected = isSelected(file.s3_file_path); + const selected = isSelected(file.id); console.log(file); return (