Skip to content

Commit c474cc9

Browse files
committed
Use context to pass the window id around
1 parent e0cfcc7 commit c474cc9

81 files changed

Lines changed: 250 additions & 140 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/components/AnnotationSettings.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ AnnotationSettings.propTypes = {
3535
displayAllDisabled: PropTypes.bool.isRequired,
3636
t: PropTypes.func.isRequired,
3737
toggleAnnotationDisplay: PropTypes.func.isRequired,
38-
windowId: PropTypes.string.isRequired, // eslint-disable-line react/no-unused-prop-types
3938
};

src/components/AttributionPanel.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class AttributionPanel extends Component {
2222
manifestLogo,
2323
requiredStatement,
2424
rights,
25-
windowId,
2625
id,
2726
classes,
2827
t,
@@ -32,7 +31,6 @@ export class AttributionPanel extends Component {
3231
<CompanionWindow
3332
title={t('attributionTitle')}
3433
paperClassName={ns('attribution-panel')}
35-
windowId={windowId}
3634
id={id}
3735
>
3836
<div className={classes.section}>
@@ -85,7 +83,6 @@ AttributionPanel.propTypes = {
8583
})),
8684
rights: PropTypes.arrayOf(PropTypes.string),
8785
t: PropTypes.func,
88-
windowId: PropTypes.string.isRequired,
8986
};
9087

