Improve AI logic
This commit is contained in:
@@ -82,6 +82,11 @@ export interface EditViewModalProps {
|
||||
isRefetching?: boolean; // External refetch state (from React Query)
|
||||
onSaveComplete?: () => Promise<void>; // Async callback for triggering refetch
|
||||
refetchTimeout?: number; // Timeout in ms for refetch (default: 3000)
|
||||
|
||||
// Custom default action labels
|
||||
cancelLabel?: string; // Custom label for cancel button
|
||||
saveLabel?: string; // Custom label for save button
|
||||
editLabel?: string; // Custom label for edit button
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,6 +356,10 @@ export const EditViewModal: React.FC<EditViewModalProps> = ({
|
||||
isRefetching = false,
|
||||
onSaveComplete,
|
||||
refetchTimeout = 3000,
|
||||
// Custom default action labels
|
||||
cancelLabel,
|
||||
saveLabel,
|
||||
editLabel,
|
||||
}) => {
|
||||
const { t } = useTranslation(['common']);
|
||||
const StatusIcon = statusIndicator?.icon;
|
||||
@@ -449,13 +458,13 @@ export const EditViewModal: React.FC<EditViewModalProps> = ({
|
||||
if (mode === 'view') {
|
||||
defaultActions.push(
|
||||
{
|
||||
label: t('common:modals.actions.cancel', 'Cancelar'),
|
||||
label: cancelLabel || t('common:modals.actions.cancel', 'Cancelar'),
|
||||
variant: 'outline',
|
||||
onClick: onClose,
|
||||
disabled: isProcessing,
|
||||
},
|
||||
{
|
||||
label: t('common:modals.actions.edit', 'Editar'),
|
||||
label: editLabel || t('common:modals.actions.edit', 'Editar'),
|
||||
variant: 'primary',
|
||||
onClick: handleEdit,
|
||||
disabled: isProcessing,
|
||||
@@ -464,13 +473,13 @@ export const EditViewModal: React.FC<EditViewModalProps> = ({
|
||||
} else {
|
||||
defaultActions.push(
|
||||
{
|
||||
label: t('common:modals.actions.cancel', 'Cancelar'),
|
||||
label: cancelLabel || t('common:modals.actions.cancel', 'Cancelar'),
|
||||
variant: 'outline',
|
||||
onClick: handleCancel,
|
||||
disabled: isProcessing,
|
||||
},
|
||||
{
|
||||
label: t('common:modals.actions.save', 'Guardar'),
|
||||
label: saveLabel || t('common:modals.actions.save', 'Guardar'),
|
||||
variant: 'primary',
|
||||
onClick: handleSave,
|
||||
disabled: isProcessing,
|
||||
|
||||
Reference in New Issue
Block a user