diff --git a/src/components/fields/File/SideDrawerField.tsx b/src/components/fields/File/SideDrawerField.tsx index 788afa54..b00c3e7e 100644 --- a/src/components/fields/File/SideDrawerField.tsx +++ b/src/components/fields/File/SideDrawerField.tsx @@ -53,7 +53,7 @@ function ControlledFileUploader({ if (docRef && file) { upload({ - docRef: docRef as any, + docRef: docRef! as any, fieldName: column.key, files: [file], previousValue: value ?? [], diff --git a/src/components/fields/File/TableCell.tsx b/src/components/fields/File/TableCell.tsx index 50ea1328..be9fbce3 100644 --- a/src/components/fields/File/TableCell.tsx +++ b/src/components/fields/File/TableCell.tsx @@ -23,6 +23,7 @@ export default function File_({ value, onSubmit, disabled, + docRef, }: IHeavyCellProps) { const confirm = useSetAtom(confirmDialogAtom, globalScope); const updateField = useSetAtom(updateFieldAtom, tableScope); @@ -36,13 +37,13 @@ export default function File_({ if (file) { upload({ - docRef: row.ref, + docRef: docRef! as any, fieldName: column.key, files: [file], previousValue: value, onComplete: (newValue) => { updateField({ - path: row._rowy_ref.path, + path: docRef.path, fieldName: column.key, value: newValue, }); @@ -139,12 +140,13 @@ export default function File_({ !disabled && ( { dropzoneProps.onClick!(e); e.stopPropagation(); }} style={{ display: "flex" }} + className={docRef && "row-hover-iconButton"} + disabled={!docRef} > diff --git a/src/components/fields/Image/SideDrawerField.tsx b/src/components/fields/Image/SideDrawerField.tsx index 00dba032..2131e336 100644 --- a/src/components/fields/Image/SideDrawerField.tsx +++ b/src/components/fields/Image/SideDrawerField.tsx @@ -107,7 +107,7 @@ function ControlledImageUploader({ if (docRef && imageFile) { upload({ - docRef: docRef as any, + docRef: docRef! as any, fieldName: column.key, files: [imageFile], previousValue: value ?? [], diff --git a/src/components/fields/Image/TableCell.tsx b/src/components/fields/Image/TableCell.tsx index 28302b01..fdaa6cff 100644 --- a/src/components/fields/Image/TableCell.tsx +++ b/src/components/fields/Image/TableCell.tsx @@ -90,6 +90,7 @@ export default function Image_({ value, onSubmit, disabled, + docRef, }: IHeavyCellProps) { const confirm = useSetAtom(confirmDialogAtom, globalScope); const updateField = useSetAtom(updateFieldAtom, tableScope); @@ -106,13 +107,13 @@ export default function Image_({ if (imageFile) { upload({ - docRef: row.ref, + docRef: docRef! as any, fieldName: column.key, files: [imageFile], previousValue: value, onComplete: (newValue) => { updateField({ - path: row._rowy_ref.path, + path: docRef.path, fieldName: column.key, value: newValue, }); @@ -270,12 +271,13 @@ export default function Image_({ !disabled && ( { dropzoneProps.onClick!(e); e.stopPropagation(); }} style={{ display: "flex" }} + className={docRef && "row-hover-iconButton"} + disabled={!docRef} >