File tree Expand file tree Collapse file tree 7 files changed +21
-13
lines changed
reader/components/resource-annotation/Dialog Expand file tree Collapse file tree 7 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ class ResourceSlideshow extends PureComponent {
196196 resource = { slide }
197197 aspectRatio = "16 / 9"
198198 loading = { ! this . isLoaded ( index ) }
199+ active = { index === position - 1 }
199200 />
200201 </ Styled . Slide >
201202 ) ) ;
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ function ResourceMediaFactory({
99 loading = false ,
1010 aspectRatio,
1111 roundedCorners,
12- enableZoom : enableZoomProp = false
12+ enableZoom : enableZoomProp = false ,
13+ active
1314} ) {
1415 if ( loading )
1516 return (
@@ -33,7 +34,11 @@ function ResourceMediaFactory({
3334 return (
3435 < Styled . Wrapper $aspectRatio = { aspectRatio } $roundedCorners = { roundedCorners } >
3536 { enableZoom && < Zoom resource = { resource } /> }
36- < KindComponent resource = { resource } fixedAspectRatio = { ! ! aspectRatio } />
37+ < KindComponent
38+ resource = { resource }
39+ fixedAspectRatio = { ! ! aspectRatio }
40+ active = { active }
41+ />
3742 </ Styled . Wrapper >
3843 ) ;
3944}
@@ -45,7 +50,8 @@ ResourceMediaFactory.propTypes = {
4550 loading : PropTypes . bool ,
4651 aspectRatio : PropTypes . string ,
4752 roundedCorners : PropTypes . bool ,
48- enableZoom : PropTypes . bool
53+ enableZoom : PropTypes . bool ,
54+ active : PropTypes . bool
4955} ;
5056
5157export default ResourceMediaFactory ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ function urlToRelativePath(url) {
1111 return trackUrl . pathname ;
1212}
1313
14- function ResourcePlayerAudio ( { resource } ) {
14+ function ResourcePlayerAudio ( { resource, active = true } ) {
1515 const {
1616 attachmentStyles,
1717 title,
@@ -22,7 +22,7 @@ function ResourcePlayerAudio({ resource }) {
2222
2323 const src = attachmentStyles . original ;
2424
25- if ( ! src ) return null ;
25+ if ( ! src || ! active ) return null ;
2626
2727 const tracks =
2828 resource . relationships ?. textTracks
Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ function getSrc(resource) {
2222 }
2323}
2424
25- export default function ExternalVideo ( { resource } ) {
25+ export default function ExternalVideo ( { resource, active = true } ) {
2626 const src = getSrc ( resource ) ;
2727
28- if ( ! src ) return null ;
28+ if ( ! src || ! active ) return null ;
2929
3030 const { title, externalType } = resource . attributes ;
3131
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ function urlToRelativePath(url) {
88 return trackUrl . pathname ;
99}
1010
11- function ResourceMediaVideoInternal ( { resource } ) {
11+ function ResourceMediaVideoInternal ( { resource, active = true } ) {
1212 const {
1313 variantPosterStyles,
1414 variantThumbnailStyles,
@@ -19,7 +19,7 @@ function ResourceMediaVideoInternal({ resource }) {
1919
2020 const src = attachmentStyles . original ;
2121
22- if ( ! src ) return null ;
22+ if ( ! src || ! active ) return null ;
2323
2424 const poster =
2525 variantPosterStyles . mediumLandscape ??
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ import PropTypes from "prop-types";
22import ExternalVideo from "./ExternalVideo" ;
33import InternalVideo from "./InternalVideo" ;
44
5- function ResourceMediaVideo ( { resource } ) {
5+ function ResourceMediaVideo ( { resource, active } ) {
66 const VideoComponent =
77 resource . attributes . subKind === "external_video"
88 ? ExternalVideo
99 : InternalVideo ;
1010
11- return < VideoComponent resource = { resource } /> ;
11+ return < VideoComponent resource = { resource } active = { active } /> ;
1212}
1313
1414ResourceMediaVideo . displayName = "Resource.Media.Video" ;
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export default function ResourceAnnotationDialog({
77 resource,
88 textId,
99 destroyAnnotation,
10+ open,
1011 ...dialog
1112} ) {
1213 const resourceEntity = useFromStore ( {
@@ -30,8 +31,8 @@ export default function ResourceAnnotationDialog({
3031 ) ;
3132
3233 return (
33- < Dialog title = { resourceEntity ?. attributes . title } { ...dialog } >
34- { resourceEntity ? renderPreview : null }
34+ < Dialog title = { resourceEntity ?. attributes . title } open = { open } { ...dialog } >
35+ { open && renderPreview }
3536 </ Dialog >
3637 ) ;
3738}
You can’t perform that action at this time.
0 commit comments