9188
AttributionPanel.defaultProps = {

src/components/CompanionArea.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class CompanionArea extends Component {
6161
<div className={[ns('companion-windows'), companionWindowIds.length > 0 && classes[position], this.areaLayoutClass()].join(' ')} style={{ display: companionAreaOpen ? 'flex' : 'none' }}>
6262
{
6363
companionWindowIds.map(id => (
64-
<CompanionWindowFactory id={id} key={id} windowId={windowId} />
64+
<CompanionWindowFactory id={id} key={id} />
6565
))
6666
}
6767
</div>

src/components/CompanionWindowFactory.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export class CompanionWindowFactory extends Component {
4040
render() {
4141
const {
4242
content,
43-
windowId,
4443
id,
4544
t,
4645
} = this.props;
@@ -50,10 +49,9 @@ export class CompanionWindowFactory extends Component {
5049
return (
5150
<CompanionWindow
5251
title={t('error')}
53-
windowId={windowId}
5452
id={id}
5553
>
56-
<ErrorContent error={error} windowId={windowId} companionWindowId={id} />
54+
<ErrorContent error={error} companionWindowId={id} />
5755
</CompanionWindow>
5856
);
5957
}
@@ -62,15 +60,14 @@ export class CompanionWindowFactory extends Component {
6260

6361
if (!type) return null;
6462

65-
return createElement(type, { id, windowId });
63+
return createElement(type, { id });
6664
}
6765
}
6866

6967
CompanionWindowFactory.propTypes = {
7068
content: PropTypes.string,
7169
id: PropTypes.string.isRequired,
7270
t: PropTypes.func,
73-
windowId: PropTypes.string.isRequired,
7471
};
7572

7673
CompanionWindowFactory.defaultProps = {

src/components/CustomPanel.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ export class CustomPanel extends Component {
1515
children,
1616
t,
1717
title,
18-
windowId,
1918
} = this.props;
2019

2120
return (
2221
<CompanionWindow
2322
title={t(title)}
2423
id={id}
25-
windowId={windowId}
2624
>
2725
{children}
2826
</CompanionWindow>
@@ -35,7 +33,6 @@ CustomPanel.propTypes = {
3533
id: PropTypes.string.isRequired,
3634
t: PropTypes.func.isRequired,
3735
title: PropTypes.string.isRequired,
38-
windowId: PropTypes.string.isRequired,
3936
};
4037

4138
CustomPanel.defaultProps = {

src/components/GalleryView.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class GalleryView extends Component {
1212
*/
1313
render() {
1414
const {
15-
canvases, classes, viewingDirection, windowId,
15+
canvases, classes, viewingDirection,
1616
} = this.props;
1717
const htmlDir = viewingDirection === 'right-to-left' ? 'rtl' : 'ltr';
1818
return (
@@ -22,13 +22,11 @@ export class GalleryView extends Component {
2222
square
2323
elevation={0}
2424
className={classes.galleryContainer}
25-
id={`${windowId}-gallery`}
2625
>
2726
{
2827
canvases.map(canvas => (
2928
<GalleryViewThumbnail
3029
key={canvas.id}
31-
windowId={windowId}
3230
canvas={canvas}
3331
/>
3432
))
@@ -42,7 +40,6 @@ GalleryView.propTypes = {
4240
canvases: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
4341
classes: PropTypes.objectOf(PropTypes.string),
4442
viewingDirection: PropTypes.string,
45-
windowId: PropTypes.string.isRequired,
4643
};
4744

4845
GalleryView.defaultProps = {

src/components/IIIFAuthentication.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ export class IIIFAuthentication extends Component {
2828
/** */
2929
defaultAuthBarProps() {
3030
const {
31-
authServiceId, windowId, status, logoutServiceId,
31+
authServiceId, status, logoutServiceId,
3232
} = this.props;
3333

3434
return {
3535
authServiceId,
3636
hasLogoutService: !!logoutServiceId,
3737
status,
38-
windowId,
3938
};
4039
}
4140

src/components/LayersPanel.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,19 @@ export class LayersPanel extends Component {
1515
canvasIds,
1616
id,
1717
t,
18-
windowId,
1918
} = this.props;
2019

2120
return (
2221
<CompanionWindow
2322
title={t('layers')}
2423
id={id}
25-
windowId={windowId}
2624
>
2725
{canvasIds.map((canvasId, index) => (
2826
<CanvasLayers
2927
canvasId={canvasId}
3028
index={index}
3129
key={canvasId}
3230
totalSize={canvasIds.length}
33-
windowId={windowId}
3431
/>
3532
))}
3633
</CompanionWindow>
@@ -42,7 +39,6 @@ LayersPanel.propTypes = {
4239
canvasIds: PropTypes.arrayOf(PropTypes.string),
4340
id: PropTypes.string.isRequired,
4441
t: PropTypes.func.isRequired,
45-
windowId: PropTypes.string.isRequired,
4642
};
4743

4844
LayersPanel.defaultProps = {

src/components/OpenSeadragonViewer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ export class OpenSeadragonViewer extends Component {
374374
aria-live="polite"
375375
>
376376
{ drawAnnotations
377-
&& <AnnotationsOverlay viewer={viewer} windowId={windowId} /> }
377+
&& <AnnotationsOverlay viewer={viewer} /> }
378378
{ enhancedChildren }
379379
<PluginHook viewer={viewer} {...{ ...this.props, children: null }} />
380380
</section>

src/components/PrimaryWindow.js

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,31 @@ export class PrimaryWindow extends Component {
2929
renderViewer() {
3030
const {
3131
audioResources, isCollection,
32-
isFetching, videoResources, view, windowId,
32+
isFetching, videoResources, view,
3333
} = this.props;
3434
if (isCollection) {
3535
return (
36-
<SelectCollection
37-
windowId={windowId}
38-
/>
36+
<SelectCollection />
3937
);
4038
}
4139
if (isFetching === false) {
4240
if (view === 'gallery') {
4341
return (
44-
<GalleryView
45-
windowId={windowId}
46-
/>
42+
<GalleryView />
4743
);
4844
}
4945
if (videoResources.length > 0) {
5046
return (
51-
<VideoViewer
52-
windowId={windowId}
53-
/>
47+
<VideoViewer />
5448
);
5549
}
5650
if (audioResources.length > 0) {
5751
return (
58-
<AudioViewer
59-
windowId={windowId}
60-
/>
52+
<AudioViewer />
6153
);
6254
}
6355
return (
64-
<WindowViewer
65-
windowId={windowId}
66-
/>
56+
<WindowViewer />
6757
);
6858
}
6959
return null;
@@ -74,13 +64,13 @@ export class PrimaryWindow extends Component {
7464
*/
7565
render() {
7666
const {
77-
isCollectionDialogVisible, windowId, classes, children,
67+
isCollectionDialogVisible, classes, children,
7868
} = this.props;
7969
return (
8070
<div className={classNames(ns('primary-window'), classes.primaryWindow)}>
81-
<WindowSideBar windowId={windowId} />
82-
<CompanionArea windowId={windowId} position="left" />
83-
{ isCollectionDialogVisible && <CollectionDialog windowId={windowId} /> }
71+
<WindowSideBar />
72+
<CompanionArea position="left" />
73+
{ isCollectionDialogVisible && <CollectionDialog /> }
8474
<Suspense fallback={<div />}>
8575
{children || this.renderViewer()}
8676
</Suspense>
@@ -98,7 +88,6 @@ PrimaryWindow.propTypes = {
9888
isFetching: PropTypes.bool,
9989
videoResources: PropTypes.arrayOf(PropTypes.object), // eslint-disable-line react/forbid-prop-types
10090
view: PropTypes.string,
101-
windowId: PropTypes.string.isRequired,
10291
};
10392

10493
PrimaryWindow.defaultProps = {

0 commit comments

Comments
 (0)