+ {/* Header with controls */}
+
+
+
+
+ Workflow Text Editor
+
+
+ handleFormatChange(value as EditorFormat)}
+ >
+
+
+ YAML
+
+
+ JSON
+
+
+
+
+
+
+
+
+ {!isValid
+ ? 'Fix validation errors to save'
+ : !hasUnsavedChanges
+ ? 'No changes to save'
+ : disabled
+ ? 'Editor is disabled'
+ : 'Save changes to workflow'}
+
+
+
+
+
+ {/* Status indicators */}
+
+ {isValid ? (
+
+
+ Valid {currentFormat.toUpperCase()}
+
+ ) : (
+
+
+ {validationErrors.length} validation error{validationErrors.length !== 1 ? 's' : ''}
+
+ )}
+
+ {hasUnsavedChanges &&
• Unsaved changes
}
+
+
+
+ {/* Alerts section - fixed height, scrollable if needed */}
+ {(validationErrors.length > 0 || saveResult) && (
+
+
+ {/* Validation errors */}
+ {validationErrors.length > 0 && (
+ <>
+ {validationErrors.map((error, index) => (
+
+
+
+ {error.line && error.column
+ ? `Line ${error.line}, Column ${error.column}: ${error.message}`
+ : error.message}
+
+
+ ))}
+ >
+ )}
+
+ {/* Save result */}
+ {saveResult && (
+
+ {saveResult.success ? (
+
+ ) : (
+
+ )}
+
+ {saveResult.success ? (
+ <>
+ Workflow updated successfully!
+ {saveResult.warnings && saveResult.warnings.length > 0 && (
+
+
Warnings:
+
+ {saveResult.warnings.map((warning, index) => (
+ - {warning}
+ ))}
+
+
+ )}
+ >
+ ) : (
+ <>
+ Failed to update workflow:
+ {saveResult.errors && (
+
+ {saveResult.errors.map((error, index) => (
+ - {error}
+ ))}
+
+ )}
+ >
+ )}
+
+
+ )}
+
+
+ )}
+
+ {/* Code editor - takes remaining space */}
+
+
+ )
+}