@@ -22,6 +22,7 @@ import { API, graphqlOperation } from 'aws-amplify';
2222import FileViewer from '../document-viewer/JSONViewer' ;
2323import { getSectionConfidenceAlertCount , getSectionConfidenceAlerts } from '../common/confidence-alerts-utils' ;
2424import useConfiguration from '../../hooks/use-configuration' ;
25+ import useSettingsContext from '../../contexts/settings' ;
2526import processChanges from '../../graphql/queries/processChanges' ;
2627
2728// Cell renderer components
@@ -264,8 +265,10 @@ const SectionsPanel = ({ sections, pages, documentItem, mergedConfig, onSaveChan
264265 const [ editedSections , setEditedSections ] = useState ( [ ] ) ;
265266 const [ validationErrors , setValidationErrors ] = useState ( { } ) ;
266267 const [ showConfirmModal , setShowConfirmModal ] = useState ( false ) ;
268+ const [ showPattern1Modal , setShowPattern1Modal ] = useState ( false ) ;
267269 const [ isProcessing , setIsProcessing ] = useState ( false ) ;
268270 const { mergedConfig : configuration } = useConfiguration ( ) ;
271+ const { settings } = useSettingsContext ( ) ;
269272
270273 // Initialize edited sections when entering edit mode
271274 useEffect ( ( ) => {
@@ -521,6 +524,21 @@ const SectionsPanel = ({ sections, pages, documentItem, mergedConfig, onSaveChan
521524 return false ;
522525 } ;
523526
527+ // Check if current pattern is Pattern-1
528+ const isPattern1 = ( ) => {
529+ const pattern = settings ?. IDPPattern ;
530+ return pattern && pattern . toLowerCase ( ) . includes ( 'pattern1' ) ;
531+ } ;
532+
533+ // Handle Edit Sections button click
534+ const handleEditSectionsClick = ( ) => {
535+ if ( isPattern1 ( ) ) {
536+ setShowPattern1Modal ( true ) ;
537+ } else {
538+ setIsEditMode ( true ) ;
539+ }
540+ } ;
541+
524542 // Handle save changes
525543 const handleSaveChanges = async ( ) => {
526544 if ( ! validateSections ( editedSections ) ) {
@@ -660,7 +678,7 @@ const SectionsPanel = ({ sections, pages, documentItem, mergedConfig, onSaveChan
660678 actions = {
661679 < SpaceBetween direction = "horizontal" size = "xs" >
662680 { ! isEditMode ? (
663- < Button variant = "primary" iconName = "edit" onClick = { ( ) => setIsEditMode ( true ) } >
681+ < Button variant = "primary" iconName = "edit" onClick = { handleEditSectionsClick } >
664682 Edit Sections
665683 </ Button >
666684 ) : (
@@ -756,6 +774,53 @@ const SectionsPanel = ({ sections, pages, documentItem, mergedConfig, onSaveChan
756774 </ Box >
757775 </ SpaceBetween >
758776 </ Modal >
777+
778+ { /* Pattern-1 Information Modal */ }
779+ < Modal
780+ onDismiss = { ( ) => setShowPattern1Modal ( false ) }
781+ visible = { showPattern1Modal }
782+ footer = {
783+ < Box float = "right" >
784+ < Button variant = "primary" onClick = { ( ) => setShowPattern1Modal ( false ) } >
785+ Got it
786+ </ Button >
787+ </ Box >
788+ }
789+ header = "Edit Sections - Pattern-1"
790+ >
791+ < SpaceBetween size = "m" >
792+ < Alert type = "info" header = "Feature Not Available for Pattern-1" >
793+ < Box >
794+ The Edit Sections feature is currently available for < strong > Pattern-2</ strong > and < strong > Pattern-3</ strong > only.
795+ </ Box >
796+ </ Alert >
797+
798+ < Box >
799+ < strong > Why is this different for Pattern-1?</ strong >
800+ </ Box >
801+
802+ < Box >
803+ Pattern-1 uses < strong > Bedrock Data Automation (BDA)</ strong > which has its own section management approach
804+ that integrates directly with Amazon Bedrock's document processing blueprints.
805+ Section boundaries are automatically determined by the BDA service based on the document structure
806+ and configured blueprints.
807+ </ Box >
808+
809+ < Box >
810+ < strong > Available alternatives for Pattern-1:</ strong >
811+ </ Box >
812+
813+ < ul >
814+ < li > < strong > View/Edit Data</ strong > : Use the "View/Edit Data" buttons to review and modify extracted information within each section</ li >
815+ < li > < strong > Configuration</ strong > : Adjust document classes and extraction rules in the Configuration tab</ li >
816+ < li > < strong > Reprocess Document</ strong > : Use the "Reprocess" button to run the document through the pipeline again with updated configuration</ li >
817+ </ ul >
818+
819+ < Box >
820+ For fine-grained section control, consider using < strong > Pattern-2</ strong > or < strong > Pattern-3</ strong > for future documents.
821+ </ Box >
822+ </ SpaceBetween >
823+ </ Modal >
759824 </ SpaceBetween >
760825 ) ;
761826} ;
0 commit comments