@@ -42,11 +42,6 @@ import {
4242 uniqueUsage ,
4343} from './utils/documentOutlineModel' ;
4444
45- interface DocumentOutlineProps {
46- payload : MappingReviewSuspendPayload ;
47- showChrome ?: boolean ;
48- }
49-
5045type AnchoredMappingCard = MappingCardData & {
5146 anchorId : string ;
5247} ;
@@ -131,7 +126,6 @@ function getTextSegmentStyle(styles?: NormalizedDocumentFlattenedRun['styles']):
131126
132127function renderTextSegment (
133128 key : string ,
134- testId : string ,
135129 segment : TextSegment ,
136130 hovered : boolean ,
137131 setHoveredMappings : ( mappingKeys : string [ ] ) => void
@@ -140,9 +134,6 @@ function renderTextSegment(
140134 < Box
141135 as = "span"
142136 key = { key }
143- data-testid = { testId }
144- data-highlighted = { segment . highlighted ? 'true' : 'false' }
145- data-hovered = { hovered ? 'true' : 'false' }
146137 onMouseEnter = { segment . highlighted ? ( ) => setHoveredMappings ( segment . mappingKeys ) : undefined }
147138 onMouseLeave = { segment . highlighted ? ( ) => setHoveredMappings ( [ ] ) : undefined }
148139 style = { {
@@ -172,7 +163,7 @@ function renderTextSegment(
172163 ) ;
173164}
174165
175- export const DocumentOutline = ( { payload, showChrome = true } : DocumentOutlineProps ) => {
166+ export const DocumentOutline = ( payload : MappingReviewSuspendPayload ) : JSX . Element => {
176167 const [ selectedEntryIndex , setSelectedEntryIndex ] = useState < number | null > ( null ) ;
177168 const [ hoveredMappingKeys , setHoveredMappingKeys ] = useState < string [ ] > ( [ ] ) ;
178169 const [ cardOffsetsBySegment , setCardOffsetsBySegment ] = useState <
@@ -320,13 +311,7 @@ export const DocumentOutline = ({ payload, showChrome = true }: DocumentOutlineP
320311 < Text as = "p" marginBottom = "none" >
321312 { textSegments . map ( ( seg , index ) => {
322313 const hovered = isMappingHovered ( seg . mappingKeys ) ;
323- return renderTextSegment (
324- `${ block . id } -${ index } ` ,
325- `block-segment-${ block . id } -${ index } ` ,
326- seg ,
327- hovered ,
328- setHoveredMappings
329- ) ;
314+ return renderTextSegment ( `${ block . id } -${ index } ` , seg , hovered , setHoveredMappings ) ;
330315 } ) }
331316 </ Text >
332317 ) ;
@@ -435,8 +420,6 @@ export const DocumentOutline = ({ payload, showChrome = true }: DocumentOutlineP
435420 src = { image . url }
436421 alt = { image . altText ?? image . title ?? 'Table image' }
437422 data-testid = { `table-image-part-${ part . id } ` }
438- data-highlighted = { highlighted ? 'true' : 'false' }
439- data-hovered = { hovered ? 'true' : 'false' }
440423 onMouseEnter = { highlighted ? ( ) => setHoveredMappings ( mappingKeys ) : undefined }
441424 onMouseLeave = { highlighted ? ( ) => setHoveredMappings ( [ ] ) : undefined }
442425 style = { {
@@ -465,13 +448,7 @@ export const DocumentOutline = ({ payload, showChrome = true }: DocumentOutlineP
465448 < Box as = "span" style = { { whiteSpace : 'pre-wrap' } } >
466449 { textSegments . map ( ( seg , index ) => {
467450 const hovered = isMappingHovered ( seg . mappingKeys ) ;
468- return renderTextSegment (
469- `${ part . id } -${ index } ` ,
470- `table-text-segment-${ part . id } -${ index } ` ,
471- seg ,
472- hovered ,
473- setHoveredMappings
474- ) ;
451+ return renderTextSegment ( `${ part . id } -${ index } ` , seg , hovered , setHoveredMappings ) ;
475452 } ) }
476453 </ Box >
477454 ) ;
@@ -516,76 +493,72 @@ export const DocumentOutline = ({ payload, showChrome = true }: DocumentOutlineP
516493
517494 return (
518495 < Flex flexDirection = "column" gap = "spacingM" style = { { padding : tokens . spacingL } } >
519- { showChrome && (
520- // TODO: update this overview to use the overview section component
521- < Card padding = "default" style = { { border : `1px solid ${ tokens . gray300 } ` } } >
522- < Flex flexDirection = "column" gap = "spacingS" >
523- < Box >
524- < Text fontWeight = "fontWeightDemiBold" > Overview</ Text >
525- < Text as = "p" fontColor = "gray600" marginBottom = "none" >
526- Select an entry card to focus the document outline on that entry's mappings.
496+ { /* // TODO: update this overview to use the overview section component */ }
497+ < Card padding = "default" style = { { border : `1px solid ${ tokens . gray300 } ` } } >
498+ < Flex flexDirection = "column" gap = "spacingS" >
499+ < Box >
500+ < Text fontWeight = "fontWeightDemiBold" > Overview</ Text >
501+ < Text as = "p" fontColor = "gray600" marginBottom = "none" >
502+ Select an entry card to focus the document outline on that entry's mappings.
503+ </ Text >
504+ </ Box >
505+
506+ < Flex gap = "spacingS" flexWrap = "wrap" >
507+ < Box
508+ as = "button"
509+ type = "button"
510+ data-testid = "entry-overview-card-all"
511+ aria-pressed = { selectedEntryIndex === null }
512+ onClick = { ( ) => setSelectedEntryIndex ( null ) }
513+ style = { {
514+ display : 'flex' ,
515+ flexDirection : 'column' ,
516+ gap : tokens . spacing2Xs ,
517+ minWidth : 220 ,
518+ padding : tokens . spacingM ,
519+ borderRadius : tokens . borderRadiusMedium ,
520+ border : `1px solid ${
521+ selectedEntryIndex === null ? tokens . green500 : tokens . gray300
522+ } `,
523+ backgroundColor : selectedEntryIndex === null ? tokens . green100 : tokens . colorWhite ,
524+ textAlign : 'left' ,
525+ cursor : 'pointer' ,
526+ } } >
527+ < Text fontWeight = "fontWeightDemiBold" > All mappings</ Text >
528+ < Text as = "span" fontColor = "gray600" >
529+ Show every mapped entry in the document outline.
527530 </ Text >
528531 </ Box >
529532
530- < Flex gap = "spacingS" flexWrap = "wrap" >
531- < Box
532- as = "button"
533- type = "button"
534- data-testid = "entry-overview-card-all"
535- aria-pressed = { selectedEntryIndex === null }
536- onClick = { ( ) => setSelectedEntryIndex ( null ) }
537- style = { {
538- display : 'flex' ,
539- flexDirection : 'column' ,
540- gap : tokens . spacing2Xs ,
541- minWidth : 220 ,
542- padding : tokens . spacingM ,
543- borderRadius : tokens . borderRadiusMedium ,
544- border : `1px solid ${
545- selectedEntryIndex === null ? tokens . green500 : tokens . gray300
546- } `,
547- backgroundColor :
548- selectedEntryIndex === null ? tokens . green100 : tokens . colorWhite ,
549- textAlign : 'left' ,
550- cursor : 'pointer' ,
551- } } >
552- < Text fontWeight = "fontWeightDemiBold" > All mappings</ Text >
553- < Text as = "span" fontColor = "gray600" >
554- Show every mapped entry in the document outline.
555- </ Text >
556- </ Box >
557-
558- { overviewEntries . map ( ( entry ) => {
559- const isSelected = selectedEntryIndex === entry . entryIndex ;
560- return (
561- < Box
562- as = "button"
563- key = { entry . key }
564- type = "button"
565- data-testid = { `entry-overview-card-${ entry . key } ` }
566- aria-pressed = { isSelected }
567- onClick = { ( ) => setSelectedEntryIndex ( entry . entryIndex ) }
568- style = { {
569- display : 'flex' ,
570- flexDirection : 'column' ,
571- gap : tokens . spacing2Xs ,
572- minWidth : 220 ,
573- padding : tokens . spacingM ,
574- borderRadius : tokens . borderRadiusMedium ,
575- border : `1px solid ${ isSelected ? tokens . green500 : tokens . gray300 } ` ,
576- backgroundColor : isSelected ? tokens . green100 : tokens . colorWhite ,
577- textAlign : 'left' ,
578- cursor : 'pointer' ,
579- } } >
580- < Text fontWeight = "fontWeightDemiBold" > { entry . title } </ Text >
581- </ Box >
582- ) ;
583- } ) }
584- </ Flex >
533+ { overviewEntries . map ( ( entry ) => {
534+ const isSelected = selectedEntryIndex === entry . entryIndex ;
535+ return (
536+ < Box
537+ as = "button"
538+ key = { entry . key }
539+ type = "button"
540+ data-testid = { `entry-overview-card-${ entry . key } ` }
541+ aria-pressed = { isSelected }
542+ onClick = { ( ) => setSelectedEntryIndex ( entry . entryIndex ) }
543+ style = { {
544+ display : 'flex' ,
545+ flexDirection : 'column' ,
546+ gap : tokens . spacing2Xs ,
547+ minWidth : 220 ,
548+ padding : tokens . spacingM ,
549+ borderRadius : tokens . borderRadiusMedium ,
550+ border : `1px solid ${ isSelected ? tokens . green500 : tokens . gray300 } ` ,
551+ backgroundColor : isSelected ? tokens . green100 : tokens . colorWhite ,
552+ textAlign : 'left' ,
553+ cursor : 'pointer' ,
554+ } } >
555+ < Text fontWeight = "fontWeightDemiBold" > { entry . title } </ Text >
556+ </ Box >
557+ ) ;
558+ } ) }
585559 </ Flex >
586- </ Card >
587- ) }
588-
560+ </ Flex >
561+ </ Card >
589562 < Flex
590563 flexDirection = "column"
591564 gap = "spacingS"
0 commit comments