diff --git a/.eslintrc b/.eslintrc
index d8bada02e19bcd9e06770677277fe90e1441fa48..b3caa59e110484e128762039cca9c1c5c0645099 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -22,6 +22,10 @@
"FunctionExpression": true
}
}],
- "react/prefer-stateless-function": "off"
+ "react/prefer-stateless-function": "off",
+ "sort-keys": ["error", "asc", {
+ "caseSensitive": false,
+ "natural": false
+ }]
}
}
diff --git a/__tests__/src/actions/annotation.test.js b/__tests__/src/actions/annotation.test.js
index 5428ce0532b4855fa4043cbd127c8929df04e779..9fa121314345b333aebfd18c4079d8598ebb0709 100644
--- a/__tests__/src/actions/annotation.test.js
+++ b/__tests__/src/actions/annotation.test.js
@@ -13,9 +13,9 @@ describe('annotation actions', () => {
const canvasId = 'foo';
const annotationId = 'abc123';
const expectedAction = {
- type: ActionTypes.REQUEST_ANNOTATION,
- canvasId,
annotationId,
+ canvasId,
+ type: ActionTypes.REQUEST_ANNOTATION,
};
expect(actions.requestAnnotation(canvasId, annotationId)).toEqual(expectedAction);
});
@@ -29,10 +29,10 @@ describe('annotation actions', () => {
content: 'annotation request',
};
const expectedAction = {
- type: ActionTypes.RECEIVE_ANNOTATION,
- canvasId,
annotationId,
annotationJson: json,
+ canvasId,
+ type: ActionTypes.RECEIVE_ANNOTATION,
};
expect(actions.receiveAnnotation(canvasId, annotationId, json)).toEqual(expectedAction);
});
@@ -53,8 +53,8 @@ describe('annotation actions', () => {
));
expect(store.getActions()).toEqual([
{
- canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
annotationId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896',
+ canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
type: 'REQUEST_ANNOTATION',
},
]);
@@ -68,14 +68,14 @@ describe('annotation actions', () => {
const expectedActions = store.getActions();
expect(expectedActions).toEqual([
{
- canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
annotationId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896',
+ canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
type: 'REQUEST_ANNOTATION',
},
{
- canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
annotationId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896',
annotationJson: { data: '12345' },
+ canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
type: 'RECEIVE_ANNOTATION',
},
]);
@@ -92,13 +92,13 @@ describe('annotation actions', () => {
const expectedActions = store.getActions();
expect(expectedActions).toEqual([
{
- canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
annotationId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896',
+ canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
type: 'REQUEST_ANNOTATION',
},
{
- canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
annotationId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/list/47174896',
+ canvasId: 'https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174896',
error: new Error('invalid json response body at undefined reason: Unexpected end of JSON input'),
type: 'RECEIVE_ANNOTATION_FAILURE',
},
@@ -113,10 +113,10 @@ describe('annotation actions', () => {
const canvasId = 'cId1';
const annotationId = 'aId1';
const expectedAction = {
+ annotationId,
+ canvasId,
type: ActionTypes.SELECT_ANNOTATION,
windowId,
- canvasId,
- annotationId,
};
expect(actions.selectAnnotation(windowId, canvasId, annotationId)).toEqual(expectedAction);
});
@@ -126,10 +126,10 @@ describe('annotation actions', () => {
const canvasId = 'cId1';
const annotationId = 'aId1';
const expectedAction = {
+ annotationId,
+ canvasId,
type: ActionTypes.DESELECT_ANNOTATION,
windowId,
- canvasId,
- annotationId,
};
expect(actions.deselectAnnotation(windowId, canvasId, annotationId)).toEqual(expectedAction);
});
diff --git a/__tests__/src/actions/canvas.test.js b/__tests__/src/actions/canvas.test.js
index 571c3c6b40ee5c24dfd6f3010c7d41abc91a9c1c..31dd34f26f4b398fcc51dafc951fe8de975079bc 100644
--- a/__tests__/src/actions/canvas.test.js
+++ b/__tests__/src/actions/canvas.test.js
@@ -8,9 +8,9 @@ describe('canvas actions', () => {
it('sets to a defined canvas', () => {
const id = 'abc123';
const expectedAction = {
+ canvasIndex: 100,
type: ActionTypes.SET_CANVAS,
windowId: id,
- canvasIndex: 100,
};
expect(actions.setCanvas(id, 100)).toEqual(expectedAction);
});
@@ -24,13 +24,13 @@ describe('canvas actions', () => {
time: debounceTime,
},
},
- type: ActionTypes.UPDATE_VIEWPORT,
- windowId: id,
payload: {
x: 1,
y: 0,
zoom: 0.5,
},
+ type: ActionTypes.UPDATE_VIEWPORT,
+ windowId: id,
};
expect(actions.updateViewport(id, { x: 1, y: 0, zoom: 0.5 })).toEqual(expectedAction);
});
diff --git a/__tests__/src/actions/companionWindow.test.js b/__tests__/src/actions/companionWindow.test.js
index 0e7a1df61a78a41829ee8243f8ea8825d870fc3b..23633844fa2ec9b51987f76ac6d254acab4614a6 100644
--- a/__tests__/src/actions/companionWindow.test.js
+++ b/__tests__/src/actions/companionWindow.test.js
@@ -6,14 +6,14 @@ describe('companionWindow actions', () => {
it('should return correct action object', () => {
const payload = {
content: 'info',
- position: 'right',
foo: 'bar',
+ position: 'right',
};
const mockState = {
+ companionWindows: {},
windows: {
abc123: { companionWindowIds: [] },
},
- companionWindows: {},
};
const mockDispatch = jest.fn(() => ({}));
@@ -33,10 +33,10 @@ describe('companionWindow actions', () => {
const defaults = { foo: 'bar' };
const mockState = {
+ companionWindows: {},
windows: {
abc123: { companionWindowIds: [] },
},
- companionWindows: {},
};
const mockDispatch = jest.fn(() => ({}));
@@ -53,10 +53,10 @@ describe('companionWindow actions', () => {
const payload = {};
const mockState = {
+ companionWindows: {},
windows: {
abc123: { companionWindowIds: [] },
},
- companionWindows: {},
};
const mockDispatch = jest.fn(() => ({}));
@@ -76,8 +76,8 @@ describe('companionWindow actions', () => {
it('should return correct action object', () => {
const payload = {
content: 'info',
- position: 'right',
foo: 'bar',
+ position: 'right',
};
const action = actions.updateCompanionWindow('abc123', 'cw-123', payload);
diff --git a/__tests__/src/actions/config.test.js b/__tests__/src/actions/config.test.js
index a05a460b0d79f1eca970ed768343bfad90ef03cc..f75d604d7a2ba9a0a3b832eb3c0948ffc205c857 100644
--- a/__tests__/src/actions/config.test.js
+++ b/__tests__/src/actions/config.test.js
@@ -6,8 +6,8 @@ describe('config actions', () => {
it('sets the config', () => {
const config = { foo: 'bar' };
const expectedAction = {
- type: ActionTypes.SET_CONFIG,
config,
+ type: ActionTypes.SET_CONFIG,
};
expect(actions.setConfig(config)).toEqual(expectedAction);
});
@@ -16,8 +16,8 @@ describe('config actions', () => {
it('updates the config', () => {
const config = { foo: 'bar' };
const expectedAction = {
- type: ActionTypes.UPDATE_CONFIG,
config,
+ type: ActionTypes.UPDATE_CONFIG,
};
expect(actions.updateConfig(config)).toEqual(expectedAction);
});
diff --git a/__tests__/src/actions/infoResponse.test.js b/__tests__/src/actions/infoResponse.test.js
index 6c67429da6bad30dfa19861d278b476e01d04e7e..7b5883e78ccbeb2ebfabccc32b5f0fad11aacf71 100644
--- a/__tests__/src/actions/infoResponse.test.js
+++ b/__tests__/src/actions/infoResponse.test.js
@@ -12,8 +12,8 @@ describe('infoResponse actions', () => {
it('requests an infoResponse from given a url', () => {
const id = 'abc123';
const expectedAction = {
- type: ActionTypes.REQUEST_INFO_RESPONSE,
infoId: id,
+ type: ActionTypes.REQUEST_INFO_RESPONSE,
};
expect(actions.requestInfoResponse(id)).toEqual(expectedAction);
});
@@ -22,13 +22,13 @@ describe('infoResponse actions', () => {
it('recieves an infoResponse', () => {
const id = 'abc123';
const json = {
- id,
content: 'image information request',
+ id,
};
const expectedAction = {
- type: ActionTypes.RECEIVE_INFO_RESPONSE,
infoId: id,
infoJson: json,
+ type: ActionTypes.RECEIVE_INFO_RESPONSE,
};
expect(actions.receiveInfoResponse(id, json)).toEqual(expectedAction);
});
@@ -66,7 +66,7 @@ describe('infoResponse actions', () => {
const expectedActions = store.getActions();
expect(expectedActions).toEqual([
{ infoId: 'https://stacks.stanford.edu/image/iiif/sn904cj3429%2F12027000/info.json', type: 'REQUEST_INFO_RESPONSE' },
- { infoId: 'https://stacks.stanford.edu/image/iiif/sn904cj3429%2F12027000/info.json', error: new Error('invalid json response body at undefined reason: Unexpected end of JSON input'), type: 'RECEIVE_INFO_RESPONSE_FAILURE' },
+ { error: new Error('invalid json response body at undefined reason: Unexpected end of JSON input'), infoId: 'https://stacks.stanford.edu/image/iiif/sn904cj3429%2F12027000/info.json', type: 'RECEIVE_INFO_RESPONSE_FAILURE' },
]);
});
});
@@ -75,8 +75,8 @@ describe('infoResponse actions', () => {
describe('removeInfoResponse', () => {
it('removes an existing infoResponse', () => {
const expectedAction = {
- type: ActionTypes.REMOVE_INFO_RESPONSE,
infoId: 'foo',
+ type: ActionTypes.REMOVE_INFO_RESPONSE,
};
expect(actions.removeInfoResponse('foo')).toEqual(expectedAction);
});
diff --git a/__tests__/src/actions/manifest.test.js b/__tests__/src/actions/manifest.test.js
index 5a14bc491542468961c679b810b7f17c5a5cdc3a..dbbd0a73465baea21b1a93628d05cc98c3e0815e 100644
--- a/__tests__/src/actions/manifest.test.js
+++ b/__tests__/src/actions/manifest.test.js
@@ -12,8 +12,8 @@ describe('manifest actions', () => {
it('requests a manifest given a url', () => {
const id = 'abc123';
const expectedAction = {
- type: ActionTypes.REQUEST_MANIFEST,
manifestId: id,
+ type: ActionTypes.REQUEST_MANIFEST,
};
expect(actions.requestManifest(id)).toEqual(expectedAction);
});
@@ -22,13 +22,13 @@ describe('manifest actions', () => {
it('receives a manifest', () => {
const id = 'abc123';
const json = {
- id,
content: 'lots of metadata, canvases, and other IIIFy things',
+ id,
};
const expectedAction = {
- type: ActionTypes.RECEIVE_MANIFEST,
manifestId: id,
manifestJson: json,
+ type: ActionTypes.RECEIVE_MANIFEST,
};
expect(actions.receiveManifest(id, json)).toEqual(expectedAction);
});
@@ -45,7 +45,11 @@ describe('manifest actions', () => {
it('dispatches the REQUEST_MANIFEST action', () => {
store.dispatch(actions.fetchManifest('https://purl.stanford.edu/sn904cj3429/iiif/manifest'));
expect(store.getActions()).toEqual([
- { manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest', type: 'REQUEST_MANIFEST', properties: { isFetching: true } },
+ {
+ manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
+ properties: { isFetching: true },
+ type: 'REQUEST_MANIFEST',
+ },
]);
});
it('dispatches the REQUEST_MANIFEST and then RECEIVE_MANIFEST', () => {
@@ -53,8 +57,16 @@ describe('manifest actions', () => {
.then(() => {
const expectedActions = store.getActions();
expect(expectedActions).toEqual([
- { manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest', type: 'REQUEST_MANIFEST', properties: { isFetching: true } },
- { manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest', manifestJson: { data: '12345' }, type: 'RECEIVE_MANIFEST' },
+ {
+ manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
+ properties: { isFetching: true },
+ type: 'REQUEST_MANIFEST',
+ },
+ {
+ manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
+ manifestJson: { data: '12345' },
+ type: 'RECEIVE_MANIFEST',
+ },
]);
});
});
@@ -65,8 +77,16 @@ describe('manifest actions', () => {
.then(() => {
const expectedActions = store.getActions();
expect(expectedActions).toEqual([
- { manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest', type: 'REQUEST_MANIFEST', properties: { isFetching: true } },
- { manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest', error: 'FetchError: invalid json response body at undefined reason: Unexpected end of JSON input', type: 'RECEIVE_MANIFEST_FAILURE' },
+ {
+ manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
+ properties: { isFetching: true },
+ type: 'REQUEST_MANIFEST',
+ },
+ {
+ error: 'FetchError: invalid json response body at undefined reason: Unexpected end of JSON input',
+ manifestId: 'https://purl.stanford.edu/sn904cj3429/iiif/manifest',
+ type: 'RECEIVE_MANIFEST_FAILURE',
+ },
]);
});
});
@@ -75,8 +95,8 @@ describe('manifest actions', () => {
describe('removeManifest', () => {
it('removes an existing manifest', () => {
const expectedAction = {
- type: ActionTypes.REMOVE_MANIFEST,
manifestId: 'foo',
+ type: ActionTypes.REMOVE_MANIFEST,
};
expect(actions.removeManifest('foo')).toEqual(expectedAction);
});
diff --git a/__tests__/src/actions/window.test.js b/__tests__/src/actions/window.test.js
index 5c170a0d8b92734392095bcc4f91c8e37d525f1e..813bf86151794af41259944dfc6ba364b113a395 100644
--- a/__tests__/src/actions/window.test.js
+++ b/__tests__/src/actions/window.test.js
@@ -5,22 +5,25 @@ describe('window actions', () => {
describe('focusWindow', () => {
it('should return correct action object with pan=true', () => {
const expectedAction = {
+ position: { x: 25, y: -13 },
type: ActionTypes.FOCUS_WINDOW,
windowId: 'window',
- position: { x: 25, y: -13 },
};
const mockState = {
+ companionWindows: {},
windows: {
window: {
- x: 50, y: 12, width: 50, height: 50,
+ height: 50,
+ width: 50,
+ x: 50,
+ y: 12,
},
},
- companionWindows: {},
workspace: {
viewportPosition: {
- width: 100,
height: 100,
+ width: 100,
},
},
};
@@ -36,16 +39,16 @@ describe('window actions', () => {
});
it('should return correct action object with pan=false', () => {
const expectedAction = {
+ position: {},
type: ActionTypes.FOCUS_WINDOW,
windowId: 'window',
- position: {},
};
const mockState = {
+ companionWindows: {},
windows: {
window: { x: 50, y: 12 },
},
- companionWindows: {},
};
const mockDispatch = jest.fn(() => ({}));
@@ -62,31 +65,37 @@ describe('window actions', () => {
describe('addWindow', () => {
it('should create a new window with merged defaults', () => {
const options = {
- id: 'helloworld',
canvasIndex: 1,
+ id: 'helloworld',
};
const expectedAction = {
+ companionWindows: [
+ {
+ content: 'info',
+ position: 'left',
+ },
+ {
+ content: 'thumbnail_navigation',
+ position: 'far-bottom',
+ },
+ ],
type: ActionTypes.ADD_WINDOW,
window: {
- id: 'helloworld',
canvasIndex: 1,
collectionIndex: 0,
+ height: 400,
+ id: 'helloworld',
manifestId: null,
maximized: false,
rangeId: null,
- x: 260,
- y: 300,
- sideBarPanel: 'info',
- width: 400,
- height: 400,
rotation: null,
+ sideBarPanel: 'info',
view: 'single',
+ width: 400,
+ x: 260,
+ y: 300,
},
- companionWindows: [
- { position: 'left', content: 'info' },
- { position: 'far-bottom', content: 'thumbnail_navigation' },
- ],
};
const mockState = {
@@ -112,8 +121,8 @@ describe('window actions', () => {
describe('updateWindow', () => {
it('should return correct action object', () => {
const payload = {
- foo: 1,
bar: 2,
+ foo: 1,
};
const action = actions.updateWindow('window-123', payload);
expect(action.type).toBe(ActionTypes.UPDATE_WINDOW);
@@ -126,16 +135,16 @@ describe('window actions', () => {
it('removes the window and returns windowId', () => {
const id = 'abc123';
const expectedAction = {
+ companionWindowIds: ['a', 'b', 'c'],
type: ActionTypes.REMOVE_WINDOW,
windowId: id,
- companionWindowIds: ['a', 'b', 'c'],
};
const mockState = {
+ companionWindows: {},
windows: {
abc123: { companionWindowIds: ['a', 'b', 'c'] },
},
- companionWindows: {},
};
const mockDispatch = jest.fn(() => ({}));
@@ -186,9 +195,9 @@ describe('window actions', () => {
it('returns the appropriate action type', () => {
const id = 'abc123';
const expectedAction = {
- type: ActionTypes.UPDATE_WINDOW,
id,
payload: { companionAreaOpen: true },
+ type: ActionTypes.UPDATE_WINDOW,
};
expect(actions.setCompanionAreaOpen(id, true)).toEqual(expectedAction);
});
@@ -200,9 +209,9 @@ describe('window actions', () => {
const id = 'abc123';
const expectedAction = {
- type: ActionTypes.UPDATE_COMPANION_WINDOW,
id,
payload: { position: 'right' },
+ type: ActionTypes.UPDATE_COMPANION_WINDOW,
};
const mockState = {
@@ -227,8 +236,8 @@ describe('window actions', () => {
const id = 'abc123';
const expectedAction = {
type: ActionTypes.SET_WINDOW_VIEW_TYPE,
- windowId: id,
viewType: 'book',
+ windowId: id,
};
expect(actions.setWindowViewType(id, 'book')).toEqual(expectedAction);
});
@@ -239,9 +248,9 @@ describe('window actions', () => {
const windowId = 'abc123';
const panelType = 'panelType';
const expectedAction = {
+ panelType,
type: ActionTypes.SET_WINDOW_SIDE_BAR_PANEL,
windowId,
- panelType,
};
expect(actions.setWindowSideBarPanel(windowId, 'panelType')).toEqual(expectedAction);
});
@@ -251,22 +260,22 @@ describe('window actions', () => {
it('returns the appropriate action type', () => {
const id = 'abc123';
const expectedAction = {
- type: ActionTypes.SET_WINDOW_SIZE,
payload: {
- windowId: id,
size: {
+ height: 200,
+ width: 200,
x: 20,
y: 20,
- width: 200,
- height: 200,
},
+ windowId: id,
},
+ type: ActionTypes.SET_WINDOW_SIZE,
};
expect(actions.setWindowSize(id, {
+ height: 200,
+ width: 200,
x: 20,
y: 20,
- width: 200,
- height: 200,
})).toEqual(expectedAction);
});
});
@@ -275,14 +284,14 @@ describe('window actions', () => {
it('returns the appropriate action type', () => {
const id = 'abc123';
const expectedAction = {
- type: ActionTypes.UPDATE_WINDOW_POSITION,
payload: {
- windowId: id,
position: {
x: 20,
y: 20,
},
+ windowId: id,
},
+ type: ActionTypes.UPDATE_WINDOW_POSITION,
};
expect(actions.updateWindowPosition(id, {
x: 20,
diff --git a/__tests__/src/actions/workspace.test.js b/__tests__/src/actions/workspace.test.js
index d20bc614439432f04892cae4ff205992772edc85..bee998d415e8f99c6053e41a98191b214662d8a7 100644
--- a/__tests__/src/actions/workspace.test.js
+++ b/__tests__/src/actions/workspace.test.js
@@ -6,16 +6,16 @@ describe('workspace actions', () => {
it('should return correct action type if set to true', () => {
const receivedAction = actions.setWorkspaceFullscreen(true);
const expectedAction = {
- type: ActionTypes.SET_WORKSPACE_FULLSCREEN,
isFullscreenEnabled: true,
+ type: ActionTypes.SET_WORKSPACE_FULLSCREEN,
};
expect(receivedAction).toEqual(expectedAction);
});
it('should return correct action type if set to false', () => {
const receivedAction = actions.setWorkspaceFullscreen(false);
const expectedAction = {
- type: ActionTypes.SET_WORKSPACE_FULLSCREEN,
isFullscreenEnabled: false,
+ type: ActionTypes.SET_WORKSPACE_FULLSCREEN,
};
expect(receivedAction).toEqual(expectedAction);
});
@@ -25,8 +25,8 @@ describe('workspace actions', () => {
const options = { foo: 'bar' };
const expectedAction = {
- type: ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT,
layout: { foo: 'bar' },
+ type: ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT,
};
expect(actions.updateWorkspaceMosaicLayout(options)).toEqual(expectedAction);
});
@@ -34,8 +34,8 @@ describe('workspace actions', () => {
describe('toggleZoomControls', () => {
it('should set the zoom control visibility', () => {
const expectedAction = {
- type: ActionTypes.TOGGLE_ZOOM_CONTROLS,
showZoomControls: true,
+ type: ActionTypes.TOGGLE_ZOOM_CONTROLS,
};
expect(actions.toggleZoomControls(true)).toEqual(expectedAction);
});
@@ -43,8 +43,8 @@ describe('workspace actions', () => {
describe('setWorkspaceAddVisibility', () => {
it('should set the workspace add visibility', () => {
const expectedAction = {
- type: ActionTypes.SET_WORKSPACE_ADD_VISIBILITY,
isWorkspaceAddVisible: true,
+ type: ActionTypes.SET_WORKSPACE_ADD_VISIBILITY,
};
expect(actions.setWorkspaceAddVisibility(true)).toEqual(expectedAction);
});
@@ -52,30 +52,30 @@ describe('workspace actions', () => {
describe('setWorkspaceViewportDimensions', () => {
it('should set the workspace add visibility', () => {
const expectedAction = {
- type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
payload: {
position: {
- width: 20,
height: 25,
+ width: 20,
},
},
+ type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
};
expect(actions.setWorkspaceViewportDimensions({
- width: 20,
height: 25,
+ width: 20,
})).toEqual(expectedAction);
});
});
describe('setWorkspaceViewportPosition', () => {
it('should set the workspace add visibility', () => {
const expectedAction = {
- type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
payload: {
position: {
x: 20,
y: 20,
},
},
+ type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
};
expect(actions.setWorkspaceViewportPosition({
x: 20,
diff --git a/__tests__/src/components/CanvasThumbnail.test.js b/__tests__/src/components/CanvasThumbnail.test.js
index 9590dd3fa66ed87cdb55da6850c68cbada1f5a97..0404b4865ca7bd22749d0c4644874052ef2db416 100644
--- a/__tests__/src/components/CanvasThumbnail.test.js
+++ b/__tests__/src/components/CanvasThumbnail.test.js
@@ -59,10 +59,18 @@ describe('CanvasThumbnail', () => {
});
it('can be constrained by maxWidth and maxHeight and a desired aspect ratio', () => {
- wrapper = createWrapper({ maxHeight: 400, maxWidth: 500, aspectRatio: 2 });
+ wrapper = createWrapper({
+ aspectRatio: 2,
+ maxHeight: 400,
+ maxWidth: 500,
+ });
expect(wrapper.find('img').props().style).toMatchObject({ height: 250, width: 500 });
- wrapper = createWrapper({ maxHeight: 400, maxWidth: 500, aspectRatio: 1 });
+ wrapper = createWrapper({
+ aspectRatio: 1,
+ maxHeight: 400,
+ maxWidth: 500,
+ });
expect(wrapper.find('img').props().style).toMatchObject({ height: 400, width: 400 });
});
});
diff --git a/__tests__/src/components/CompanionArea.test.js b/__tests__/src/components/CompanionArea.test.js
index 87382872ed665d76c310f1d7ec976c70ac2bfeb6..9ddb9cd6937a976f4a4bce2e0ce6706cef9db41d 100644
--- a/__tests__/src/components/CompanionArea.test.js
+++ b/__tests__/src/components/CompanionArea.test.js
@@ -12,8 +12,14 @@ function createWrapper(props) {
windowId="abc123"
position="right"
companionWindows={[
- { position: 'right', id: 'foo' },
- { position: 'right', id: 'baz' },
+ {
+ id: 'foo',
+ position: 'right',
+ },
+ {
+ id: 'baz',
+ position: 'right',
+ },
]}
t={key => key}
{...props}
@@ -43,7 +49,10 @@ describe('CompanionArea', () => {
const setCompanionAreaOpen = jest.fn();
const wrapper = createWrapper({
- position: 'left', sideBarOpen: true, setCompanionAreaOpen, companionAreaOpen: false,
+ companionAreaOpen: false,
+ position: 'left',
+ setCompanionAreaOpen,
+ sideBarOpen: true,
});
expect(wrapper.find(MiradorMenuButton).length).toBe(1);
@@ -61,7 +70,10 @@ describe('CompanionArea', () => {
const setCompanionAreaOpen = jest.fn();
const wrapper = createWrapper({
- position: 'left', sideBarOpen: true, setCompanionAreaOpen, companionAreaOpen: true,
+ companionAreaOpen: true,
+ position: 'left',
+ setCompanionAreaOpen,
+ sideBarOpen: true,
});
expect(wrapper.find(MiradorMenuButton).length).toBe(1);
@@ -77,7 +89,10 @@ describe('CompanionArea', () => {
it('does not show a toggle if the sidebar is collapsed', () => {
const wrapper = createWrapper({
- position: 'left', sideBarOpen: false, setCompanionAreaOpen: () => {}, companionAreaOpen: true,
+ companionAreaOpen: true,
+ position: 'left',
+ setCompanionAreaOpen: () => {},
+ sideBarOpen: false,
});
expect(wrapper.find(MiradorMenuButton).length).toBe(0);
@@ -85,7 +100,10 @@ describe('CompanionArea', () => {
it('does not show a toggle in other positions', () => {
const wrapper = createWrapper({
- position: 'whatever', sideBarOpen: true, setCompanionAreaOpen: () => {}, companionAreaOpen: true,
+ companionAreaOpen: true,
+ position: 'whatever',
+ setCompanionAreaOpen: () => {},
+ sideBarOpen: true,
});
expect(wrapper.find(MiradorMenuButton).length).toBe(0);
diff --git a/__tests__/src/components/CompanionWindow.test.js b/__tests__/src/components/CompanionWindow.test.js
index c69f9291e76b6fb23840dbfed15642ed6f42b420..d30aa96a82db94a10d2aba887123e186d9171926 100644
--- a/__tests__/src/components/CompanionWindow.test.js
+++ b/__tests__/src/components/CompanionWindow.test.js
@@ -24,8 +24,8 @@ describe('CompanionWindow', () => {
it('passes the the updateCompanionWindow prop to MiradorMenuButton with the appropriate args', () => {
const updateCompanionWindow = jest.fn();
companionWindow = createWrapper({
- updateCompanionWindow,
position: 'left',
+ updateCompanionWindow,
});
const button = companionWindow.find(MiradorMenuButton);
@@ -50,7 +50,10 @@ describe('CompanionWindow', () => {
describe('when the companion window is on the right', () => {
const updateCompanionWindow = jest.fn();
- companionWindow = createWrapper({ updateCompanionWindow, position: 'right' });
+ companionWindow = createWrapper({
+ position: 'right',
+ updateCompanionWindow,
+ });
expect(companionWindow.find('WithStyles(Paper).vertical').length).toBe(1);
@@ -62,7 +65,10 @@ describe('CompanionWindow', () => {
describe('when the companion window is on the bottom', () => {
const updateCompanionWindow = jest.fn();
- companionWindow = createWrapper({ updateCompanionWindow, position: 'bottom' });
+ companionWindow = createWrapper({
+ position: 'bottom',
+ updateCompanionWindow,
+ });
expect(companionWindow.find('WithStyles(Paper).horizontal').length).toBe(1);
diff --git a/__tests__/src/components/GalleryView.test.js b/__tests__/src/components/GalleryView.test.js
index d081f7ca429dec1733797cdd7a7cc29b970f1f87..83d45d42aa7f4be0b5403cf7b35449ee8b2c50ad 100644
--- a/__tests__/src/components/GalleryView.test.js
+++ b/__tests__/src/components/GalleryView.test.js
@@ -8,8 +8,11 @@ import { GalleryView } from '../../../src/components/GalleryView';
function createWrapper(props) {
return shallow(
<GalleryView
- window={{ id: '1234', canvasIndex: 0 }}
canvases={manifesto.create(manifestJson).getSequences()[0].getCanvases()}
+ window={{
+ canvasIndex: 0,
+ id: '1234',
+ }}
setCanvas={() => {}}
{...props}
/>,
diff --git a/__tests__/src/components/LanguageSettings.test.js b/__tests__/src/components/LanguageSettings.test.js
index ca216cb5f90c286e5b6d5bf36593de6a07897ddb..62d154aad50af626d158f47947d130cfa7791bf4 100644
--- a/__tests__/src/components/LanguageSettings.test.js
+++ b/__tests__/src/components/LanguageSettings.test.js
@@ -18,8 +18,16 @@ function createWrapper(props) {
describe('LanguageSettings', () => {
let wrapper;
const languages = [
- { locale: 'de', label: 'Deutsch', current: true },
- { locale: 'en', label: 'English', current: false },
+ {
+ current: true,
+ label: 'Deutsch',
+ locale: 'de',
+ },
+ {
+ current: false,
+ label: 'English',
+ locale: 'en',
+ },
];
@@ -74,7 +82,10 @@ describe('LanguageSettings', () => {
it('triggers the handleClick prop when clicking a list item', () => {
const mockHandleClick = jest.fn();
- wrapper = createWrapper({ languages, handleClick: mockHandleClick });
+ wrapper = createWrapper({
+ handleClick: mockHandleClick,
+ languages,
+ });
wrapper.find('WithStyles(MenuItem)').last().simulate('click');
diff --git a/__tests__/src/components/OpenSeadragonViewer.test.js b/__tests__/src/components/OpenSeadragonViewer.test.js
index de881921cc5d86bd7c49037db70c49b80fc9c3dd..6c4e66698e7a8def24169fef778a8145838ece62 100644
--- a/__tests__/src/components/OpenSeadragonViewer.test.js
+++ b/__tests__/src/components/OpenSeadragonViewer.test.js
@@ -20,7 +20,15 @@ describe('OpenSeadragonViewer', () => {
wrapper = shallow(
<OpenSeadragonViewer
- tileSources={[{ '@id': 'http://foo', width: 100, height: 200 }, { '@id': 'http://bar', width: 150, height: 201 }]}
+ tileSources={[{
+ '@id': 'http://foo',
+ height: 200,
+ width: 100,
+ }, {
+ '@id': 'http://bar',
+ height: 201,
+ width: 150,
+ }]}
windowId="base"
config={{}}
updateViewport={updateViewport}
@@ -109,9 +117,9 @@ describe('OpenSeadragonViewer', () => {
wrapper.instance().ref = { current: true };
OpenSeadragon.mockImplementation(() => ({
- viewport: { panTo, zoomTo },
addHandler,
addTiledImage: jest.fn().mockResolvedValue('event'),
+ viewport: { panTo, zoomTo },
}));
});
@@ -150,8 +158,8 @@ describe('OpenSeadragonViewer', () => {
viewport: {
centerSpringX: { target: { value: 10 } },
centerSpringY: { target: { value: 10 } },
- zoomSpring: { target: { value: 1 } },
panTo,
+ zoomSpring: { target: { value: 1 } },
zoomTo,
},
};
@@ -175,9 +183,9 @@ describe('OpenSeadragonViewer', () => {
const forceRedraw = jest.fn();
wrapper.instance().osdCanvasOverlay = {
+ canvasUpdate,
clear,
resize,
- canvasUpdate,
};
wrapper.instance().viewer = { forceRedraw };
diff --git a/__tests__/src/components/ThumbnailNavigation.test.js b/__tests__/src/components/ThumbnailNavigation.test.js
index 30b60008edcb676d7ca479fcc21e48bdb4d52c94..c57a09656f58720d21b3381e471f915b965f74a6 100644
--- a/__tests__/src/components/ThumbnailNavigation.test.js
+++ b/__tests__/src/components/ThumbnailNavigation.test.js
@@ -15,8 +15,8 @@ function createWrapper(props) {
}
classes={{}}
window={{
- id: 'foobar',
canvasIndex: 1,
+ id: 'foobar',
}}
config={{ thumbnailNavigation: { height: 150, width: 100 } }}
position="far-bottom"
@@ -78,8 +78,8 @@ describe('ThumbnailNavigation', () => {
});
it('renders containers based off of canvas groupings ', () => {
wrapper = createWrapper({
- setCanvas,
canvasGroupings: new CanvasGroupings(manifesto.create(manifestJson).getSequences()[0].getCanvases(), 'book'),
+ setCanvas,
});
grid = wrapper.find('AutoSizer')
.dive()
@@ -94,8 +94,8 @@ describe('ThumbnailNavigation', () => {
wrapper.instance().gridRef = { current: { recomputeGridSize: mockRecompute } };
wrapper.setProps({
window: {
- id: 'foobar',
canvasIndex: 1,
+ id: 'foobar',
thumbnailNavigationPosition: 'bottom',
view: 'book',
},
@@ -104,7 +104,10 @@ describe('ThumbnailNavigation', () => {
});
describe('calculating instance methods', () => {
beforeEach(() => {
- rightWrapper = createWrapper({ setCanvas, position: 'far-right' });
+ rightWrapper = createWrapper({
+ position: 'far-right',
+ setCanvas,
+ });
});
it('style', () => {
expect(wrapper.instance().style()).toMatchObject({ height: '150px', width: '100%' });
@@ -116,8 +119,8 @@ describe('ThumbnailNavigation', () => {
wrapper.instance().gridRef = { current: { recomputeGridSize: mockRecompute } };
wrapper.setProps({
window: {
- id: 'foobar',
canvasIndex: 1,
+ id: 'foobar',
thumbnailNavigationPosition: 'bottom',
view: 'book',
},
diff --git a/__tests__/src/components/ViewerNavigation.test.js b/__tests__/src/components/ViewerNavigation.test.js
index d9d207cdaf0b77c13ac420780240bef42422d3f8..934b580442db60c48f3b5edd223a89944282eadf 100644
--- a/__tests__/src/components/ViewerNavigation.test.js
+++ b/__tests__/src/components/ViewerNavigation.test.js
@@ -22,7 +22,10 @@ describe('ViewerNavigation', () => {
setCanvas = jest.fn();
wrapper = createWrapper({
setCanvas,
- window: { id: 'foo', canvasIndex: 0 },
+ window: {
+ canvasIndex: 0,
+ id: 'foo',
+ },
});
});
it('renders the component', () => {
@@ -41,7 +44,10 @@ describe('ViewerNavigation', () => {
describe('when next canvases are not present', () => {
it('nextCanvas button is disabled', () => {
const endWrapper = createWrapper({
- window: { id: 'foo', canvasIndex: 1 },
+ window: {
+ canvasIndex: 1,
+ id: 'foo',
+ },
});
expect(endWrapper.find('.mirador-next-canvas-button').prop('disabled')).toBe(true);
});
@@ -60,7 +66,11 @@ describe('ViewerNavigation', () => {
wrapper = createWrapper({
canvases: [1, 2, 3],
setCanvas,
- window: { id: 'foo', canvasIndex: 0, view: 'book' },
+ window: {
+ canvasIndex: 0,
+ id: 'foo',
+ view: 'book',
+ },
});
wrapper.find('.mirador-next-canvas-button').simulate('click');
expect(setCanvas).toHaveBeenCalledWith('foo', 2);
@@ -68,7 +78,11 @@ describe('ViewerNavigation', () => {
it('setCanvas function is called after click for previous', () => {
wrapper = createWrapper({
setCanvas,
- window: { id: 'foo', canvasIndex: 5, view: 'book' },
+ window: {
+ canvasIndex: 5,
+ id: 'foo',
+ view: 'book',
+ },
});
wrapper.find('.mirador-previous-canvas-button').simulate('click');
expect(wrapper.find('.mirador-previous-canvas-button').prop('aria-label')).toBe('previousCanvas');
diff --git a/__tests__/src/components/Window.test.js b/__tests__/src/components/Window.test.js
index 27f4e11c47f5a4ca9043d2bbfd277fcd8ee682ca..c000ba40cb6df34b4f5f12e192df0e5e1d9eb3f5 100644
--- a/__tests__/src/components/Window.test.js
+++ b/__tests__/src/components/Window.test.js
@@ -20,12 +20,12 @@ function createWrapper(props, context) {
describe('Window', () => {
let wrapper;
const window = {
+ height: 400,
id: 123,
+ maximized: false,
+ width: 400,
x: 2700,
y: 2700,
- width: 400,
- height: 400,
- maximized: false,
};
it('should render nothing, if provided with no window data', () => {
wrapper = shallow(<Window t={k => k} />);
diff --git a/__tests__/src/components/WindowList.test.js b/__tests__/src/components/WindowList.test.js
index c82d16630f3e6c5b86b85277dac1fb028d4ca205..a4026824b36e20845ce4d61f6778c99c3324cb5a 100644
--- a/__tests__/src/components/WindowList.test.js
+++ b/__tests__/src/components/WindowList.test.js
@@ -89,8 +89,8 @@ describe('WindowList', () => {
describe('with multiple windows', () => {
beforeEach(() => {
windows = {
- zyx: { id: 'zyx', manifestId: '123' },
xyz: { id: 'xyz', manifestId: 'abc' },
+ zyx: { id: 'zyx', manifestId: '123' },
};
titles = { xyz: 'Some title' };
diff --git a/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js b/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js
index 44039692ccbcd0e7668c85398450b7f4f97aa8a6..95c0923d7f99f216ebc334f7c29ea5dfaf43d315 100644
--- a/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js
+++ b/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js
@@ -35,8 +35,14 @@ describe('WindowSideBarAnnotationsPanel', () => {
it('renders a list with a list item for each annotation', () => {
wrapper = createWrapper({
annotations: [
- { id: 'abc123', content: 'First Annotation' },
- { id: 'xyz321', content: 'Last Annotation' },
+ {
+ content: 'First Annotation',
+ id: 'abc123',
+ },
+ {
+ content: 'Last Annotation',
+ id: 'xyz321',
+ },
],
});
@@ -50,8 +56,16 @@ describe('WindowSideBarAnnotationsPanel', () => {
wrapper = createWrapper({
annotations: [
- { id: 'abc123', targetId: 'example.com/iiif/12345', content: 'First Annotation' },
- { id: 'xyz321', targetId: 'example.com/iiif/54321', content: 'Last Annotation' },
+ {
+ content: 'First Annotation',
+ id: 'abc123',
+ targetId: 'example.com/iiif/12345',
+ },
+ {
+ content: 'Last Annotation',
+ id: 'xyz321',
+ targetId: 'example.com/iiif/54321',
+ },
],
selectAnnotation,
});
@@ -64,12 +78,20 @@ describe('WindowSideBarAnnotationsPanel', () => {
const deselectAnnotation = jest.fn();
wrapper = createWrapper({
- selectedAnnotationIds: ['abc123'],
annotations: [
- { id: 'abc123', targetId: 'example.com/iiif/12345', content: 'First Annotation' },
- { id: 'xyz321', targetId: 'example.com/iiif/54321', content: 'Last Annotation' },
+ {
+ content: 'First Annotation',
+ id: 'abc123',
+ targetId: 'example.com/iiif/12345',
+ },
+ {
+ content: 'Last Annotation',
+ id: 'xyz321',
+ targetId: 'example.com/iiif/54321',
+ },
],
deselectAnnotation,
+ selectedAnnotationIds: ['abc123'],
});
wrapper.find('WithStyles(ListItem)').first().simulate('click');
diff --git a/__tests__/src/components/WindowViewer.test.js b/__tests__/src/components/WindowViewer.test.js
index 9508ca5794fd58c63d0b20e5e2ac3bbf6b4beacd..f66019f014df5d493b0b4f0457cf2b0191697231 100644
--- a/__tests__/src/components/WindowViewer.test.js
+++ b/__tests__/src/components/WindowViewer.test.js
@@ -50,11 +50,21 @@ describe('WindowViewer', () => {
});
describe('book view', () => {
it('when the first canvas is selected', () => {
- wrapper = createWrapper({ window: { view: 'book', canvasIndex: 0 } });
+ wrapper = createWrapper({
+ window: {
+ canvasIndex: 0,
+ view: 'book',
+ },
+ });
expect(wrapper.instance().currentCanvases().length).toEqual(1);
});
it('when the second canvas is selected', () => {
- wrapper = createWrapper({ window: { view: 'book', canvasIndex: 1 } });
+ wrapper = createWrapper({
+ window: {
+ canvasIndex: 1,
+ view: 'book',
+ },
+ });
expect(wrapper.instance().currentCanvases().length).toEqual(2);
});
});
@@ -72,7 +82,10 @@ describe('WindowViewer', () => {
isFetching: true,
},
},
- window: { view: 'book', canvasIndex: 1 },
+ window: {
+ canvasIndex: 1,
+ view: 'book',
+ },
},
);
expect(wrapper.instance().currentInfoResponses().length).toEqual(1);
@@ -81,14 +94,17 @@ describe('WindowViewer', () => {
wrapper = createWrapper(
{
infoResponses: {
- 'https://stacks.stanford.edu/image/iiif/fr426cg9537%2FSC1094_s3_b14_f17_Cats_1976_0005/info.json': {
+ foo: {
isFetching: false,
},
- foo: {
+ 'https://stacks.stanford.edu/image/iiif/fr426cg9537%2FSC1094_s3_b14_f17_Cats_1976_0005/info.json': {
isFetching: false,
},
},
- window: { view: 'book', canvasIndex: 1 },
+ window: {
+ canvasIndex: 1,
+ view: 'book',
+ },
},
);
expect(wrapper.instance().currentInfoResponses().length).toEqual(1);
@@ -101,11 +117,14 @@ describe('WindowViewer', () => {
isFetching: false,
},
'https://stacks.stanford.edu/image/iiif/rz176rt6531%2FPC0170_s3_Tree_Calendar_20081101_152516_0410/info.json': {
- isFetching: false,
error: 'yikes!',
+ isFetching: false,
},
},
- window: { view: 'book', canvasIndex: 1 },
+ window: {
+ canvasIndex: 1,
+ view: 'book',
+ },
},
);
expect(wrapper.instance().currentInfoResponses().length).toEqual(1);
@@ -133,7 +152,11 @@ describe('WindowViewer', () => {
view: 'single',
};
wrapper = createWrapper(
- { canvases, fetchInfoResponse: mockFnCanvas0, window: mockWindow },
+ {
+ canvases,
+ fetchInfoResponse: mockFnCanvas0,
+ window: mockWindow,
+ },
);
expect(mockFnCanvas0).toHaveBeenCalledTimes(1);
diff --git a/__tests__/src/components/WorkspaceAdd.test.js b/__tests__/src/components/WorkspaceAdd.test.js
index 925a0bbb0ce98834bd13ec877bff1d3a6157adc5..1c600f9f1b471fd1fd1db8c3de2f575359b8d27f 100644
--- a/__tests__/src/components/WorkspaceAdd.test.js
+++ b/__tests__/src/components/WorkspaceAdd.test.js
@@ -10,7 +10,10 @@ function createWrapper(props) {
return shallow(
<WorkspaceAdd
setWorkspaceAddVisibility={() => {}}
- manifests={{ foo: fixture, bar: fixture }}
+ manifests={{
+ bar: fixture,
+ foo: fixture,
+ }}
classes={{}}
t={str => str}
{...props}
diff --git a/__tests__/src/components/WorkspaceElastic.test.js b/__tests__/src/components/WorkspaceElastic.test.js
index fde419fca641deaca49479e14bddc1ff13c47eca..aeb9335d984f9efb25bb20d5125233ce317e940d 100644
--- a/__tests__/src/components/WorkspaceElastic.test.js
+++ b/__tests__/src/components/WorkspaceElastic.test.js
@@ -11,12 +11,12 @@ function createWrapper(props) {
windows={{}}
workspace={{
focusedWindowId: 2,
- width: 5000,
height: 5000,
viewportPosition: {
x: 20,
y: 20,
},
+ width: 5000,
}}
setWorkspaceViewportDimensions={() => {}}
setWorkspaceViewportPosition={() => {}}
@@ -30,18 +30,18 @@ function createWrapper(props) {
describe('WorkspaceElastic', () => {
const windows = {
1: {
+ height: 200,
id: 1,
+ width: 200,
x: 20,
y: 20,
- width: 200,
- height: 200,
},
2: {
+ height: 400,
id: 2,
+ width: 300,
x: 25,
y: 25,
- width: 300,
- height: 400,
},
};
let wrapper;
@@ -55,8 +55,8 @@ describe('WorkspaceElastic', () => {
.at(1)
.props().size)
.toEqual({
- width: 200,
height: 200,
+ width: 200,
});
expect(wrapper
.find(Rnd)
@@ -71,8 +71,8 @@ describe('WorkspaceElastic', () => {
.at(2)
.props().size)
.toEqual({
- width: 300,
height: 400,
+ width: 300,
});
});
describe('focused window', () => {
@@ -84,8 +84,8 @@ describe('WorkspaceElastic', () => {
it('when windows are dragged', () => {
const mockDragStop = jest.fn();
wrapper = createWrapper({
- windows,
updateWindowPosition: mockDragStop,
+ windows,
});
wrapper
.find(Rnd)
@@ -103,8 +103,8 @@ describe('WorkspaceElastic', () => {
it('when windows are resized', () => {
const mockOnResize = jest.fn();
wrapper = createWrapper({
- windows,
setWindowSize: mockOnResize,
+ windows,
});
wrapper
.find(Rnd)
@@ -112,13 +112,13 @@ describe('WorkspaceElastic', () => {
.props()
.onResize('myevent', 'direction', {
style: {
- width: 400,
height: 200,
+ width: 400,
},
}, {}, { x: 0, y: 0 });
expect(mockOnResize).toHaveBeenCalledWith(1, {
- width: 400,
height: 200,
+ width: 400,
x: -2500,
y: -2500,
});
@@ -129,8 +129,8 @@ describe('WorkspaceElastic', () => {
it('when workspace itself is dragged', () => {
const mockDragStop = jest.fn();
wrapper = createWrapper({
- windows,
setWorkspaceViewportPosition: mockDragStop,
+ windows,
});
wrapper
.find(Rnd)
@@ -149,8 +149,8 @@ describe('WorkspaceElastic', () => {
it('when workspace itself is resized', () => {
const mockResize = jest.fn();
wrapper = createWrapper({
- windows,
setWorkspaceViewportDimensions: mockResize,
+ windows,
});
wrapper
@@ -158,12 +158,12 @@ describe('WorkspaceElastic', () => {
.at(0)
.props()
.onResize({
- width: 500,
height: 500,
+ width: 500,
});
expect(mockResize).toHaveBeenCalledWith({
- width: 500,
height: 500,
+ width: 500,
});
});
});
diff --git a/__tests__/src/components/WorkspaceExport.test.js b/__tests__/src/components/WorkspaceExport.test.js
index bf2a890c955b75b19d3ee04f0460d76e8a917782..8f3bf7825e666e2963bbf0640fbc527c1f0cd70e 100644
--- a/__tests__/src/components/WorkspaceExport.test.js
+++ b/__tests__/src/components/WorkspaceExport.test.js
@@ -9,7 +9,11 @@ describe('WorkspaceExport', () => {
beforeEach(() => {
handleClose = jest.fn();
- mockState = { windows: { }, config: { }, manifests: { } };
+ mockState = {
+ config: { },
+ manifests: { },
+ windows: { },
+ };
wrapper = shallow(
<WorkspaceExport
diff --git a/__tests__/src/components/WorkspaceFullScreenButton.test.js b/__tests__/src/components/WorkspaceFullScreenButton.test.js
index 41e8f63710650e8a7ec12c3a1eea48dfcab4e0e1..c1925671e6720b0c6899a1cff24728f5b343a561 100644
--- a/__tests__/src/components/WorkspaceFullScreenButton.test.js
+++ b/__tests__/src/components/WorkspaceFullScreenButton.test.js
@@ -51,7 +51,7 @@ describe('WorkspaceFullScreenButton', () => {
let setWorkspaceFullscreen;
beforeAll(() => {
setWorkspaceFullscreen = jest.fn();
- wrapper = createWrapper({ setWorkspaceFullscreen, isFullscreenEnabled: true });
+ wrapper = createWrapper({ isFullscreenEnabled: true, setWorkspaceFullscreen });
menuButton = wrapper.find(MiradorMenuButton);
});
diff --git a/__tests__/src/components/WorkspaceMosaic.test.js b/__tests__/src/components/WorkspaceMosaic.test.js
index f15e1467be68413f24737becf514d82cf77f60db..f0a4107bd26f768e563b30ff094d949fabe3b5c1 100644
--- a/__tests__/src/components/WorkspaceMosaic.test.js
+++ b/__tests__/src/components/WorkspaceMosaic.test.js
@@ -30,7 +30,10 @@ describe('WorkspaceMosaic', () => {
describe('componentDidUpdate', () => {
it('updates the workspace layout when windows change', () => {
const updateWorkspaceMosaicLayout = jest.fn();
- wrapper = createWrapper({ windows, updateWorkspaceMosaicLayout });
+ wrapper = createWrapper({
+ updateWorkspaceMosaicLayout,
+ windows,
+ });
wrapper.setProps({ windows: { ...windows, 3: { id: 3 } } });
@@ -55,9 +58,9 @@ describe('WorkspaceMosaic', () => {
expect(renderedTile).not.toBeNull();
expect(shallow(renderedTile).find('DropTarget(DragSource(InternalMosaicWindow))').length).toEqual(1);
expect(shallow(renderedTile).props()).toEqual(expect.objectContaining({
- toolbarControls: [],
additionalControls: [],
path: 'foo',
+ toolbarControls: [],
}));
expect(shallow(shallow(renderedTile).props().renderPreview()).matchesElement(
@@ -73,7 +76,10 @@ describe('WorkspaceMosaic', () => {
describe('mosaicChange', () => {
it('calls the provided prop to update layout', () => {
const updateWorkspaceMosaicLayout = jest.fn();
- wrapper = createWrapper({ windows, updateWorkspaceMosaicLayout });
+ wrapper = createWrapper({
+ updateWorkspaceMosaicLayout,
+ windows,
+ });
wrapper.instance().mosaicChange();
expect(updateWorkspaceMosaicLayout).toBeCalled();
diff --git a/__tests__/src/extend/withPlugins.js b/__tests__/src/extend/withPlugins.js
index 31f4fede990ec7f72abbefee0de630095fd69f3c..0980c5de74fc662ad0a5721a0b21c9d6589f4a04 100644
--- a/__tests__/src/extend/withPlugins.js
+++ b/__tests__/src/extend/withPlugins.js
@@ -12,7 +12,10 @@ const Target = props => <div>Hello</div>;
/** create wrapper */
function createWrapper(plugins) {
pluginStore.getPlugins = () => plugins;
- const props = { foo: 1, bar: 2 };
+ const props = {
+ bar: 2,
+ foo: 1,
+ };
const PluginWrapper = withPlugins('Target', Target);
return shallow(<PluginWrapper {...props} />);
}
@@ -44,8 +47,8 @@ describe('PluginHoc: if no plugin exists for the target', () => {
describe('PluginHoc: if a delete plugin exists for the target', () => {
it('renders nothing', () => {
const plugin = {
- target: 'Target',
mode: 'delete',
+ target: 'Target',
};
const wrapper = createWrapper([plugin]);
expect(wrapper.find('*').length).toBe(0);
@@ -57,9 +60,9 @@ describe('PluginHoc: if a replace plugin exists for the target', () => {
/** */
const PluginComponent = props => <div>look i am a plugin</div>;
const plugin = {
- target: 'Target',
- mode: 'replace',
component: PluginComponent,
+ mode: 'replace',
+ target: 'Target',
};
const wrapper = createWrapper([plugin]);
const selector = 'Connect(PluginComponent)';
@@ -74,9 +77,9 @@ describe('PluginHoc: if a add plugin exists for the target', () => {
/** */
const PluginComponent = props => <div>look i am a plugin</div>;
const plugin = {
- target: 'Target',
- mode: 'add',
component: PluginComponent,
+ mode: 'add',
+ target: 'Target',
};
const wrapper = createWrapper([plugin]);
expect(wrapper.find(Target).length).toBe(1);
@@ -92,9 +95,9 @@ describe('PluginHoc: if a wrap plugin extists for the target', () => {
/** */
const PluginComponent = props => <div>look i am a plugin</div>;
const plugin = {
- target: 'Target',
- mode: 'wrap',
component: PluginComponent,
+ mode: 'wrap',
+ target: 'Target',
};
const wrapper = createWrapper([plugin]);
const selector = 'Connect(PluginComponent)';
diff --git a/__tests__/src/lib/MiradorViewer.test.js b/__tests__/src/lib/MiradorViewer.test.js
index fd2596c08493c55c01bdc32e6a93b3190e4da022..1d2bca825cb4283e75a2a53cb66f9ae0ce1f0f3f 100644
--- a/__tests__/src/lib/MiradorViewer.test.js
+++ b/__tests__/src/lib/MiradorViewer.test.js
@@ -31,8 +31,8 @@ describe('MiradorViewer', () => {
/** */ const plugins = [
{
reducers: {
- foo: fooReducer,
bar: barReducer,
+ foo: fooReducer,
},
},
{
@@ -52,10 +52,13 @@ describe('MiradorViewer', () => {
it('transforms config values to actions to dispatch to store', () => {
instance = new MiradorViewer({
id: 'mirador',
+ manifests: {
+ 'http://media.nga.gov/public/manifests/nga_highlights.json': { provider: 'National Gallery of Art' },
+ },
windows: [
{
- loadedManifest: 'https://iiif.harvardartmuseums.org/manifests/object/299843',
canvasIndex: 2,
+ loadedManifest: 'https://iiif.harvardartmuseums.org/manifests/object/299843',
},
{
loadedManifest: 'https://iiif.harvardartmuseums.org/manifests/object/299843',
@@ -63,9 +66,6 @@ describe('MiradorViewer', () => {
view: 'book',
},
],
- manifests: {
- 'http://media.nga.gov/public/manifests/nga_highlights.json': { provider: 'National Gallery of Art' },
- },
});
const { windows, manifests } = instance.store.getState();
diff --git a/__tests__/src/lib/OpenSeadragonCanvasOverlay.test.js b/__tests__/src/lib/OpenSeadragonCanvasOverlay.test.js
index 8663b652be436724cd7a52bb9191aa530e688a4e..ca3293f4e8956d6e34daf6fff6d93d3b60309999 100644
--- a/__tests__/src/lib/OpenSeadragonCanvasOverlay.test.js
+++ b/__tests__/src/lib/OpenSeadragonCanvasOverlay.test.js
@@ -16,7 +16,10 @@ describe('OpenSeadragonCanvasOverlay', () => {
},
viewport: {
getBounds: jest.fn(() => ({
- x: 40, y: 80, width: 200, height: 300,
+ height: 300,
+ width: 200,
+ x: 40,
+ y: 80,
})),
getZoom: jest.fn(() => (0.75)),
},
diff --git a/__tests__/src/reducers/annotations.test.js b/__tests__/src/reducers/annotations.test.js
index 5b54799254802fe883a86e105e48380d60774e3a..9a16cc06db5faae9509f37b48898164859a3e146 100644
--- a/__tests__/src/reducers/annotations.test.js
+++ b/__tests__/src/reducers/annotations.test.js
@@ -4,9 +4,9 @@ import ActionTypes from '../../../src/state/actions/action-types';
describe('annotation reducer', () => {
it('should handle REQUEST_ANNOTATION', () => {
expect(annotationsReducer({}, {
- type: ActionTypes.REQUEST_ANNOTATION,
- canvasId: 'foo',
annotationId: 'abc123',
+ canvasId: 'foo',
+ type: ActionTypes.REQUEST_ANNOTATION,
})).toEqual({
foo: {
abc123: {
@@ -27,14 +27,14 @@ describe('annotation reducer', () => {
},
},
{
- type: ActionTypes.RECEIVE_ANNOTATION,
- canvasId: 'foo',
annotationId: 'abc123',
annotationJson: {
- id: 'abc123',
'@type': 'sc:AnnotationList',
content: 'anno stuff',
+ id: 'abc123',
},
+ canvasId: 'foo',
+ type: ActionTypes.RECEIVE_ANNOTATION,
},
)).toMatchObject({
foo: {
@@ -57,17 +57,17 @@ describe('annotation reducer', () => {
},
},
{
- type: ActionTypes.RECEIVE_ANNOTATION_FAILURE,
- canvasId: 'foo',
annotationId: 'abc123',
+ canvasId: 'foo',
error: "This institution didn't enable CORS.",
+ type: ActionTypes.RECEIVE_ANNOTATION_FAILURE,
},
)).toEqual({
foo: {
abc123: {
+ error: "This institution didn't enable CORS.",
id: 'abc123',
isFetching: false,
- error: "This institution didn't enable CORS.",
},
},
});
diff --git a/__tests__/src/reducers/companionWindows.test.js b/__tests__/src/reducers/companionWindows.test.js
index fc830f46e9343d4cb2ab47c2ad519818425d9f47..c3ca0bb60159f7ba67ff69be309a54803810f1bf 100644
--- a/__tests__/src/reducers/companionWindows.test.js
+++ b/__tests__/src/reducers/companionWindows.test.js
@@ -5,15 +5,15 @@ describe('companionWindowsReducer', () => {
describe('ADD_COMPANION_WINDOW', () => {
it('adds a new companion window', () => {
const action = {
- type: ActionTypes.ADD_COMPANION_WINDOW,
id: 'abc123',
payload: { content: 'info', position: 'right' },
+ type: ActionTypes.ADD_COMPANION_WINDOW,
};
const beforeState = {};
const expectedState = {
abc123: {
- position: 'right',
content: 'info',
+ position: 'right',
},
};
expect(companionWindowsReducer(beforeState, action)).toEqual(expectedState);
@@ -23,13 +23,29 @@ describe('companionWindowsReducer', () => {
describe('ADD_WINDOW', () => {
it('adds default companion window(s)', () => {
const action = {
+ companionWindows: [{
+ content: 'info',
+ id: 'banana',
+ position: 'left',
+ }, {
+ content: 'canvas_navigation',
+ id: 'Banane',
+ position: 'right',
+ }],
type: ActionTypes.ADD_WINDOW,
- companionWindows: [{ id: 'banana', position: 'left', content: 'info' }, { id: 'Banane', position: 'right', content: 'canvas_navigation' }],
};
const beforeState = {};
const expectedState = {
- banana: { id: 'banana', position: 'left', content: 'info' },
- Banane: { id: 'Banane', position: 'right', content: 'canvas_navigation' },
+ banana: {
+ content: 'info',
+ id: 'banana',
+ position: 'left',
+ },
+ Banane: {
+ content: 'canvas_navigation',
+ id: 'Banane',
+ position: 'right',
+ },
};
expect(companionWindowsReducer(beforeState, action)).toEqual(expectedState);
});
@@ -39,21 +55,21 @@ describe('companionWindowsReducer', () => {
describe('UPDATE_COMPANION_WINDOW', () => {
it('updates an existing companion window', () => {
const action = {
- type: ActionTypes.UPDATE_COMPANION_WINDOW,
id: 'abc123',
payload: { content: 'canvases', foo: 'bar' },
+ type: ActionTypes.UPDATE_COMPANION_WINDOW,
};
const beforeState = {
abc123: {
- position: 'right',
content: 'info',
+ position: 'right',
},
};
const expectedState = {
abc123: {
- position: 'right',
content: 'canvases',
foo: 'bar',
+ position: 'right',
},
};
expect(companionWindowsReducer(beforeState, action)).toEqual(expectedState);
@@ -63,13 +79,13 @@ describe('companionWindowsReducer', () => {
describe('REMOVE_COMPANION_WINDOW', () => {
it('should remove a companion window', () => {
const action = {
- type: ActionTypes.REMOVE_COMPANION_WINDOW,
id: 'abc123',
+ type: ActionTypes.REMOVE_COMPANION_WINDOW,
};
const beforeState = {
abc123: {
- position: 'right',
content: 'info',
+ position: 'right',
},
};
const expectedState = {};
@@ -80,9 +96,9 @@ describe('companionWindowsReducer', () => {
describe('REMOVE_WINDOW', () => {
it('should remove a companion window', () => {
const action = {
- type: ActionTypes.REMOVE_WINDOW,
- id: 'abc123',
companionWindowIds: ['a', 'b'],
+ id: 'abc123',
+ type: ActionTypes.REMOVE_WINDOW,
};
const beforeState = {
a: {},
diff --git a/__tests__/src/reducers/config.test.js b/__tests__/src/reducers/config.test.js
index 331b9871327d71b1a81b773b45d2ed7f30ba07c0..9c53c62eea778dfa844f1c393d0c4fd8533ed18a 100644
--- a/__tests__/src/reducers/config.test.js
+++ b/__tests__/src/reducers/config.test.js
@@ -5,16 +5,16 @@ describe('config reducer', () => {
describe('SET_CONFIG', () => {
it('should handle SET_CONFIG', () => {
expect(configReducer({}, {
- type: ActionTypes.SET_CONFIG,
config: { manifestVersion: 'v3' },
+ type: ActionTypes.SET_CONFIG,
})).toEqual({
manifestVersion: 'v3',
});
});
it('does not deep merge', () => {
expect(configReducer({ stuff: { foo: 'bar' } }, {
- type: ActionTypes.SET_CONFIG,
config: { stuff: { foo: 'bat' } },
+ type: ActionTypes.SET_CONFIG,
})).toEqual({
stuff: { foo: 'bat' },
});
@@ -23,19 +23,22 @@ describe('config reducer', () => {
describe('UPDATE_CONFIG', () => {
it('should handle UPDATE_CONFIG', () => {
expect(configReducer({}, {
- type: ActionTypes.UPDATE_CONFIG,
config: { manifestVersion: 'v3' },
+ type: ActionTypes.UPDATE_CONFIG,
})).toEqual({
manifestVersion: 'v3',
});
});
it('does a deep merge', () => {
- expect(configReducer({ stuff: { foo: 'bar' }, hello: 'world' }, {
- type: ActionTypes.UPDATE_CONFIG,
+ expect(configReducer({
+ hello: 'world',
+ stuff: { foo: 'bar' },
+ }, {
config: { stuff: { foo: 'bat' } },
+ type: ActionTypes.UPDATE_CONFIG,
})).toEqual({
- stuff: { foo: 'bat' },
hello: 'world',
+ stuff: { foo: 'bat' },
});
});
});
diff --git a/__tests__/src/reducers/infoResponse.test.js b/__tests__/src/reducers/infoResponse.test.js
index f2a3c44ef3b851656fbef3c1071198159a0c4147..e3d4a5bc665c2e256c219b8fb8f19cdd0d5c9966 100644
--- a/__tests__/src/reducers/infoResponse.test.js
+++ b/__tests__/src/reducers/infoResponse.test.js
@@ -4,8 +4,8 @@ import ActionTypes from '../../../src/state/actions/action-types';
describe('info response reducer', () => {
it('should handle REQUEST_INFO_RESPONSE', () => {
expect(infoResponsesReducer({}, {
- type: ActionTypes.REQUEST_INFO_RESPONSE,
infoId: 'abc123',
+ type: ActionTypes.REQUEST_INFO_RESPONSE,
})).toEqual({
abc123: {
id: 'abc123',
@@ -22,13 +22,13 @@ describe('info response reducer', () => {
},
},
{
- type: ActionTypes.RECEIVE_INFO_RESPONSE,
infoId: 'abc123',
infoJson: {
- id: 'abc123',
'@type': 'sc:Manifest',
content: 'lots of canvases and metadata and such',
+ id: 'abc123',
},
+ type: ActionTypes.RECEIVE_INFO_RESPONSE,
},
)).toMatchObject({
abc123: {
@@ -47,15 +47,15 @@ describe('info response reducer', () => {
},
},
{
- type: ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE,
- infoId: 'abc123',
error: "This institution didn't enable CORS.",
+ infoId: 'abc123',
+ type: ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE,
},
)).toEqual({
abc123: {
+ error: "This institution didn't enable CORS.",
id: 'abc123',
isFetching: false,
- error: "This institution didn't enable CORS.",
},
});
});
@@ -72,8 +72,8 @@ describe('info response reducer', () => {
},
},
{
- type: ActionTypes.REMOVE_INFO_RESPONSE,
infoId: 'abc123',
+ type: ActionTypes.REMOVE_INFO_RESPONSE,
},
)).toEqual({
def456: {
diff --git a/__tests__/src/reducers/manifests.test.js b/__tests__/src/reducers/manifests.test.js
index a6994e23f0e94f9b463999ee418f636acf6386d8..9aa2a0174856c3915fd44fe9479ee37cceb1e3d2 100644
--- a/__tests__/src/reducers/manifests.test.js
+++ b/__tests__/src/reducers/manifests.test.js
@@ -4,8 +4,8 @@ import ActionTypes from '../../../src/state/actions/action-types';
describe('manifests reducer', () => {
it('should handle REQUEST_MANIFEST', () => {
expect(manifestsReducer({}, {
- type: ActionTypes.REQUEST_MANIFEST,
manifestId: 'abc123',
+ type: ActionTypes.REQUEST_MANIFEST,
})).toEqual({
abc123: {
id: 'abc123',
@@ -16,30 +16,30 @@ describe('manifests reducer', () => {
expect(manifestsReducer(
{
abc123: {
+ error: 'Error fetching manifest',
id: 'abc123',
isFetching: true,
- error: 'Error fetching manifest',
},
},
{
- type: ActionTypes.RECEIVE_MANIFEST,
manifestId: 'abc123',
manifestJson: {
- id: 'abc123',
'@type': 'sc:Manifest',
content: 'lots of canvases and metadata and such',
+ id: 'abc123',
},
+ type: ActionTypes.RECEIVE_MANIFEST,
},
)).toMatchObject({
abc123: {
+ error: null,
id: 'abc123',
isFetching: false,
json: {
- id: 'abc123',
'@type': 'sc:Manifest',
content: 'lots of canvases and metadata and such',
+ id: 'abc123',
},
- error: null,
},
});
});
@@ -53,15 +53,15 @@ describe('manifests reducer', () => {
},
},
{
- type: ActionTypes.RECEIVE_MANIFEST_FAILURE,
- manifestId: 'abc123',
error: "This institution didn't enable CORS.",
+ manifestId: 'abc123',
+ type: ActionTypes.RECEIVE_MANIFEST_FAILURE,
},
)).toEqual({
abc123: {
+ error: "This institution didn't enable CORS.",
id: 'abc123',
isFetching: false,
- error: "This institution didn't enable CORS.",
},
});
});
@@ -78,8 +78,8 @@ describe('manifests reducer', () => {
},
},
{
- type: ActionTypes.REMOVE_MANIFEST,
manifestId: 'abc123',
+ type: ActionTypes.REMOVE_MANIFEST,
},
)).toEqual({
def456: {
diff --git a/__tests__/src/reducers/viewers.test.js b/__tests__/src/reducers/viewers.test.js
index 9adc942f8e851dd6eb801ba9da23c06d48bb985f..f5abeef08aac1737f1567a78a27a1140f5147ca9 100644
--- a/__tests__/src/reducers/viewers.test.js
+++ b/__tests__/src/reducers/viewers.test.js
@@ -11,9 +11,9 @@ describe('viewers reducer', () => {
y: 1,
},
}, {
+ payload: { x: 0, y: 1, zoom: 0.5 },
type: ActionTypes.UPDATE_VIEWPORT,
windowId: 'abc123',
- payload: { x: 0, y: 1, zoom: 0.5 },
})).toEqual({
abc123: {
x: 0,
diff --git a/__tests__/src/reducers/windows.test.js b/__tests__/src/reducers/windows.test.js
index a623cd699b76e06b068b0345494ac1ab82567798..22a5a048b973c12acd9298c46199181d5920dfc9 100644
--- a/__tests__/src/reducers/windows.test.js
+++ b/__tests__/src/reducers/windows.test.js
@@ -81,8 +81,8 @@ describe('windows reducer', () => {
it('should handle SET_WINDOW_VIEW_TYPE by changing the view attribute', () => {
const action = {
type: ActionTypes.SET_WINDOW_VIEW_TYPE,
- windowId: 'abc123',
viewType: 'book',
+ windowId: 'abc123',
};
const before = {
abc123: { view: 'single' },
@@ -99,9 +99,9 @@ describe('windows reducer', () => {
describe('SET_WINDOW_SIDE_BAR_PANEL', () => {
it('sets the sideBarPanel value to the given value when it was changed', () => {
const action = {
+ panelType: 'info',
type: ActionTypes.SET_WINDOW_SIDE_BAR_PANEL,
windowId: 'abc123',
- panelType: 'info',
};
const before = {
abc123: { sideBarPanel: 'closed' },
@@ -119,25 +119,25 @@ describe('windows reducer', () => {
it('should handle SET_CANVAS', () => {
expect(windowsReducer({
abc123: {
- id: 'abc123',
canvasIndex: 1,
+ id: 'abc123',
},
def456: {
- id: 'def456',
canvasIndex: 1,
+ id: 'def456',
},
}, {
+ canvasIndex: 5,
type: ActionTypes.SET_CANVAS,
windowId: 'abc123',
- canvasIndex: 5,
})).toEqual({
abc123: {
- id: 'abc123',
canvasIndex: 5,
+ id: 'abc123',
},
def456: {
- id: 'def456',
canvasIndex: 1,
+ id: 'def456',
},
});
});
@@ -145,21 +145,24 @@ describe('windows reducer', () => {
describe('UPDATE_WINDOW', () => {
it('updates an existing window', () => {
const action = {
- type: ActionTypes.UPDATE_WINDOW,
id: 'abc123',
- payload: { foo: 11, baz: 33 },
+ payload: {
+ baz: 33,
+ foo: 11,
+ },
+ type: ActionTypes.UPDATE_WINDOW,
};
const beforeState = {
abc123: {
- foo: 1,
bar: 2,
+ foo: 1,
},
};
const expectedState = {
abc123: {
- foo: 11,
bar: 2,
baz: 33,
+ foo: 11,
},
};
expect(windowsReducer(beforeState, action)).toEqual(expectedState);
@@ -175,23 +178,23 @@ describe('windows reducer', () => {
id: 'def456',
},
}, {
- type: ActionTypes.SET_WINDOW_SIZE,
payload: {
- windowId: 'abc123',
size: {
+ height: 200,
+ width: 200,
x: 20,
y: 20,
- width: 200,
- height: 200,
},
+ windowId: 'abc123',
},
+ type: ActionTypes.SET_WINDOW_SIZE,
})).toEqual({
abc123: {
+ height: 200,
id: 'abc123',
+ width: 200,
x: 20,
y: 20,
- width: 200,
- height: 200,
},
def456: {
id: 'def456',
@@ -208,14 +211,14 @@ describe('windows reducer', () => {
id: 'def456',
},
}, {
- type: ActionTypes.UPDATE_WINDOW_POSITION,
payload: {
- windowId: 'abc123',
position: {
x: 20,
y: 20,
},
+ windowId: 'abc123',
},
+ type: ActionTypes.UPDATE_WINDOW_POSITION,
})).toEqual({
abc123: {
id: 'abc123',
@@ -232,46 +235,46 @@ describe('windows reducer', () => {
// on the right, just tacks the new id on
expect(windowsReducer({
abc123: {
- id: 'abc123',
companionWindowIds: ['123'],
+ id: 'abc123',
},
}, {
- type: ActionTypes.ADD_COMPANION_WINDOW,
id: 'xyz',
- windowId: 'abc123',
payload: {
position: 'right',
},
+ type: ActionTypes.ADD_COMPANION_WINDOW,
+ windowId: 'abc123',
})).toEqual({
abc123: {
- id: 'abc123',
companionWindowIds: ['123', 'xyz'],
+ id: 'abc123',
},
});
// on the left, replaces all ids of windows in that position and sets some additional properties
expect(windowsReducer({
abc123: {
- id: 'abc123',
companionWindowIds: ['left123'],
+ id: 'abc123',
},
}, {
- type: ActionTypes.ADD_COMPANION_WINDOW,
- id: 'xyz',
- windowId: 'abc123',
companionWindows: {
left123: { position: 'left' },
},
+ id: 'xyz',
payload: {
content: 'content',
position: 'left',
},
+ type: ActionTypes.ADD_COMPANION_WINDOW,
+ windowId: 'abc123',
})).toEqual({
abc123: {
- id: 'abc123',
companionAreaOpen: true,
- sideBarPanel: 'content',
companionWindowIds: ['xyz'],
+ id: 'abc123',
+ sideBarPanel: 'content',
},
});
});
@@ -280,17 +283,17 @@ describe('windows reducer', () => {
// on the right, just tacks the new id on
expect(windowsReducer({
abc123: {
- id: 'abc123',
companionWindowIds: ['123', 'xyz'],
+ id: 'abc123',
},
}, {
- type: ActionTypes.REMOVE_COMPANION_WINDOW,
id: 'xyz',
+ type: ActionTypes.REMOVE_COMPANION_WINDOW,
windowId: 'abc123',
})).toEqual({
abc123: {
- id: 'abc123',
companionWindowIds: ['123'],
+ id: 'abc123',
},
});
});
@@ -299,7 +302,10 @@ describe('windows reducer', () => {
it('handles when no selectedAnnotations exist', () => {
const beforeState = { abc123: {} };
const action = {
- type: ActionTypes.SELECT_ANNOTATION, windowId: 'abc123', canvasId: 'cId', annotationId: 'aId',
+ annotationId: 'aId',
+ canvasId: 'cId',
+ type: ActionTypes.SELECT_ANNOTATION,
+ windowId: 'abc123',
};
const expectedState = {
abc123: { selectedAnnotations: { cId: ['aId'] } },
@@ -311,7 +317,10 @@ describe('windows reducer', () => {
it('adds new annotation IDs to existing canvas IDs', () => {
const beforeState = { abc123: { selectedAnnotations: { cId: ['prevId'] } } };
const action = {
- type: ActionTypes.SELECT_ANNOTATION, windowId: 'abc123', canvasId: 'cId', annotationId: 'aId',
+ annotationId: 'aId',
+ canvasId: 'cId',
+ type: ActionTypes.SELECT_ANNOTATION,
+ windowId: 'abc123',
};
const expectedState = {
abc123: { selectedAnnotations: { cId: ['prevId', 'aId'] } },
@@ -324,7 +333,10 @@ describe('windows reducer', () => {
it('remvoves the given annotation Id', () => {
const beforeState = { abc123: { selectedAnnotations: { cId: ['aId1', 'aId2'] } } };
const action = {
- type: ActionTypes.DESELECT_ANNOTATION, windowId: 'abc123', canvasId: 'cId', annotationId: 'aId1',
+ annotationId: 'aId1',
+ canvasId: 'cId',
+ type: ActionTypes.DESELECT_ANNOTATION,
+ windowId: 'abc123',
};
const expectedState = {
abc123: { selectedAnnotations: { cId: ['aId2'] } },
@@ -336,7 +348,10 @@ describe('windows reducer', () => {
it('remvoves the given canvas Id from the selected annotations if there are no more IDs', () => {
const beforeState = { abc123: { selectedAnnotations: { cId1: ['aId1'], cId2: ['aId2'] } } };
const action = {
- type: ActionTypes.DESELECT_ANNOTATION, windowId: 'abc123', canvasId: 'cId2', annotationId: 'aId2',
+ annotationId: 'aId2',
+ canvasId: 'cId2',
+ type: ActionTypes.DESELECT_ANNOTATION,
+ windowId: 'abc123',
};
const expectedState = {
abc123: { selectedAnnotations: { cId1: ['aId1'] } },
diff --git a/__tests__/src/reducers/workspace.test.js b/__tests__/src/reducers/workspace.test.js
index 14ffd01f524eb2dc67aa9aa3b75c49204c447392..83ef0ea141064871c41d92754f1b9f7147619c94 100644
--- a/__tests__/src/reducers/workspace.test.js
+++ b/__tests__/src/reducers/workspace.test.js
@@ -13,9 +13,9 @@ describe('workspace reducer', () => {
});
it('should handle FOCUS_WINDOW', () => {
expect(workspaceReducer([], {
+ position: { x: 10, y: 50 },
type: ActionTypes.FOCUS_WINDOW,
windowId: 'abc123',
- position: { x: 10, y: 50 },
})).toEqual({
focusedWindowId: 'abc123',
viewportPosition: { x: 10, y: 50 },
@@ -23,53 +23,53 @@ describe('workspace reducer', () => {
});
it('should handle SET_WORKSPACE_FULLSCREEN', () => {
expect(workspaceReducer([], {
- type: ActionTypes.SET_WORKSPACE_FULLSCREEN,
isFullscreenEnabled: true,
+ type: ActionTypes.SET_WORKSPACE_FULLSCREEN,
})).toEqual({
isFullscreenEnabled: true,
});
});
it('should handle TOGGLE_ZOOM_CONTROLS', () => {
expect(workspaceReducer([], {
- type: ActionTypes.TOGGLE_ZOOM_CONTROLS,
showZoomControls: true,
+ type: ActionTypes.TOGGLE_ZOOM_CONTROLS,
})).toEqual({
showZoomControls: true,
});
});
it('should handle UPDATE_WORKSPACE_MOSAIC_LAYOUT', () => {
expect(workspaceReducer([], {
- type: ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT,
layout: { foo: 'bar' },
+ type: ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT,
})).toEqual({
layout: { foo: 'bar' },
});
});
it('should handle SET_WORKSPACE_ADD_VISIBILITY', () => {
expect(workspaceReducer([], {
- type: ActionTypes.SET_WORKSPACE_ADD_VISIBILITY,
isWorkspaceAddVisible: true,
+ type: ActionTypes.SET_WORKSPACE_ADD_VISIBILITY,
})).toEqual({
isWorkspaceAddVisible: true,
});
});
it('should handle SET_WORKSPACE_VIEWPORT_POSITION', () => {
expect(workspaceReducer([], {
- type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
payload: {
position: {
+ height: 50,
+ width: 50,
x: 50,
y: 50,
- width: 50,
- height: 50,
},
},
+ type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
})).toEqual({
viewportPosition: {
+ height: 50,
+ width: 50,
x: 50,
y: 50,
- width: 50,
- height: 50,
},
});
});
diff --git a/__tests__/src/selectors/canvases.test.js b/__tests__/src/selectors/canvases.test.js
index a0414225b375e9440494c042068e809bfd990c31..7cbe8af71aaf33cf3aea18a2f2809e1ad14b1d24 100644
--- a/__tests__/src/selectors/canvases.test.js
+++ b/__tests__/src/selectors/canvases.test.js
@@ -8,34 +8,34 @@ import {
describe('getSelectedCanvas', () => {
const state = {
- windows: {
- a: {
- id: 'a',
- manifestId: 'x',
- canvasIndex: 1,
- },
- },
manifests: {
x: {
id: 'x',
json: manifestFixture019,
},
},
- };
-
- const noManifestationState = {
windows: {
a: {
+ canvasIndex: 1,
id: 'a',
manifestId: 'x',
- canvasIndex: 1,
},
},
+ };
+
+ const noManifestationState = {
manifests: {
x: {
id: 'x',
},
},
+ windows: {
+ a: {
+ canvasIndex: 1,
+ id: 'a',
+ manifestId: 'x',
+ },
+ },
};
it('should return canvas based on the canvas index stored window state', () => {
@@ -55,33 +55,33 @@ describe('getSelectedCanvas', () => {
describe('getSelectedCanvases', () => {
const state = {
+ manifests: {
+ x: {
+ id: 'x',
+ json: manifestFixture019,
+ },
+ },
windows: {
a: {
+ canvasIndex: 1,
id: 'a',
manifestId: 'x',
- canvasIndex: 1,
view: 'book',
},
},
+ };
+
+ const noManifestationState = {
manifests: {
x: {
id: 'x',
- json: manifestFixture019,
},
},
- };
-
- const noManifestationState = {
windows: {
a: {
+ canvasIndex: 1,
id: 'a',
manifestId: 'x',
- canvasIndex: 1,
- },
- },
- manifests: {
- x: {
- id: 'x',
},
},
};
@@ -106,13 +106,19 @@ describe('getSelectedCanvases', () => {
describe('getCanvasLabel', () => {
it('should return label of the canvas', () => {
const state = { manifests: { a: { json: manifestFixture001 } } };
- const received = getCanvasLabel(state, { manifestId: 'a', canvasIndex: 0 });
+ const received = getCanvasLabel(state, {
+ canvasIndex: 0,
+ manifestId: 'a',
+ });
expect(received).toBe('Whole Page');
});
it('should return undefined if the canvas is undefined', () => {
const state = { manifests: { } };
- expect(getCanvasLabel(state, { manifestId: 'b', canvasIndex: 0 })).toBeUndefined();
+ expect(getCanvasLabel(state, {
+ canvasIndex: 0,
+ manifestId: 'b',
+ })).toBeUndefined();
});
it('should return the canvas index as (+1) as string if no label given', () => {
@@ -133,7 +139,10 @@ describe('getCanvasLabel', () => {
};
const state = { manifests: { a: { json: manifest } } };
- const received = getCanvasLabel(state, { manifestId: 'a', canvasIndex: 0 });
+ const received = getCanvasLabel(state, {
+ canvasIndex: 0,
+ manifestId: 'a',
+ });
expect(received).toBe('1');
});
});
diff --git a/__tests__/src/selectors/index.test.js b/__tests__/src/selectors/index.test.js
index a61266579feb2afb062611a77cfb6cce7d6b4a14..b814ddaeadecb3065bc890f7ac21b220ff6a9f17 100644
--- a/__tests__/src/selectors/index.test.js
+++ b/__tests__/src/selectors/index.test.js
@@ -87,7 +87,11 @@ describe('getIdAndContentOfResources', () => {
new AnnotationResource({ '@id': 'theId', on: 'example.com', resource: { chars: 'The Content' } }),
];
const expected = [
- { id: 'theId', targetId: 'example.com', content: 'The Content' },
+ {
+ content: 'The Content',
+ id: 'theId',
+ targetId: 'example.com',
+ },
];
expect(getIdAndContentOfResources(annotations)).toEqual(expected);
@@ -108,7 +112,11 @@ describe('getIdAndContentOfResources', () => {
new AnnotationResource({ '@id': 'theId', on: 'example.com', resource: [{ chars: 'The' }, { chars: 'Content' }] }),
];
const expected = [
- { id: 'theId', targetId: 'example.com', content: 'The Content' },
+ {
+ content: 'The Content',
+ id: 'theId',
+ targetId: 'example.com',
+ },
];
expect(getIdAndContentOfResources(annotations)).toEqual(expected);
@@ -118,12 +126,26 @@ describe('getIdAndContentOfResources', () => {
describe('getLanguagesFromConfigWithCurrent', () => {
it('returns an array of objects with locale, label, and current properties', () => {
const state = {
- config: { language: 'epo', availableLanguages: { epo: 'Esparanto', tlh: 'Klingon' } },
+ config: {
+ availableLanguages: {
+ epo: 'Esparanto',
+ tlh: 'Klingon',
+ },
+ language: 'epo',
+ },
};
const expected = [
- { locale: 'epo', label: 'Esparanto', current: true },
- { locale: 'tlh', label: 'Klingon', current: false },
+ {
+ current: true,
+ label: 'Esparanto',
+ locale: 'epo',
+ },
+ {
+ current: false,
+ label: 'Klingon',
+ locale: 'tlh',
+ },
];
expect(getLanguagesFromConfigWithCurrent(state)).toEqual(expected);
@@ -171,14 +193,14 @@ it('getSelectedTargetAnnotationResources filters the annotation resources by the
describe('getAllOrSelectedAnnotations', () => {
it('returns all annotations if the given window is set to display all', () => {
const state = {
- windows: {
- abc123: { displayAllAnnotations: true },
- },
annotations: {
cid1: {
annoId1: { id: 'annoId1', json: { resources: [{ '@id': 'annoId1' }, { '@id': 'annoId2' }] } },
},
},
+ windows: {
+ abc123: { displayAllAnnotations: true },
+ },
};
expect(
@@ -188,14 +210,14 @@ describe('getAllOrSelectedAnnotations', () => {
it('returns only selected annotations if the window is not set to display all', () => {
const state = {
- windows: {
- abc123: { displayAllAnnotations: false },
- },
annotations: {
cid1: {
annoId1: { id: 'annoId1', json: { resources: [{ '@id': 'annoId1' }, { '@id': 'annoId2' }] } },
},
},
+ windows: {
+ abc123: { displayAllAnnotations: false },
+ },
};
expect(
diff --git a/__tests__/src/selectors/manifests.test.js b/__tests__/src/selectors/manifests.test.js
index cdebc905d6eb9116fb97dc18978febb78e2075d1..e7fba468664cf0227e367156d060a4c2f336a9b0 100644
--- a/__tests__/src/selectors/manifests.test.js
+++ b/__tests__/src/selectors/manifests.test.js
@@ -18,14 +18,14 @@ import {
describe('getManifest()', () => {
const state = {
+ manifests: {
+ x: { id: 'x' },
+ },
windows: {
a: { id: 'a', manifestId: 'x' },
b: { id: 'b', manifestId: 'y' },
c: { id: 'c' },
},
- manifests: {
- x: { id: 'x' },
- },
};
it('should return the manifest of a certain id', () => {
diff --git a/__tests__/src/selectors/windows.test.js b/__tests__/src/selectors/windows.test.js
index caa2fe6f73bd325783d6ad34b9d61634c776d4b5..d65676919cd2fc4b3940d49803190a17652d9815 100644
--- a/__tests__/src/selectors/windows.test.js
+++ b/__tests__/src/selectors/windows.test.js
@@ -13,15 +13,15 @@ import {
describe('getWindowTitles', () => {
it('should return manifest titles for the open windows', () => {
const state = {
- windows: {
- a: { manifestId: 'amanifest' },
- b: { manifestId: 'bmanifest' },
- },
manifests: {
amanifest: { json: manifestFixture001 },
bmanifest: { json: manifestFixture002 },
cmanifest: { json: manifestFixture019 },
},
+ windows: {
+ a: { manifestId: 'amanifest' },
+ b: { manifestId: 'bmanifest' },
+ },
};
const received = getWindowTitles(state);
@@ -36,13 +36,13 @@ describe('getWindowTitles', () => {
describe('getThumbnailNavigationPosition', () => {
const state = {
+ companionWindows: {
+ cw_a: { position: 'bottom' },
+ },
windows: {
a: { id: 'a', thumbnailNavigationId: 'cw_a' },
b: { id: 'b', thumbnailNavigationId: 'cw_b' },
},
- companionWindows: {
- cw_a: { position: 'bottom' },
- },
};
it('should return thumbnail navigation position if window exists', () => {
@@ -87,27 +87,36 @@ describe('getWindowViewType', () => {
describe('getCompanionWindowForPosition', () => {
const state = {
- windows: { a: { companionWindowIds: ['abc'] } },
companionWindows: {
abc: { id: 'abc', position: 'right' },
xyz: { id: 'xyz', position: 'bottom' },
},
+ windows: { a: { companionWindowIds: ['abc'] } },
};
it('the companion window type based on the given position', () => {
- const received = getCompanionWindowForPosition(state, { windowId: 'a', position: 'right' });
+ const received = getCompanionWindowForPosition(state, {
+ position: 'right',
+ windowId: 'a',
+ });
expect(received.id).toEqual('abc');
});
it('returns undefined if the given window does not exist', () => {
- const received = getCompanionWindowForPosition(state, { windowId: 'c', position: 'right' });
+ const received = getCompanionWindowForPosition(state, {
+ position: 'right',
+ windowId: 'c',
+ });
expect(received).toBeUndefined();
});
it('returns undefined if a companion window at the given position does not exist', () => {
- const received = getCompanionWindowForPosition(state, { windowId: 'a', position: 'bottom' });
+ const received = getCompanionWindowForPosition(state, {
+ position: 'bottom',
+ windowId: 'a',
+ });
expect(received).toBeUndefined();
});
@@ -115,19 +124,19 @@ describe('getCompanionWindowForPosition', () => {
describe('getCompanionWindowsOfWindow', () => {
const state = {
- windows: {
- abc123: {
- companionWindowIds: ['foo', 'bar'],
- },
- },
companionWindows: {
+ bar: {
+ content: 'canvas',
+ id: 'bar',
+ },
foo: {
- id: 'foo',
content: 'info',
+ id: 'foo',
},
- bar: {
- id: 'bar',
- content: 'canvas',
+ },
+ windows: {
+ abc123: {
+ companionWindowIds: ['foo', 'bar'],
},
},
};
@@ -136,8 +145,14 @@ describe('getCompanionWindowsOfWindow', () => {
const received = getCompanionWindowsOfWindow(state, { windowId: 'abc123' });
expect(received).toEqual([
- { id: 'foo', content: 'info' },
- { id: 'bar', content: 'canvas' },
+ {
+ content: 'info',
+ id: 'foo',
+ },
+ {
+ content: 'canvas',
+ id: 'bar',
+ },
]);
});
});
diff --git a/src/components/App.js b/src/components/App.js
index 37891710b845cafa3c06d8918f3babf31cf5c28e..460ee4f319dd0410424fb83d1197ea25ea5c5596 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -68,11 +68,12 @@ export class App extends Component {
}
App.propTypes = {
+ isFullscreenEnabled: PropTypes.bool,
language: PropTypes.string.isRequired,
+ setWorkspaceFullscreen: PropTypes.func.isRequired,
theme: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
translations: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- isFullscreenEnabled: PropTypes.bool,
- setWorkspaceFullscreen: PropTypes.func.isRequired,
+
};
App.defaultProps = {
diff --git a/src/components/CanvasThumbnail.js b/src/components/CanvasThumbnail.js
index 9e1fd254928ac7b106745dcdff9235d20b5fefda..1443b3485665bc24c36aa265208adde728221ae2 100644
--- a/src/components/CanvasThumbnail.js
+++ b/src/components/CanvasThumbnail.js
@@ -11,7 +11,7 @@ export class CanvasThumbnail extends Component {
*/
constructor(props) {
super(props);
- this.state = { loaded: false, image: null };
+ this.state = { image: null, loaded: false };
this.handleIntersection = this.handleIntersection.bind(this);
}
@@ -26,8 +26,8 @@ export class CanvasThumbnail extends Component {
const image = new Image();
image.src = imageUrl;
this.setState({
- loaded: true,
image,
+ loaded: true,
});
}
@@ -128,19 +128,19 @@ export class CanvasThumbnail extends Component {
CanvasThumbnail.defaultImgPlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mMMDQmtBwADgwF/Op8FmAAAAABJRU5ErkJggg==';
CanvasThumbnail.propTypes = {
+ aspectRatio: PropTypes.number,
imageUrl: PropTypes.string,
isValid: PropTypes.bool,
maxHeight: PropTypes.number,
maxWidth: PropTypes.number,
- aspectRatio: PropTypes.number,
style: PropTypes.object, // eslint-disable-line react/forbid-prop-types,
};
CanvasThumbnail.defaultProps = {
+ aspectRatio: null,
imageUrl: null,
isValid: true,
maxHeight: null,
maxWidth: null,
- aspectRatio: null,
style: {},
};
diff --git a/src/components/CompanionArea.js b/src/components/CompanionArea.js
index 3a00400a7dcde62fe60fe7226594689a8a753b28..566aab4c0753e87a5274111ac13c26e1a75255ba 100644
--- a/src/components/CompanionArea.js
+++ b/src/components/CompanionArea.js
@@ -33,7 +33,12 @@ export class CompanionArea extends Component {
aria-label={companionAreaOpen ? t('collapseSidePanel') : t('expandSidePanel')}
className={classes.toggle}
onClick={() => { setCompanionAreaOpen(windowId, !companionAreaOpen); }}
- TooltipProps={{ style: { right: '0', position: 'absolute' } }}
+ TooltipProps={{
+ style: {
+ position: 'absolute',
+ right: '0',
+ },
+ }}
>
{companionAreaOpen ? <ArrowLeftIcon /> : <ArrowRightIcon />}
</MiradorMenuButton>
@@ -53,18 +58,18 @@ export class CompanionArea extends Component {
CompanionArea.propTypes = {
classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- position: PropTypes.string.isRequired,
- windowId: PropTypes.string.isRequired,
- companionWindows: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
- sideBarOpen: PropTypes.bool,
companionAreaOpen: PropTypes.bool,
+ companionWindows: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
+ position: PropTypes.string.isRequired,
setCompanionAreaOpen: PropTypes.func,
+ sideBarOpen: PropTypes.bool,
t: PropTypes.func.isRequired,
+ windowId: PropTypes.string.isRequired,
};
CompanionArea.defaultProps = {
- sideBarOpen: false,
+ classes: {},
companionAreaOpen: true,
setCompanionAreaOpen: () => {},
- classes: {},
+ sideBarOpen: false,
};
diff --git a/src/components/CompanionWindow.js b/src/components/CompanionWindow.js
index 0fc4093f5cfb61f5f3af662bde675db689d5e462..e9d32030035af4bc929c04d9bc268ffb5a376fea 100644
--- a/src/components/CompanionWindow.js
+++ b/src/components/CompanionWindow.js
@@ -90,28 +90,28 @@ export class CompanionWindow extends Component {
}
CompanionWindow.propTypes = {
+ children: PropTypes.node,
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types,
- paperClassName: PropTypes.string,
id: PropTypes.string.isRequired,
+ isDisplayed: PropTypes.bool,
onCloseClick: PropTypes.func,
- updateCompanionWindow: PropTypes.func,
+ paperClassName: PropTypes.string,
position: PropTypes.string,
- isDisplayed: PropTypes.bool,
t: PropTypes.func,
title: PropTypes.string,
titleControls: PropTypes.node,
+ updateCompanionWindow: PropTypes.func,
windowId: PropTypes.string.isRequired,
- children: PropTypes.node,
};
CompanionWindow.defaultProps = {
- paperClassName: '',
- onCloseClick: () => {},
- updateCompanionWindow: undefined,
+ children: undefined,
isDisplayed: false,
+ onCloseClick: () => {},
+ paperClassName: '',
position: null,
- title: null,
t: key => key,
- children: undefined,
+ title: null,
titleControls: null,
+ updateCompanionWindow: undefined,
};
diff --git a/src/components/CompanionWindowFactory.js b/src/components/CompanionWindowFactory.js
index caa6d67876a64c53d9938b3504ba87a961e96ed7..425c73bc74bd9c895c870e13ba3c4206bd788ade 100644
--- a/src/components/CompanionWindowFactory.js
+++ b/src/components/CompanionWindowFactory.js
@@ -30,8 +30,8 @@ export class CompanionWindowFactory extends Component {
CompanionWindowFactory.propTypes = {
content: PropTypes.string,
- windowId: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
+ windowId: PropTypes.string.isRequired,
};
CompanionWindowFactory.defaultProps = {
diff --git a/src/components/GalleryView.js b/src/components/GalleryView.js
index 5b348e60b074ae4a087279a39e34bf9becdeb404..440a2fcd6bc029f33e42be795f387e20b3d53e57 100644
--- a/src/components/GalleryView.js
+++ b/src/components/GalleryView.js
@@ -65,6 +65,6 @@ export class GalleryView extends Component {
GalleryView.propTypes = {
canvases: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
- window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
setCanvas: PropTypes.func.isRequired,
+ window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
diff --git a/src/components/ManifestForm.js b/src/components/ManifestForm.js
index c4c09f8eb28bd59603ed66f48a291f395116542d..8a83ef7835b5b15a8c06c5370f4f5d8a8417c38f 100644
--- a/src/components/ManifestForm.js
+++ b/src/components/ManifestForm.js
@@ -114,7 +114,7 @@ ManifestForm.propTypes = {
ManifestForm.defaultProps = {
classes: {},
- t: key => key,
onCancel: null,
onSubmit: () => {},
+ t: key => key,
};
diff --git a/src/components/ManifestListItem.js b/src/components/ManifestListItem.js
index fb9f1e9357afa441fe30b3eb3a4324bccf489e91..3a06ac8cdf139968d0b4c867ca0466ebe426fa12 100644
--- a/src/components/ManifestListItem.js
+++ b/src/components/ManifestListItem.js
@@ -54,7 +54,7 @@ export class ManifestListItem extends React.Component {
const placeholder = (
<Grid container className={ns('manifest-list-item')} spacing={24}>
<Grid item xs={3} sm={2}>
- <RectShape color="gray" style={{ width: 120, height: 80 }} />
+ <RectShape color="gray" style={{ height: 80, width: 120 }} />
</Grid>
<Grid item xs={9} sm={6}>
<TextRow color="gray" />
@@ -63,7 +63,7 @@ export class ManifestListItem extends React.Component {
<TextBlock rows={2} color="gray" />
</Grid>
<Grid item xs={4} sm={2}>
- <RectShape color="gray" style={{ width: 60, height: 60 }} />
+ <RectShape color="gray" style={{ height: 60, width: 60 }} />
</Grid>
</Grid>
);
@@ -103,7 +103,7 @@ export class ManifestListItem extends React.Component {
unloader={(
<RectShape
className={classes.placeholder}
- style={{ width: 120, height: 80 }}
+ style={{ height: 80, width: 120 }}
/>
)}
/>
@@ -128,7 +128,7 @@ export class ManifestListItem extends React.Component {
role="presentation"
className={classes.logo}
unloader={
- <RectShape className={classes.placeholder} style={{ width: 60, height: 60 }} />
+ <RectShape className={classes.placeholder} style={{ height: 60, width: 60 }} />
}
/>
</Grid>
@@ -140,32 +140,32 @@ export class ManifestListItem extends React.Component {
}
ManifestListItem.propTypes = {
- manifestId: PropTypes.string.isRequired,
addWindow: PropTypes.func.isRequired,
+ classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ error: PropTypes.string,
+ fetchManifest: PropTypes.func.isRequired,
handleClose: PropTypes.func,
- ready: PropTypes.bool,
- title: PropTypes.string,
- thumbnail: PropTypes.string,
- size: PropTypes.number,
+ isFetching: PropTypes.bool,
+ manifestId: PropTypes.string.isRequired,
manifestLogo: PropTypes.string,
- classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
provider: PropTypes.string,
+ ready: PropTypes.bool,
+ size: PropTypes.number,
t: PropTypes.func,
- fetchManifest: PropTypes.func.isRequired,
- error: PropTypes.string,
- isFetching: PropTypes.bool,
+ thumbnail: PropTypes.string,
+ title: PropTypes.string,
};
ManifestListItem.defaultProps = {
- handleClose: () => {},
- ready: false,
- thumbnail: null,
- title: null,
classes: {},
- size: 0,
- provider: null,
- t: key => key,
error: null,
+ handleClose: () => {},
isFetching: false,
manifestLogo: null,
+ provider: null,
+ ready: false,
+ size: 0,
+ t: key => key,
+ thumbnail: null,
+ title: null,
};
diff --git a/src/components/OpenSeadragonViewer.js b/src/components/OpenSeadragonViewer.js
index 0f14711fa60c0d485685ec191bee1c5a4bd05d86..4c1f9533088aa6d75e18b69215982d846135eb9c 100644
--- a/src/components/OpenSeadragonViewer.js
+++ b/src/components/OpenSeadragonViewer.js
@@ -36,12 +36,13 @@ export class OpenSeadragonViewer extends Component {
return;
}
this.viewer = new OpenSeadragon({
+ alwaysBlend: false,
+ blendTime: 0.1,
id: this.ref.current.id,
+ preserveImageSizeOnResize: true,
preserveViewport: true,
- blendTime: 0.1,
- alwaysBlend: false,
showNavigationControl: false,
- preserveImageSizeOnResize: true,
+
});
this.osdCanvasOverlay = new OpenSeadragonCanvasOverlay(this.viewer);
@@ -64,7 +65,7 @@ export class OpenSeadragonViewer extends Component {
*/
componentDidUpdate(prevProps) {
const {
- tileSources, viewer, annotations, currentCanvases,
+ tileSources, viewer, annotations,
} = this.props;
if (!this.annotationsMatch(prevProps.annotations)) {
this.updateCanvas = () => {
@@ -154,12 +155,12 @@ export class OpenSeadragonViewer extends Component {
return;
}
this.viewer.addTiledImage({
- tileSource,
+ error: event => reject(event),
fitBounds: new OpenSeadragon.Rect(
...new CanvasWorld(currentCanvases).canvasToWorldCoordinates(i),
),
success: event => resolve(event),
- error: event => reject(event),
+ tileSource,
});
});
}
@@ -260,22 +261,23 @@ export class OpenSeadragonViewer extends Component {
OpenSeadragonViewer.defaultProps = {
annotations: [],
children: null,
+ classes: {},
currentCanvases: [],
+ label: null,
tileSources: [],
viewer: null,
- label: null,
- classes: {},
+
};
OpenSeadragonViewer.propTypes = {
annotations: PropTypes.arrayOf(PropTypes.object),
children: PropTypes.element,
+ classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
currentCanvases: PropTypes.arrayOf(PropTypes.object),
+ label: PropTypes.string,
+ t: PropTypes.func.isRequired,
tileSources: PropTypes.arrayOf(PropTypes.object),
- viewer: PropTypes.object, // eslint-disable-line react/forbid-prop-types
updateViewport: PropTypes.func.isRequired,
+ viewer: PropTypes.object, // eslint-disable-line react/forbid-prop-types
windowId: PropTypes.string.isRequired,
- label: PropTypes.string,
- t: PropTypes.func.isRequired,
- classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
diff --git a/src/components/PrimaryWindow.js b/src/components/PrimaryWindow.js
index 85012b38e99d1936350007a8d3f150b47e8c8183..84bbee0b3d304487b575e0484306fcbe490aeaea 100644
--- a/src/components/PrimaryWindow.js
+++ b/src/components/PrimaryWindow.js
@@ -52,8 +52,8 @@ export class PrimaryWindow extends Component {
}
PrimaryWindow.propTypes = {
- window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
manifest: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
PrimaryWindow.defaultProps = {
diff --git a/src/components/SanitizedHtml.js b/src/components/SanitizedHtml.js
index 50ceb4ecf263ddde6ebcbe9c2715aa1269bdaf4a..f91c95fa6bcdec1107877c35530f4d9e4b26d69e 100644
--- a/src/components/SanitizedHtml.js
+++ b/src/components/SanitizedHtml.js
@@ -23,6 +23,6 @@ export class SanitizedHtml extends Component {
}
SanitizedHtml.propTypes = {
- ruleSet: PropTypes.string.isRequired,
htmlString: PropTypes.string.isRequired,
+ ruleSet: PropTypes.string.isRequired,
};
diff --git a/src/components/ThumbnailNavigation.js b/src/components/ThumbnailNavigation.js
index 7950ec197ffa8097afd2af8164b179881f520dce..6dde71069609b19529d7ef4b23a0961be45e518b 100644
--- a/src/components/ThumbnailNavigation.js
+++ b/src/components/ThumbnailNavigation.js
@@ -189,10 +189,10 @@ export class ThumbnailNavigation extends Component {
switch (position) {
case 'far-right':
return {
- height: '100%',
- width: `${this.rightWidth() + this.scrollbarSize + this.spacing}px`,
display: 'flex',
+ height: '100%',
minHeight: 0,
+ width: `${this.rightWidth() + this.scrollbarSize + this.spacing}px`,
};
// Default case bottom
default:
@@ -289,11 +289,11 @@ export class ThumbnailNavigation extends Component {
}
ThumbnailNavigation.propTypes = {
+ canvasGroupings: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
config: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- canvasGroupings: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
position: PropTypes.string.isRequired,
setCanvas: PropTypes.func.isRequired,
- window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func.isRequired,
+ window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
diff --git a/src/components/ViewerNavigation.js b/src/components/ViewerNavigation.js
index 00d47a7c64e6d7736c2adb1f27e100413a635f94..91646a48c3a0867b733d3a98559659fa871e7ca6 100644
--- a/src/components/ViewerNavigation.js
+++ b/src/components/ViewerNavigation.js
@@ -92,6 +92,6 @@ export class ViewerNavigation extends Component {
ViewerNavigation.propTypes = {
canvases: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
setCanvas: PropTypes.func.isRequired,
- window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func.isRequired,
+ window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
diff --git a/src/components/Window.js b/src/components/Window.js
index d07d5e3934ab965d16992dfd60cca4005ac69831..dd493decf73fc9260abc4007833f9790b595ff96 100644
--- a/src/components/Window.js
+++ b/src/components/Window.js
@@ -93,19 +93,19 @@ Window.contextTypes = {
Window.propTypes = {
classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- window: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ focusWindow: PropTypes.func,
+ label: PropTypes.string,
manifest: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- workspaceType: PropTypes.string,
t: PropTypes.func.isRequired,
- label: PropTypes.string,
- focusWindow: PropTypes.func,
+ window: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ workspaceType: PropTypes.string,
};
Window.defaultProps = {
- window: null,
- manifest: null,
- workspaceType: null,
classes: {},
- label: null,
focusWindow: () => {},
+ label: null,
+ manifest: null,
+ window: null,
+ workspaceType: null,
};
diff --git a/src/components/WindowCanvasNavigationControls.js b/src/components/WindowCanvasNavigationControls.js
index ac63128e2144a1c2e1f39230cb144c741c6dc82e..f8315c7070d58e412c5cfddca70c6623ad48c5a9 100644
--- a/src/components/WindowCanvasNavigationControls.js
+++ b/src/components/WindowCanvasNavigationControls.js
@@ -30,8 +30,8 @@ export class WindowCanvasNavigationControls extends Component {
WindowCanvasNavigationControls.propTypes = {
canvases: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
- window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
visible: PropTypes.bool,
+ window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
zoomToWorld: PropTypes.func.isRequired,
};
diff --git a/src/components/WindowList.js b/src/components/WindowList.js
index b73384369c6d946c5b1ed86169e7f6afe132853e..f454d9871f0457801e9dd0804d8aef2484d9fbf8 100644
--- a/src/components/WindowList.js
+++ b/src/components/WindowList.js
@@ -59,13 +59,13 @@ export class WindowList extends Component {
}
WindowList.propTypes = {
+ anchorEl: PropTypes.object, // eslint-disable-line react/forbid-prop-types
containerId: PropTypes.string.isRequired,
focusWindow: PropTypes.func.isRequired,
handleClose: PropTypes.func.isRequired,
- anchorEl: PropTypes.object, // eslint-disable-line react/forbid-prop-types
- windows: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- titles: PropTypes.object, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
+ titles: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ windows: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
WindowList.defaultProps = {
diff --git a/src/components/WindowSideBar.js b/src/components/WindowSideBar.js
index 047de02cf853a317c414711ca376ca4c06d99a1a..554353736e479045f116ead5daf061707e970190 100644
--- a/src/components/WindowSideBar.js
+++ b/src/components/WindowSideBar.js
@@ -24,7 +24,7 @@ export class WindowSideBar extends Component {
className={classNames(classes.drawer)}
classes={{ paper: classNames(classes.paper) }}
anchor="left"
- PaperProps={{ style: { position: 'relative' }, component: 'nav' }}
+ PaperProps={{ component: 'nav', style: { position: 'relative' } }}
SlideProps={{ mountOnEnter: true, unmountOnExit: true }}
open={sideBarOpen}
>
@@ -37,8 +37,8 @@ export class WindowSideBar extends Component {
WindowSideBar.propTypes = {
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types,
- windowId: PropTypes.string.isRequired,
sideBarOpen: PropTypes.bool,
+ windowId: PropTypes.string.isRequired,
};
WindowSideBar.defaultProps = {
diff --git a/src/components/WindowSideBarAnnotationsPanel.js b/src/components/WindowSideBarAnnotationsPanel.js
index 1b784e7987487d85c16ecc4b9b24a74e01ea77a2..994cc9d9385bbb595677efbe636004cc1ecd7227 100644
--- a/src/components/WindowSideBarAnnotationsPanel.js
+++ b/src/components/WindowSideBarAnnotationsPanel.js
@@ -75,16 +75,16 @@ export class WindowSideBarAnnotationsPanel extends Component {
WindowSideBarAnnotationsPanel.propTypes = {
annotations: PropTypes.arrayOf(PropTypes.shape({
- id: PropTypes.string.isRequired,
content: PropTypes.string.isRequired,
+ id: PropTypes.string.isRequired,
})),
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
deselectAnnotation: PropTypes.func.isRequired,
+ id: PropTypes.string.isRequired,
selectAnnotation: PropTypes.func.isRequired,
selectedAnnotationIds: PropTypes.arrayOf(PropTypes.string),
t: PropTypes.func,
windowId: PropTypes.string.isRequired,
- id: PropTypes.string.isRequired,
};
WindowSideBarAnnotationsPanel.defaultProps = {
diff --git a/src/components/WindowSideBarButtons.js b/src/components/WindowSideBarButtons.js
index 190da18eeed13cbe436811e8c92ed38613ae3f78..950986c7ffccff22aae40cf51b9da4990a8ff71b 100644
--- a/src/components/WindowSideBarButtons.js
+++ b/src/components/WindowSideBarButtons.js
@@ -89,16 +89,16 @@ export class WindowSideBarButtons extends Component {
}
WindowSideBarButtons.propTypes = {
- hasAnnotations: PropTypes.bool,
addCompanionWindow: PropTypes.func.isRequired,
+ classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ hasAnnotations: PropTypes.bool,
sideBarPanel: PropTypes.string,
t: PropTypes.func,
- classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
WindowSideBarButtons.defaultProps = {
+ classes: {},
hasAnnotations: false,
sideBarPanel: 'closed',
t: key => key,
- classes: {},
};
diff --git a/src/components/WindowSideBarCanvasPanel.js b/src/components/WindowSideBarCanvasPanel.js
index f8f641fa7e2713a75ee135d4e3308d8f140cfb57..351776664a229480153f4d2c8aef006c8f68ee78 100644
--- a/src/components/WindowSideBarCanvasPanel.js
+++ b/src/components/WindowSideBarCanvasPanel.js
@@ -156,8 +156,8 @@ WindowSideBarCanvasPanel.propTypes = {
canvases: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
config: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
+ id: PropTypes.string.isRequired,
setCanvas: PropTypes.func.isRequired,
t: PropTypes.func.isRequired,
windowId: PropTypes.string.isRequired,
- id: PropTypes.string.isRequired,
};
diff --git a/src/components/WindowSideBarInfoPanel.js b/src/components/WindowSideBarInfoPanel.js
index ea0d3a3b9be2be2a2a7b5bfbdd0d1fd7f9a6b9e4..28bbdc01efcba22d135568d4432ec55477351574 100644
--- a/src/components/WindowSideBarInfoPanel.js
+++ b/src/components/WindowSideBarInfoPanel.js
@@ -81,22 +81,22 @@ WindowSideBarInfoPanel.propTypes = {
canvasDescription: PropTypes.string,
canvasLabel: PropTypes.string,
canvasMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types
- manifestLabel: PropTypes.string,
+ classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ id: PropTypes.string.isRequired,
manifestDescription: PropTypes.string,
+ manifestLabel: PropTypes.string,
manifestMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
windowId: PropTypes.string.isRequired,
- id: PropTypes.string.isRequired,
- classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
};
WindowSideBarInfoPanel.defaultProps = {
canvasDescription: null,
canvasLabel: null,
canvasMetadata: [],
- manifestLabel: null,
+ classes: {},
manifestDescription: null,
+ manifestLabel: null,
manifestMetadata: [],
t: key => key,
- classes: {},
};
diff --git a/src/components/WindowThumbnailSettings.js b/src/components/WindowThumbnailSettings.js
index 9492546ebd2459b4926feb830ccead831dddcd30..0e63933a8cf7f059cd33e6decf440d1974e17d59 100644
--- a/src/components/WindowThumbnailSettings.js
+++ b/src/components/WindowThumbnailSettings.js
@@ -82,10 +82,10 @@ export class WindowThumbnailSettings extends Component {
WindowThumbnailSettings.propTypes = {
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
handleClose: PropTypes.func,
- windowId: PropTypes.string.isRequired,
setWindowThumbnailPosition: PropTypes.func.isRequired,
- thumbnailNavigationPosition: PropTypes.string.isRequired,
t: PropTypes.func,
+ thumbnailNavigationPosition: PropTypes.string.isRequired,
+ windowId: PropTypes.string.isRequired,
};
WindowThumbnailSettings.defaultProps = {
handleClose: () => {},
diff --git a/src/components/WindowTopBar.js b/src/components/WindowTopBar.js
index 739611b05c25c28e8b3dbb55bb2994e9a2b4063f..60fcbf24dde806d70da365c4c40c325c9c54ba4e 100644
--- a/src/components/WindowTopBar.js
+++ b/src/components/WindowTopBar.js
@@ -71,25 +71,25 @@ export class WindowTopBar extends Component {
WindowTopBar.propTypes = {
allowClose: PropTypes.bool,
allowMaximize: PropTypes.bool,
+ classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
+ focused: PropTypes.bool,
manifestTitle: PropTypes.string,
- maximizeWindow: PropTypes.func,
maximized: PropTypes.bool,
+ maximizeWindow: PropTypes.func,
minimizeWindow: PropTypes.func,
removeWindow: PropTypes.func.isRequired,
- windowId: PropTypes.string.isRequired,
- classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- toggleWindowSideBar: PropTypes.func.isRequired,
t: PropTypes.func,
- focused: PropTypes.bool,
+ toggleWindowSideBar: PropTypes.func.isRequired,
+ windowId: PropTypes.string.isRequired,
};
WindowTopBar.defaultProps = {
allowClose: true,
allowMaximize: true,
+ focused: false,
manifestTitle: '',
- maximizeWindow: () => {},
maximized: false,
+ maximizeWindow: () => {},
minimizeWindow: () => {},
t: key => key,
- focused: false,
};
diff --git a/src/components/WindowTopMenu.js b/src/components/WindowTopMenu.js
index d8622f15013a8bc5670ab141a28c96b139b2dcef..fb9cccd06e94300c8935c4cb63f4b4060174f4d3 100644
--- a/src/components/WindowTopMenu.js
+++ b/src/components/WindowTopMenu.js
@@ -25,12 +25,12 @@ export class WindowTopMenu extends Component {
container={document.querySelector(`#${containerId} .${ns('viewer')}`)}
anchorEl={anchorEl}
anchorOrigin={{
- vertical: 'bottom',
horizontal: 'right',
+ vertical: 'bottom',
}}
transformOrigin={{
- vertical: 'top',
horizontal: 'right',
+ vertical: 'top',
}}
getContentAnchorEl={null}
open={Boolean(anchorEl)}
@@ -46,10 +46,10 @@ export class WindowTopMenu extends Component {
}
WindowTopMenu.propTypes = {
+ anchorEl: PropTypes.object, // eslint-disable-line react/forbid-prop-types
containerId: PropTypes.string.isRequired,
- windowId: PropTypes.string.isRequired,
handleClose: PropTypes.func.isRequired,
- anchorEl: PropTypes.object, // eslint-disable-line react/forbid-prop-types
+ windowId: PropTypes.string.isRequired,
};
WindowTopMenu.defaultProps = {
diff --git a/src/components/WindowTopMenuButton.js b/src/components/WindowTopMenuButton.js
index 94df821248b4b254d15bd038ba8a497a872cc2e7..15ac65c33e9c69051c07a0b0682c67e87fa9adb3 100644
--- a/src/components/WindowTopMenuButton.js
+++ b/src/components/WindowTopMenuButton.js
@@ -68,9 +68,9 @@ export class WindowTopMenuButton extends Component {
}
WindowTopMenuButton.propTypes = {
- windowId: PropTypes.string.isRequired,
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
+ windowId: PropTypes.string.isRequired,
};
WindowTopMenuButton.defaultProps = {
diff --git a/src/components/WindowViewSettings.js b/src/components/WindowViewSettings.js
index 52600ed96a3b84381f0c90799142af658a504095..e510446f15bdbd0e39b2db43307097a9032fca81 100644
--- a/src/components/WindowViewSettings.js
+++ b/src/components/WindowViewSettings.js
@@ -101,10 +101,10 @@ export class WindowViewSettings extends Component {
WindowViewSettings.propTypes = {
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
handleClose: PropTypes.func,
- windowId: PropTypes.string.isRequired,
setWindowViewType: PropTypes.func.isRequired,
- windowViewType: PropTypes.string.isRequired,
t: PropTypes.func,
+ windowId: PropTypes.string.isRequired,
+ windowViewType: PropTypes.string.isRequired,
};
WindowViewSettings.defaultProps = {
handleClose: () => {},
diff --git a/src/components/WindowViewer.js b/src/components/WindowViewer.js
index 43bd1d20ac1a875e81bece4b3db0ae1ce631c7d4..87fabc8dc80882e46edc6007e30d8d98a4c8e7bd 100644
--- a/src/components/WindowViewer.js
+++ b/src/components/WindowViewer.js
@@ -138,8 +138,8 @@ export class WindowViewer extends Component {
WindowViewer.propTypes = {
canvases: PropTypes.array.isRequired, // eslint-disable-line react/forbid-prop-types
- infoResponses: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
fetchAnnotation: PropTypes.func.isRequired,
fetchInfoResponse: PropTypes.func.isRequired,
+ infoResponses: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
window: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
};
diff --git a/src/components/Workspace.js b/src/components/Workspace.js
index 5f975288249e5ed8544acaaa110d6ed76b127277..bf410727a9d7990aa43a2da90b6ccc0039de43cb 100644
--- a/src/components/Workspace.js
+++ b/src/components/Workspace.js
@@ -81,7 +81,7 @@ export class Workspace extends React.Component {
Workspace.propTypes = {
isWorkspaceControlPanelVisible: PropTypes.bool.isRequired,
+ t: PropTypes.func.isRequired,
windows: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
workspaceType: PropTypes.string.isRequired, // eslint-disable-line react/forbid-prop-types
- t: PropTypes.func.isRequired,
};
diff --git a/src/components/WorkspaceAdd.js b/src/components/WorkspaceAdd.js
index 5b78d76d80f409fd59b3564f51c84774bf872ec9..789baab598dfa74012f3ee3f796c0738fe801fde 100644
--- a/src/components/WorkspaceAdd.js
+++ b/src/components/WorkspaceAdd.js
@@ -117,9 +117,9 @@ export class WorkspaceAdd extends React.Component {
}
WorkspaceAdd.propTypes = {
+ classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
manifests: PropTypes.instanceOf(Object).isRequired,
setWorkspaceAddVisibility: PropTypes.func.isRequired,
- classes: PropTypes.object, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
};
diff --git a/src/components/WorkspaceAddButton.js b/src/components/WorkspaceAddButton.js
index cce8cff503d368d86f5ee80a2920d2fd4655bccb..e8c24c252998ec0c5e317e5f663a35b8774ce488 100644
--- a/src/components/WorkspaceAddButton.js
+++ b/src/components/WorkspaceAddButton.js
@@ -38,12 +38,12 @@ export class WorkspaceAddButton extends Component {
WorkspaceAddButton.propTypes = {
classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- t: PropTypes.func,
- setWorkspaceAddVisibility: PropTypes.func.isRequired,
isWorkspaceAddVisible: PropTypes.bool,
+ setWorkspaceAddVisibility: PropTypes.func.isRequired,
+ t: PropTypes.func,
};
WorkspaceAddButton.defaultProps = {
- t: key => key,
isWorkspaceAddVisible: false,
+ t: key => key,
};
diff --git a/src/components/WorkspaceElastic.js b/src/components/WorkspaceElastic.js
index 412d848d7520c6450f32e49c6ddd89bc4c72855e..1a14a0131a9a585edb41685d6e58a566e0639822 100644
--- a/src/components/WorkspaceElastic.js
+++ b/src/components/WorkspaceElastic.js
@@ -28,28 +28,28 @@ class WorkspaceElastic extends React.Component {
const offsetY = workspace.height / 2;
return (
- <div style={{ position: 'relative', width: '100%', height: '100%' }}>
+ <div style={{ height: '100%', position: 'relative', width: '100%' }}>
<ResizeObserver
onResize={(rect) => { setWorkspaceViewportDimensions(rect); }}
/>
<Rnd
default={{
- width: workspace.width,
height: workspace.height,
+ width: workspace.width,
}}
position={{
x: -1 * viewportPosition.x - offsetX, y: -1 * viewportPosition.y - offsetY,
}}
enableResizing={{
- top: false,
- right: false,
bottom: false,
- left: false,
- topRight: false,
- bottomRight: false,
bottomLeft: false,
+ bottomRight: false,
+ left: false,
+ right: false,
+ top: false,
topLeft: false,
+ topRight: false,
}}
onDragStop={(e, d) => {
setWorkspaceViewportPosition({ x: -1 * d.x - offsetX, y: -1 * d.y - offsetY });
@@ -61,7 +61,7 @@ class WorkspaceElastic extends React.Component {
Object.values(windows).map(window => (
<Rnd
key={window.id}
- size={{ width: window.width, height: window.height }}
+ size={{ height: window.height, width: window.width }}
position={{ x: window.x + offsetX, y: window.y + offsetY }}
bounds="parent"
onDragStop={(e, d) => {
@@ -69,8 +69,8 @@ class WorkspaceElastic extends React.Component {
}}
onResize={(e, direction, ref, delta, position) => {
setWindowSize(window.id, {
- width: ref.style.width,
height: ref.style.height,
+ width: ref.style.width,
x: position.x - offsetX,
y: position.y - offsetY,
});
@@ -93,12 +93,12 @@ class WorkspaceElastic extends React.Component {
}
WorkspaceElastic.propTypes = {
- setWorkspaceViewportPosition: PropTypes.func.isRequired,
+ setWindowSize: PropTypes.func.isRequired,
setWorkspaceViewportDimensions: PropTypes.func.isRequired,
+ setWorkspaceViewportPosition: PropTypes.func.isRequired,
+ updateWindowPosition: PropTypes.func.isRequired,
windows: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
workspace: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- updateWindowPosition: PropTypes.func.isRequired,
- setWindowSize: PropTypes.func.isRequired,
};
export default WorkspaceElastic;
diff --git a/src/components/WorkspaceExport.js b/src/components/WorkspaceExport.js
index 5d3bbad821b83c4b8f22c4bd361edc3595cca589..1bc968fe519b937640fd0085501f633bbb178768 100644
--- a/src/components/WorkspaceExport.js
+++ b/src/components/WorkspaceExport.js
@@ -46,17 +46,17 @@ export class WorkspaceExport extends Component {
}
WorkspaceExport.propTypes = {
+ children: PropTypes.node,
container: PropTypes.object, // eslint-disable-line react/forbid-prop-types
handleClose: PropTypes.func.isRequired,
open: PropTypes.bool, // eslint-disable-line react/forbid-prop-types
- children: PropTypes.node,
state: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
};
WorkspaceExport.defaultProps = {
+ children: null,
container: null,
open: false,
- children: null,
t: key => key,
};
diff --git a/src/components/WorkspaceFullScreenButton.js b/src/components/WorkspaceFullScreenButton.js
index 20b74c455a1443dbdd4c627c4b57890c61a6b2d8..2d5f5876794502174f2e1583e1b23aa5664def78 100644
--- a/src/components/WorkspaceFullScreenButton.js
+++ b/src/components/WorkspaceFullScreenButton.js
@@ -27,9 +27,9 @@ export class WorkspaceFullScreenButton extends Component {
}
WorkspaceFullScreenButton.propTypes = {
+ classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
isFullscreenEnabled: PropTypes.bool,
setWorkspaceFullscreen: PropTypes.func.isRequired,
- classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
};
diff --git a/src/components/WorkspaceMenu.js b/src/components/WorkspaceMenu.js
index 13c6977a1e27cca5ea8e03ff352132baa1f96a7b..8817be792f2c9f9de3a21033ee635a2e1658c513 100644
--- a/src/components/WorkspaceMenu.js
+++ b/src/components/WorkspaceMenu.js
@@ -23,11 +23,11 @@ export class WorkspaceMenu extends Component {
constructor(props) {
super(props);
this.state = {
- windowList: {},
+ exportWorkspace: {},
+ settings: {},
toggleZoom: {},
+ windowList: {},
workspaceSelection: {},
- settings: {},
- exportWorkspace: {},
};
this.handleMenuItemClick = this.handleMenuItemClick.bind(this);
this.handleMenuItemClose = this.handleMenuItemClose.bind(this);
@@ -95,12 +95,12 @@ export class WorkspaceMenu extends Component {
container={container}
anchorEl={anchorEl}
anchorOrigin={{
- vertical: 'top',
horizontal: 'right',
+ vertical: 'top',
}}
transformOrigin={{
- vertical: 'top',
horizontal: 'left',
+ vertical: 'top',
}}
open={Boolean(anchorEl)}
onClose={handleClose}
@@ -185,17 +185,17 @@ export class WorkspaceMenu extends Component {
}
WorkspaceMenu.propTypes = {
+ anchorEl: PropTypes.object, // eslint-disable-line react/forbid-prop-types
containerId: PropTypes.string.isRequired,
handleClose: PropTypes.func.isRequired,
- toggleZoomControls: PropTypes.func,
showZoomControls: PropTypes.bool,
- anchorEl: PropTypes.object, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
+ toggleZoomControls: PropTypes.func,
};
WorkspaceMenu.defaultProps = {
anchorEl: null,
- t: key => key,
showZoomControls: false,
+ t: key => key,
toggleZoomControls: () => {},
};
diff --git a/src/components/WorkspaceSelectionDialog.js b/src/components/WorkspaceSelectionDialog.js
index 8b4f4e8299d3e650443bf34c0e21697b163375fa..3721c1c95d7490a615605d8db45a3b805d007657 100644
--- a/src/components/WorkspaceSelectionDialog.js
+++ b/src/components/WorkspaceSelectionDialog.js
@@ -43,8 +43,8 @@ export class WorkspaceSelectionDialog extends Component {
});
}}
inputProps={{
- name: 'workspace',
id: 'workspace-type',
+ name: 'workspace',
}}
>
<MenuItem value="elastic">{t('elastic')}</MenuItem>
@@ -58,18 +58,18 @@ export class WorkspaceSelectionDialog extends Component {
}
WorkspaceSelectionDialog.propTypes = {
+ children: PropTypes.node,
container: PropTypes.object, // eslint-disable-line react/forbid-prop-types
handleClose: PropTypes.func.isRequired,
open: PropTypes.bool, // eslint-disable-line react/forbid-prop-types
- children: PropTypes.node,
+ t: PropTypes.func,
updateConfig: PropTypes.func.isRequired,
workspaceType: PropTypes.string.isRequired,
- t: PropTypes.func,
};
WorkspaceSelectionDialog.defaultProps = {
+ children: null,
container: null,
open: false,
- children: null,
t: key => key,
};
diff --git a/src/components/WorkspaceSettings.js b/src/components/WorkspaceSettings.js
index 263651ed3a31ace46b2cfbd040813c051b21d7b6..7d45237145385c9d27faa164a16e462b522da0fc 100644
--- a/src/components/WorkspaceSettings.js
+++ b/src/components/WorkspaceSettings.js
@@ -63,8 +63,8 @@ export class WorkspaceSettings extends Component {
value={theme.palette.type}
onChange={this.handleThemeChange}
inputProps={{
- name: 'theme',
id: 'theme-simple',
+ name: 'theme',
}}
>
<MenuItem value="light">{t('light')}</MenuItem>
@@ -78,18 +78,18 @@ export class WorkspaceSettings extends Component {
}
WorkspaceSettings.propTypes = {
+ children: PropTypes.node,
container: PropTypes.object, // eslint-disable-line react/forbid-prop-types
handleClose: PropTypes.func.isRequired,
open: PropTypes.bool, // eslint-disable-line react/forbid-prop-types
- children: PropTypes.node,
- updateConfig: PropTypes.func.isRequired,
- theme: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
t: PropTypes.func,
+ theme: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
+ updateConfig: PropTypes.func.isRequired,
};
WorkspaceSettings.defaultProps = {
+ children: null,
container: null,
open: false,
- children: null,
t: key => key,
};
diff --git a/src/components/ZoomControls.js b/src/components/ZoomControls.js
index 71e1d7702454d0f43a324d966d3aedbc05441fe6..ab0a9bb75890c635edbdfb3f8e036c6e503839e5 100644
--- a/src/components/ZoomControls.js
+++ b/src/components/ZoomControls.js
@@ -76,23 +76,23 @@ export class ZoomControls extends Component {
}
ZoomControls.propTypes = {
- windowId: PropTypes.string,
+ classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
showZoomControls: PropTypes.bool,
+ t: PropTypes.func,
+ updateViewport: PropTypes.func,
viewer: PropTypes.shape({
x: PropTypes.number,
y: PropTypes.number,
zoom: PropTypes.number,
}),
- updateViewport: PropTypes.func,
- classes: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types
- t: PropTypes.func,
+ windowId: PropTypes.string,
zoomToWorld: PropTypes.func.isRequired,
};
ZoomControls.defaultProps = {
- windowId: '',
showZoomControls: false,
- viewer: {},
- updateViewport: () => {},
t: key => key,
+ updateViewport: () => {},
+ viewer: {},
+ windowId: '',
};
diff --git a/src/containers/App.js b/src/containers/App.js
index 8a2754138bc6124cfe3c978c03c6b33e651ebbaf..441db5210b216b6b30597713fdcbb55e9572466a 100644
--- a/src/containers/App.js
+++ b/src/containers/App.js
@@ -12,10 +12,10 @@ import { App } from '../components/App';
*/
const mapStateToProps = state => (
{
+ isFullscreenEnabled: state.workspace.isFullscreenEnabled,
language: state.config.language,
theme: state.config.theme,
translations: state.config.translations,
- isFullscreenEnabled: state.workspace.isFullscreenEnabled,
}
);
diff --git a/src/containers/CompanionArea.js b/src/containers/CompanionArea.js
index 3eacbb201c24bff3b597a26bc2afe33606dc2834..7f4d10bd781817fea8fd58f22cfb7a7284d6467c 100644
--- a/src/containers/CompanionArea.js
+++ b/src/containers/CompanionArea.js
@@ -9,10 +9,9 @@ import { CompanionArea } from '../components/CompanionArea';
/** */
const mapStateToProps = (state, { windowId, position }) => ({
- sideBarOpen: state.windows[windowId].sideBarOpen,
companionWindows: getCompanionWindowsOfWindow(state, { windowId })
.filter(cw => cw.position === position),
- companionAreaOpen: position !== 'left' || state.windows[windowId].companionAreaOpen,
+ sideBarOpen: state.windows[windowId].sideBarOpen,
});
const mapDispatchToProps = ({
@@ -21,24 +20,25 @@ const mapDispatchToProps = ({
/** */
const styles = theme => ({
- root: {
- position: 'relative',
- minHeight: 0,
- display: 'flex',
- },
horizontal: {
- width: '100%',
flexDirection: 'column',
+ width: '100%',
+ },
+ root: {
+ display: 'flex',
+ minHeight: 0,
+ position: 'relative',
},
toggle: {
- position: 'absolute',
- width: '1rem',
- zIndex: theme.zIndex.drawer,
backgroundColor: theme.palette.background.paper,
border: `1px solid ${theme.palette.primary.dark}`,
borderRadius: 0,
- padding: 2,
+ left: '100%',
marginTop: '1rem',
+ padding: 2,
+ position: 'absolute',
+ width: '1rem',
+ zIndex: theme.zIndex.drawer,
},
});
diff --git a/src/containers/CompanionWindow.js b/src/containers/CompanionWindow.js
index 09ab2c2a82fa1bf1ddbe5d869b2ff4b18630fcfa..ec863a90b630aeb56010ace3a7a8e883506dd6c9 100644
--- a/src/containers/CompanionWindow.js
+++ b/src/containers/CompanionWindow.js
@@ -41,23 +41,8 @@ const mapDispatchToProps = (dispatch, { windowId, id }) => ({
* root: {overflowY: string, width: string}}}
*/
const styles = theme => ({
- windowSideBarTitle: {
- ...theme.typography.subtitle1,
- flexGrow: 1,
- },
- root: {
- display: 'flex',
- minHeight: 0,
- boxShadow: 'none',
- flexDirection: 'column',
- boxSizing: 'border-box',
- },
- horizontal: {
- height: '201px',
- width: '100%',
- },
- vertical: {
- width: '201px',
+ 'companionWindow-bottom': {
+ borderTop: '0.5px solid rgba(0, 0, 0, 0.12)',
},
'companionWindow-left': {
@@ -65,20 +50,36 @@ const styles = theme => ({
'companionWindow-right': {
borderLeft: '0.5px solid rgba(0, 0, 0, 0.12)',
},
- 'companionWindow-bottom': {
- borderTop: '0.5px solid rgba(0, 0, 0, 0.12)',
+
+ content: {
+ overflowY: 'auto',
+ },
+ horizontal: {
+ height: '201px',
+ width: '100%',
+ },
+ leftPadding: {
+ paddingLeft: theme.spacing.unit * 2,
},
positionButton: {
order: -100,
},
+ root: {
+ boxShadow: 'none',
+ boxSizing: 'border-box',
+ display: 'flex',
+ flexDirection: 'column',
+ minHeight: 0,
+ },
toolbar: {
minHeight: 'max-content',
},
- leftPadding: {
- paddingLeft: theme.spacing.unit * 2,
+ vertical: {
+ width: '201px',
},
- content: {
- overflowY: 'auto',
+ windowSideBarTitle: {
+ ...theme.typography.subtitle1,
+ flexGrow: 1,
},
});
diff --git a/src/containers/ManifestListItem.js b/src/containers/ManifestListItem.js
index 459db22610334e4163fcec3f8a76e4bb90432b2d..56291875610b892d22f802bc7232ca07c44fb964 100644
--- a/src/containers/ManifestListItem.js
+++ b/src/containers/ManifestListItem.js
@@ -15,14 +15,14 @@ const mapStateToProps = (state, { manifestId }) => {
const manifest = state.manifests[manifestId];
return {
- ready: !!manifest.json,
error: manifest.error,
isFetching: manifest.isFetching,
- title: getManifestTitle(state, { manifestId }),
- thumbnail: getManifestThumbnail(state, { manifestId }),
+ manifestLogo: getManifestLogo(state, { manifestId }),
provider: manifest.provider || getManifestProvider(state, { manifestId }),
+ ready: !!manifest.json,
size: getManifestCanvases(state, { manifestId }).length,
- manifestLogo: getManifestLogo(state, { manifestId }),
+ thumbnail: getManifestThumbnail(state, { manifestId }),
+ title: getManifestTitle(state, { manifestId }),
};
};
@@ -39,12 +39,9 @@ const mapDispatchToProps = { addWindow: actions.addWindow, fetchManifest: action
* @returns {{root: {}, label: {textAlign: string, textTransform: string}}}
*/
const styles = theme => ({
- root: {
- ...theme.mixins.gutters(),
- },
label: {
- textTransform: 'initial',
textAlign: 'left',
+ textTransform: 'initial',
},
logo: {
height: '2.5rem',
@@ -53,6 +50,9 @@ const styles = theme => ({
placeholder: {
backgroundColor: theme.palette.grey[300],
},
+ root: {
+ ...theme.mixins.gutters(),
+ },
});
const enhance = compose(
diff --git a/src/containers/OpenSeadragonViewer.js b/src/containers/OpenSeadragonViewer.js
index 1959e3638dd03181abbfd96bd51942cb9368cd48..392f9d6e64aa0aabdca3c3ed2ebe6fab1fabc799 100644
--- a/src/containers/OpenSeadragonViewer.js
+++ b/src/containers/OpenSeadragonViewer.js
@@ -20,14 +20,20 @@ import {
const mapStateToProps = ({
viewers, windows, manifests, annotations,
}, { windowId, currentCanvases }) => ({
- viewer: viewers[windowId],
- label: getCanvasLabel({ windows, manifests }, { windowId, canvasIndex: 'selected' }),
annotations: getAllOrSelectedAnnotations(
{ annotations, windows },
windowId,
currentCanvases.map(c => c.id),
getSelectedAnnotationIds({ windows }, windowId, currentCanvases.map(c => c.id)),
),
+ label: getCanvasLabel({
+ manifests,
+ windows,
+ }, {
+ canvasIndex: 'selected',
+ windowId,
+ }),
+ viewer: viewers[windowId],
});
/**
@@ -46,11 +52,11 @@ const mapDispatchToProps = {
*/
const styles = theme => ({
controls: {
- width: '100%',
- position: 'absolute',
+ backgroundColor: fade(theme.palette.background.paper, 0.5),
bottom: 0,
+ position: 'absolute',
+ width: '100%',
zIndex: 50,
- backgroundColor: fade(theme.palette.background.paper, 0.5),
},
});
diff --git a/src/containers/ThumbnailNavigation.js b/src/containers/ThumbnailNavigation.js
index e3bddc280c3ac8ef2d59b72f36565f5b8161a85a..88cfb7b4957b26f39c51038bd822d0228fea9f1d 100644
--- a/src/containers/ThumbnailNavigation.js
+++ b/src/containers/ThumbnailNavigation.js
@@ -16,12 +16,15 @@ const mapStateToProps = ({
companionWindows, config, manifests, windows,
}, { windowId }) => ({
canvasGroupings: new CanvasGroupings(
- getManifestCanvases({ windows, manifests }, { windowId }),
+ getManifestCanvases({
+ manifests,
+ windows,
+ }, { windowId }),
windows[windowId].view,
),
+ config,
position: companionWindows[windows[windowId].thumbnailNavigationId].position,
window: windows[windowId],
- config,
});
/**
@@ -37,17 +40,17 @@ const mapDispatchToProps = {
* Styles for withStyles HOC
*/
const styles = theme => ({
- currentCanvas: {
- },
canvas: {
+ '&$currentCanvas': {
+ border: `2px solid ${theme.palette.secondary.main}`,
+ },
border: '2px solid transparent',
color: theme.palette.common.white,
cursor: 'pointer',
- padding: '2px',
margin: '2px',
- '&$currentCanvas': {
- border: `2px solid ${theme.palette.secondary.main}`,
- },
+ padding: '2px',
+ },
+ currentCanvas: {
},
root: {
background: 'linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.3) 70%, rgba(0,0,0,0) 100%)',
diff --git a/src/containers/ViewerInfo.js b/src/containers/ViewerInfo.js
index ad0fcfd101cae2559d82297fba95bb783c78825b..f268c55bd996b752047d124748fffea07e621643 100644
--- a/src/containers/ViewerInfo.js
+++ b/src/containers/ViewerInfo.js
@@ -18,7 +18,10 @@ const mapStateToProps = (state, props) => {
return {
canvasCount: canvases.length,
canvasIndex,
- canvasLabel: getCanvasLabel(state, { windowId, canvasIndex }),
+ canvasLabel: getCanvasLabel(state, {
+ canvasIndex,
+ windowId,
+ }),
};
};
diff --git a/src/containers/Window.js b/src/containers/Window.js
index 2bdfa90e2efd6bec46fd4ec38207ad7db1f1a82e..1f044d255a60c1ff5a85dab4e3a1b4ab96bb73d1 100644
--- a/src/containers/Window.js
+++ b/src/containers/Window.js
@@ -14,11 +14,11 @@ import { getManifestTitle, getThumbnailNavigationPosition } from '../state/selec
* @private
*/
const mapStateToProps = (state, props) => ({
+ label: getManifestTitle(state, { windowId: props.window.id }),
manifest: state.manifests[props.window.manifestId],
+ thumbnailNavigationPosition: getThumbnailNavigationPosition(state, { windowId: props.window.id }),
window: state.windows[props.window.id],
workspaceType: state.config.workspace.type,
- label: getManifestTitle(state, { windowId: props.window.id }),
- thumbnailNavigationPosition: getThumbnailNavigationPosition(state, { windowId: props.window.id }),
});
/**
@@ -34,44 +34,35 @@ const mapDispatchToProps = (dispatch, { window }) => ({
* @param theme
*/
const styles = theme => ({
- window: {
- backgroundColor: theme.palette.primary.dark,
+ companionAreaBottom: {
display: 'flex',
- flexDirection: 'column',
- height: '100%',
- width: '100%',
+ flex: '0',
+ flexBasis: 'auto',
+ minHeight: 0,
+ },
+ companionAreaRight: {
+ display: 'flex',
+ flex: '0',
minHeight: 0,
- overflow: 'hidden',
},
middle: {
display: 'flex',
- flexDirection: 'row',
flex: '1',
+ flexDirection: 'row',
minHeight: 0,
},
middleLeft: {
display: 'flex',
- flexDirection: 'column',
flex: '1',
+ flexDirection: 'column',
minHeight: 0,
},
primaryWindow: {
display: 'flex',
flex: '1',
- position: 'relative',
height: '300px',
minHeight: 0,
- },
- companionAreaRight: {
- display: 'flex',
- flex: '0',
- minHeight: 0,
- },
- companionAreaBottom: {
- display: 'flex',
- flex: '0',
- minHeight: 0,
- flexBasis: 'auto',
+ position: 'relative',
},
thumbnailArea: {
backgroundColor: theme.palette.primary.dark,
@@ -81,6 +72,15 @@ const styles = theme => ({
thumbnailAreaRight: {
minWidth: 100,
},
+ window: {
+ backgroundColor: theme.palette.primary.dark,
+ display: 'flex',
+ flexDirection: 'column',
+ height: '100%',
+ minHeight: 0,
+ overflow: 'hidden',
+ width: '100%',
+ },
});
const enhance = compose(
diff --git a/src/containers/WindowCanvasNavigationControls.js b/src/containers/WindowCanvasNavigationControls.js
index a8b8384879ab07c538f816113fa62e11a48b292b..56e1966c684d0c3531a92702502be4352683c4c6 100644
--- a/src/containers/WindowCanvasNavigationControls.js
+++ b/src/containers/WindowCanvasNavigationControls.js
@@ -8,9 +8,12 @@ import { WindowCanvasNavigationControls } from '../components/WindowCanvasNaviga
/** */
const mapStateToProps = (state, { windowId }) => ({
- window: state.windows[windowId],
- canvasLabel: getCanvasLabel(state, { windowId, canvasIndex: 'selected' }),
+ canvasLabel: getCanvasLabel(state, {
+ canvasIndex: 'selected',
+ windowId,
+ }),
visible: state.workspace.focusedWindowId === windowId,
+ window: state.windows[windowId],
});
const enhance = compose(
diff --git a/src/containers/WindowSideBar.js b/src/containers/WindowSideBar.js
index d9060709081ca0c7a65857a15feac194c50661ee..5960ff22a1e14ec93af02398003d14f85f350bbc 100644
--- a/src/containers/WindowSideBar.js
+++ b/src/containers/WindowSideBar.js
@@ -23,21 +23,21 @@ const mapStateToProps = (state, props) => (
* drawer: {overflowX: string, left: number, flexShrink: number, width: number, height: string}}}
*/
const styles = theme => ({
- toolbar: theme.mixins.toolbar,
- paper: {
- overflowX: 'hidden',
- width: 48,
- },
drawer: {
- left: 0,
flexShrink: 0,
height: '100%',
- zIndex: theme.zIndex.appBar - 1,
+ left: 0,
order: -1000,
+ zIndex: theme.zIndex.appBar - 1,
},
grow: {
flexGrow: 1,
},
+ paper: {
+ overflowX: 'hidden',
+ width: 48,
+ },
+ toolbar: theme.mixins.toolbar,
});
const enhance = compose(
diff --git a/src/containers/WindowSideBarAnnotationsPanel.js b/src/containers/WindowSideBarAnnotationsPanel.js
index b303fa71a0a989e71d25255a67903d2fa704a086..12b90c12df81541b918deb5f504cb826a0ae2e6f 100644
--- a/src/containers/WindowSideBarAnnotationsPanel.js
+++ b/src/containers/WindowSideBarAnnotationsPanel.js
@@ -19,9 +19,6 @@ import { WindowSideBarAnnotationsPanel } from '../components/WindowSideBarAnnota
* @private
*/
const mapStateToProps = (state, { windowId }) => ({
- selectedAnnotationIds: getSelectedAnnotationIds(
- state, windowId, getSelectedCanvases(state, { windowId }).map(canvas => canvas.id),
- ),
annotations: getIdAndContentOfResources(
getAnnotationResourcesByMotivation(
getSelectedTargetsAnnotations(
@@ -31,6 +28,9 @@ const mapStateToProps = (state, { windowId }) => ({
['oa:commenting', 'sc:painting'],
),
),
+ selectedAnnotationIds: getSelectedAnnotationIds(
+ state, windowId, getSelectedCanvases(state, { windowId }).map(canvas => canvas.id),
+ ),
});
/**
@@ -39,15 +39,12 @@ const mapStateToProps = (state, { windowId }) => ({
* @private
*/
const mapDispatchToProps = {
- selectAnnotation: actions.selectAnnotation,
deselectAnnotation: actions.deselectAnnotation,
+ selectAnnotation: actions.selectAnnotation,
};
/** */
const styles = theme => ({
- selectedAnnotation: {
- backgroundColor: theme.palette.background.default,
- },
section: {
borderBottom: '.5px solid rgba(0,0,0,0.25)',
paddingBottom: theme.spacing.unit,
@@ -55,6 +52,9 @@ const styles = theme => ({
paddingRight: theme.spacing.unit,
paddingTop: theme.spacing.unit * 2,
},
+ selectedAnnotation: {
+ backgroundColor: theme.palette.background.default,
+ },
});
const enhance = compose(
diff --git a/src/containers/WindowSideBarButtons.js b/src/containers/WindowSideBarButtons.js
index 17dbfd7bc913e57fc69f5e10cb1a938417098c63..4e0e8d5b2b74122429fa9c46be31295f89edab5e 100644
--- a/src/containers/WindowSideBarButtons.js
+++ b/src/containers/WindowSideBarButtons.js
@@ -36,35 +36,38 @@ const mapStateToProps = (state, { windowId }) => ({
getSelectedTargetAnnotations(state, (getSelectedCanvas(state, { windowId }) || {}).id),
['oa:commenting', 'sc:painting'],
).length > 0,
- sideBarPanel: (getCompanionWindowForPosition(state, { windowId, position: 'left' }) || {}).content,
+ sideBarPanel: (getCompanionWindowForPosition(state, {
+ position: 'left',
+ windowId,
+ }) || {}).content,
});
/** */
const style = theme => ({
- tabsFlexContainer: {
- flexDirection: 'column',
- },
- tabsIndicator: {
- display: 'none',
- },
tab: {
- minWidth: 'auto',
- borderRight: '4px solid transparent',
'&:hover': {
- textDecoration: 'none',
- backgroundColor: fade(theme.palette.text.primary, theme.palette.action.hoverOpacity),
- // Reset on touch devices, it doesn't add specificity
'@media (hover: none)': {
backgroundColor: 'transparent',
},
+ backgroundColor: fade(theme.palette.text.primary, theme.palette.action.hoverOpacity),
+ textDecoration: 'none',
+ // Reset on touch devices, it doesn't add specificity
},
+ borderRight: '4px solid transparent',
+ minWidth: 'auto',
},
tabSelected: {
- backgroundColor: theme.palette.secondary.light,
- borderRight: `4px solid ${theme.palette.secondary.main}`,
'&:hover': {
backgroundColor: theme.palette.secondary.light,
},
+ backgroundColor: theme.palette.secondary.light,
+ borderRight: `4px solid ${theme.palette.secondary.main}`,
+ },
+ tabsFlexContainer: {
+ flexDirection: 'column',
+ },
+ tabsIndicator: {
+ display: 'none',
},
});
diff --git a/src/containers/WindowSideBarInfoPanel.js b/src/containers/WindowSideBarInfoPanel.js
index e55cc7a520ad0537a6f9c6330c49e50adc32ffc5..1b27326400e14389bc6c78bc23b636b2f433406c 100644
--- a/src/containers/WindowSideBarInfoPanel.js
+++ b/src/containers/WindowSideBarInfoPanel.js
@@ -20,11 +20,11 @@ import { WindowSideBarInfoPanel } from '../components/WindowSideBarInfoPanel';
* @private
*/
const mapStateToProps = (state, { windowId }) => ({
- canvasLabel: getCanvasLabel(state, { windowId, canvasIndex: 'selected' }),
- canvasDescription: getCanvasDescription(state, { windowId, canvasIndex: 'selected' }),
+ canvasDescription: getCanvasDescription(state, { canvasIndex: 'selected', windowId }),
+ canvasLabel: getCanvasLabel(state, { canvasIndex: 'selected', windowId }),
canvasMetadata: getDestructuredMetadata(getSelectedCanvas(state, { windowId })),
- manifestLabel: getManifestTitle(state, { windowId }),
manifestDescription: getManifestDescription(state, { windowId }),
+ manifestLabel: getManifestTitle(state, { windowId }),
manifestMetadata: getManifestMetadata(state, { windowId }),
});
diff --git a/src/containers/WindowThumbnailSettings.js b/src/containers/WindowThumbnailSettings.js
index 86ece45e61d629e6425997f314c2816905220ea2..46362545d598bc2671d2279ccb03d6e18c3f3443 100644
--- a/src/containers/WindowThumbnailSettings.js
+++ b/src/containers/WindowThumbnailSettings.js
@@ -27,12 +27,12 @@ const mapStateToProps = (state, { windowId }) => (
/** */
const styles = theme => ({
- selectedLabel: {
- color: theme.palette.secondary.main,
- },
MenuItem: {
display: 'inline',
},
+ selectedLabel: {
+ color: theme.palette.secondary.main,
+ },
});
const enhance = compose(
diff --git a/src/containers/WindowTopBar.js b/src/containers/WindowTopBar.js
index bd6acb34a7dd1988afbc37eace7c02c2b2c9f71e..7b49a8a81ef4d18c22f02b842e0bd3b451998bf4 100644
--- a/src/containers/WindowTopBar.js
+++ b/src/containers/WindowTopBar.js
@@ -9,11 +9,11 @@ import { WindowTopBar } from '../components/WindowTopBar';
/** mapStateToProps */
const mapStateToProps = (state, { windowId }) => ({
- manifestTitle: getManifestTitle(state, { windowId }),
- maximized: state.windows[windowId].maximized,
- focused: state.workspace.focusedWindowId === windowId,
allowClose: state.config.window.allowClose,
allowFullscreen: state.config.window.allowFullscreen,
+ focused: state.workspace.focusedWindowId === windowId,
+ manifestTitle: getManifestTitle(state, { windowId }),
+ maximized: state.windows[windowId].maximized,
});
/**
@@ -22,9 +22,9 @@ const mapStateToProps = (state, { windowId }) => ({
* @private
*/
const mapDispatchToProps = (dispatch, { windowId }) => ({
- removeWindow: () => dispatch(actions.removeWindow(windowId)),
maximizeWindow: () => dispatch(actions.maximizeWindow(windowId)),
minimizeWindow: () => dispatch(actions.minimizeWindow(windowId)),
+ removeWindow: () => dispatch(actions.removeWindow(windowId)),
toggleWindowSideBar: () => dispatch(actions.toggleWindowSideBar(windowId)),
});
@@ -34,20 +34,20 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({
* windowTopBarStyle: {minHeight: number, paddingLeft: number, backgroundColor: string}}}
*/
const styles = theme => ({
+ focused: {
+ borderTop: `2px solid ${theme.palette.secondary.main}`,
+ },
title: {
...theme.typography.h6,
flexGrow: 1,
paddingLeft: theme.spacing.unit / 2,
},
windowTopBarStyle: {
+ backgroundColor: theme.palette.primary.light,
+ borderTop: '2px solid transparent',
minHeight: 32,
paddingLeft: theme.spacing.unit / 2,
paddingRight: theme.spacing.unit / 2,
- backgroundColor: theme.palette.primary.light,
- borderTop: '2px solid transparent',
- },
- focused: {
- borderTop: `2px solid ${theme.palette.secondary.main}`,
},
});
diff --git a/src/containers/WindowViewSettings.js b/src/containers/WindowViewSettings.js
index dcd29e9ea9ed3cf4ceb058c31ac2512b1359d054..65ab7209588f74978441f3b22e9f00b378812097 100644
--- a/src/containers/WindowViewSettings.js
+++ b/src/containers/WindowViewSettings.js
@@ -27,12 +27,12 @@ const mapStateToProps = (state, { windowId }) => (
/** */
const styles = theme => ({
- selectedLabel: {
- color: theme.palette.secondary.main,
- },
MenuItem: {
display: 'inline',
},
+ selectedLabel: {
+ color: theme.palette.secondary.main,
+ },
});
const enhance = compose(
diff --git a/src/containers/WindowViewer.js b/src/containers/WindowViewer.js
index f2e169a564cd67427fd9f64f638c2b36b1e6a837..0aa4e8a7cc6cd761465f1be2810bebb7f6db1e71 100644
--- a/src/containers/WindowViewer.js
+++ b/src/containers/WindowViewer.js
@@ -12,8 +12,8 @@ import { getManifestCanvases } from '../state/selectors';
*/
const mapStateToProps = (state, { window }) => (
{
- infoResponses: state.infoResponses,
canvases: getManifestCanvases(state, { windowId: window.id }),
+ infoResponses: state.infoResponses,
}
);
diff --git a/src/containers/Workspace.js b/src/containers/Workspace.js
index c1f14d22280795a28c7227dca5f9a0d650348d40..4577b5918c5ad9d2e62b164da6cf0916f3400825 100644
--- a/src/containers/Workspace.js
+++ b/src/containers/Workspace.js
@@ -12,8 +12,8 @@ import { Workspace } from '../components/Workspace';
const mapStateToProps = state => (
{
isWorkspaceControlPanelVisible: state.config.workspaceControlPanel.enabled,
- workspaceType: state.config.workspace.type,
windows: state.windows,
+ workspaceType: state.config.workspace.type,
}
);
diff --git a/src/containers/WorkspaceAdd.js b/src/containers/WorkspaceAdd.js
index 8113688ee3cb26f2606755c2efddcc0b8108ce35..54ddc25dac392691a39e30731b8aa8b13e92b21b 100644
--- a/src/containers/WorkspaceAdd.js
+++ b/src/containers/WorkspaceAdd.js
@@ -29,25 +29,29 @@ const mapDispatchToProps = { setWorkspaceAddVisibility: actions.setWorkspaceAddV
* menuButton: {marginRight: number, marginLeft: number}}}
*/
const styles = theme => ({
- form: {
- ...theme.mixins.gutters(),
- left: '0',
- paddingTop: theme.spacing.unit * 2,
- paddingBottom: theme.spacing.unit * 2,
- right: '0',
- marginTop: 48,
+ displayNone: {
+ display: 'none',
},
fab: {
- position: 'absolute',
bottom: theme.spacing.unit * 2,
+ position: 'absolute',
right: theme.spacing.unit * 2,
},
- displayNone: {
- display: 'none',
+ form: {
+ ...theme.mixins.gutters(),
+ left: '0',
+ marginTop: 48,
+ paddingBottom: theme.spacing.unit * 2,
+ paddingTop: theme.spacing.unit * 2,
+ right: '0',
},
list: {
margin: '16px',
},
+ menuButton: {
+ marginLeft: -12,
+ marginRight: 20,
+ },
paper: {
borderTop: '0',
left: '0',
@@ -58,10 +62,6 @@ const styles = theme => ({
typographyBody: {
flexGrow: 1,
},
- menuButton: {
- marginLeft: -12,
- marginRight: 20,
- },
});
const enhance = compose(
diff --git a/src/containers/WorkspaceAddButton.js b/src/containers/WorkspaceAddButton.js
index 3c813cf3d9c64342fc84ec2d49953e864545b3a9..ec92f0baef76377d42b63d4f73d53940c7538cb5 100644
--- a/src/containers/WorkspaceAddButton.js
+++ b/src/containers/WorkspaceAddButton.js
@@ -32,16 +32,16 @@ const mapDispatchToProps = { setWorkspaceAddVisibility: actions.setWorkspaceAddV
const styles = theme => ({
fab: {
[theme.breakpoints.up('sm')]: {
- marginTop: theme.spacing.unit,
marginBottom: theme.spacing.unit,
marginLeft: theme.spacing.unit / 2,
marginRight: theme.spacing.unit / 2,
+ marginTop: theme.spacing.unit,
},
- marginTop: theme.spacing.unit / 2,
marginBottom: theme.spacing.unit / 2,
marginLeft: theme.spacing.unit,
marginRight: theme.spacing.unit,
+ marginTop: theme.spacing.unit / 2,
},
});
diff --git a/src/containers/WorkspaceControlPanel.js b/src/containers/WorkspaceControlPanel.js
index 0be65ae5c66e5cf9966abd4d3397165df3591282..93378f3e2ff3f70d722feba3db1923f92e87a45f 100644
--- a/src/containers/WorkspaceControlPanel.js
+++ b/src/containers/WorkspaceControlPanel.js
@@ -11,12 +11,18 @@ import { WorkspaceControlPanel } from '../components/WorkspaceControlPanel';
* drawer: {overflowX: string, height: string}}}
*/
const styles = theme => ({
+ ctrlBtn: {
+ margin: theme.spacing.unit,
+ },
+ drawer: {
+ overflowX: 'hidden',
+ },
root: {
[theme.breakpoints.up('sm')]: {
+ height: '100%',
left: 0,
right: 'auto',
width: 64,
- height: '100%',
},
},
toolbar: {
@@ -24,12 +30,6 @@ const styles = theme => ({
display: 'block',
},
},
- ctrlBtn: {
- margin: theme.spacing.unit,
- },
- drawer: {
- overflowX: 'hidden',
- },
});
const enhance = compose(
diff --git a/src/containers/WorkspaceElastic.js b/src/containers/WorkspaceElastic.js
index 745a5590c6c2d60717717f4dc7084f31be3ede9d..2eac6dd084afa23503fcda7cb4b01cd551d85248 100644
--- a/src/containers/WorkspaceElastic.js
+++ b/src/containers/WorkspaceElastic.js
@@ -11,8 +11,8 @@ import WorkspaceElastic from '../components/WorkspaceElastic';
*/
const mapStateToProps = state => (
{
- workspace: state.workspace,
windows: state.windows,
+ workspace: state.workspace,
}
);
@@ -22,6 +22,11 @@ const mapStateToProps = state => (
* @private
*/
const mapDispatchToProps = (dispatch, props) => ({
+ setWindowSize: (windowId, size) => {
+ dispatch(
+ actions.setWindowSize(windowId, size),
+ );
+ },
setWorkspaceViewportDimensions: (position) => {
dispatch(
actions.setWorkspaceViewportDimensions(position),
@@ -40,11 +45,6 @@ const mapDispatchToProps = (dispatch, props) => ({
actions.updateWindowPosition(windowId, position),
);
},
- setWindowSize: (windowId, size) => {
- dispatch(
- actions.setWindowSize(windowId, size),
- );
- },
});
const enhance = compose(
diff --git a/src/containers/ZoomControls.js b/src/containers/ZoomControls.js
index b6f5bf212def0e01c9019a5a57c601cc67c5ef14..9bea32b60094d7fd22a39b5bf4b97df866026f4d 100644
--- a/src/containers/ZoomControls.js
+++ b/src/containers/ZoomControls.js
@@ -32,14 +32,14 @@ const mapDispatchToProps = { updateViewport: actions.updateViewport };
* ListItem: {paddingBottom: number, paddingTop: number}}}
*/
const styles = theme => ({
+ ListItem: {
+ paddingBottom: 0,
+ paddingTop: 0,
+ },
zoom_controls: {
display: 'flex',
flexDirection: 'row',
},
- ListItem: {
- paddingTop: 0,
- paddingBottom: 0,
- },
});
const enhance = compose(
diff --git a/src/extend/pluginStore.js b/src/extend/pluginStore.js
index 19084ac8ed20cbb9efe0eb4147706a6a9b27b210..0aee6f1cf66c71463feae63f3b10ddb3d558b37c 100644
--- a/src/extend/pluginStore.js
+++ b/src/extend/pluginStore.js
@@ -1,10 +1,10 @@
export const pluginStore = {
- /** */
- storePlugins(plugins) {
- this.plugins = plugins || [];
- },
/** */
getPlugins() {
return this.plugins || [];
},
+ /** */
+ storePlugins(plugins) {
+ this.plugins = plugins || [];
+ },
};
diff --git a/src/i18n.js b/src/i18n.js
index 9c8cd98b73b2da13d2c6223799709ef9fbbcce5e..cf8a65e328b81ceefe031babf61affd67256667d 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -13,13 +13,12 @@ const resources = {
i18n
.use(initReactI18next)
.init({
- resources,
- lng: 'en',
fallbackLng: 'en',
-
interpolation: {
escapeValue: false, // react is already safe from xss
},
+ lng: 'en',
+ resources,
});
export default i18n;
diff --git a/src/index.js b/src/index.js
index 660bc6849bf716a21fe2c8ee274ee37ad25cb6d3..409db33dbfc430c779f0c3599e2c14e859555f55 100644
--- a/src/index.js
+++ b/src/index.js
@@ -6,9 +6,9 @@ export * from './components';
export * from './state/reducers';
const exports = {
- viewer: init,
actions,
selectors,
+ viewer: init,
};
export default exports;
diff --git a/src/lib/CanvasWorld.js b/src/lib/CanvasWorld.js
index 07aa79f2c83c3a7a81191c7285834efabe0800dc..49dfa7fc409c97d025297b6ad263e8475f2248ec 100644
--- a/src/lib/CanvasWorld.js
+++ b/src/lib/CanvasWorld.js
@@ -59,8 +59,8 @@ export default class CanvasWorld {
this.canvases.forEach((canvas) => {
heights.push(canvas.getHeight());
dimensions.push({
- width: canvas.getWidth(),
height: canvas.getHeight(),
+ width: canvas.getWidth(),
});
});
const minHeight = Math.min(...heights);
diff --git a/src/lib/MiradorViewer.js b/src/lib/MiradorViewer.js
index e9cf6296f624e6dc55e5adbdb2c640a36ed9774b..91c5544a74cf762c40ade319b9723ec911628687 100644
--- a/src/lib/MiradorViewer.js
+++ b/src/lib/MiradorViewer.js
@@ -60,8 +60,8 @@ class MiradorViewer {
this.store.dispatch(actions.addWindow({
canvasIndex: (miradorWindow.canvasIndex || 0),
manifestId: miradorWindow.loadedManifest,
- view,
thumbnailNavigationPosition,
+ view,
}));
});
diff --git a/src/lib/htmlRules.js b/src/lib/htmlRules.js
index 30b190428c014a52cc6f44e453803f300212d857..f964817aa6274aedab602f6e4f0e1fec5fb50af7 100644
--- a/src/lib/htmlRules.js
+++ b/src/lib/htmlRules.js
@@ -9,19 +9,19 @@ const noHtml = {
// Presentation API 2 suggestion.
const iiif = {
- ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span'],
ALLOWED_ATTR: ['href', 'src', 'alt'],
+ ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span'],
};
// Rule set that is used in Mirador 2.
const mirador2 = {
- ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em', 'ul', 'ol', 'li'],
ALLOWED_ATTR: ['href', 'target', 'src', 'alt', 'dir'],
+ ALLOWED_TAGS: ['a', 'b', 'br', 'i', 'img', 'p', 'span', 'strong', 'em', 'ul', 'ol', 'li'],
};
export default {
- liberal,
- noHtml,
iiif,
+ liberal,
mirador2,
+ noHtml,
};
diff --git a/src/state/actions/action-types.js b/src/state/actions/action-types.js
index ca23ce29de866ac35abcae61da6b47a604e6bd16..65170e606c8a8744480580726528edf31801791a 100644
--- a/src/state/actions/action-types.js
+++ b/src/state/actions/action-types.js
@@ -1,3 +1,4 @@
+/* eslint-disable sort-keys */
const ActionTypes = {
ADD_COMPANION_WINDOW: 'ADD_COMPANION_WINDOW',
UPDATE_COMPANION_WINDOW: 'UPDATE_COMPANION_WINDOW',
diff --git a/src/state/actions/annotation.js b/src/state/actions/annotation.js
index bd18212796de11a22b101896b35c9c6247e42cf7..03c40e200b73c09fea943e6ccbd691853a6c9767 100644
--- a/src/state/actions/annotation.js
+++ b/src/state/actions/annotation.js
@@ -10,9 +10,9 @@ import ActionTypes from './action-types';
*/
export function requestAnnotation(canvasId, annotationId) {
return {
- type: ActionTypes.REQUEST_ANNOTATION,
- canvasId,
annotationId,
+ canvasId,
+ type: ActionTypes.REQUEST_ANNOTATION,
};
}
@@ -26,10 +26,10 @@ export function requestAnnotation(canvasId, annotationId) {
*/
export function receiveAnnotation(canvasId, annotationId, annotationJson) {
return {
- type: ActionTypes.RECEIVE_ANNOTATION,
- canvasId,
annotationId,
annotationJson,
+ canvasId,
+ type: ActionTypes.RECEIVE_ANNOTATION,
};
}
@@ -43,10 +43,10 @@ export function receiveAnnotation(canvasId, annotationId, annotationJson) {
*/
export function receiveAnnotationFailure(canvasId, annotationId, error) {
return {
- type: ActionTypes.RECEIVE_ANNOTATION_FAILURE,
- canvasId,
annotationId,
+ canvasId,
error,
+ type: ActionTypes.RECEIVE_ANNOTATION_FAILURE,
};
}
@@ -76,7 +76,10 @@ export function fetchAnnotation(canvasId, annotationId) {
*/
export function selectAnnotation(windowId, canvasId, annotationId) {
return {
- type: ActionTypes.SELECT_ANNOTATION, windowId, canvasId, annotationId,
+ annotationId,
+ canvasId,
+ type: ActionTypes.SELECT_ANNOTATION,
+ windowId,
};
}
@@ -90,7 +93,10 @@ export function selectAnnotation(windowId, canvasId, annotationId) {
*/
export function deselectAnnotation(windowId, canvasId, annotationId) {
return {
- type: ActionTypes.DESELECT_ANNOTATION, windowId, canvasId, annotationId,
+ annotationId,
+ canvasId,
+ type: ActionTypes.DESELECT_ANNOTATION,
+ windowId,
};
}
diff --git a/src/state/actions/canvas.js b/src/state/actions/canvas.js
index 5fc9c5f9da83c7fe7f83ef4a3969a93c0f81fba2..34f851d90196e8e7119ec80d11e40c46fe093d53 100644
--- a/src/state/actions/canvas.js
+++ b/src/state/actions/canvas.js
@@ -7,7 +7,11 @@ import ActionTypes from './action-types';
* @memberof ActionCreators
*/
export function setCanvas(windowId, canvasIndex) {
- return { type: ActionTypes.SET_CANVAS, windowId, canvasIndex };
+ return {
+ canvasIndex,
+ type: ActionTypes.SET_CANVAS,
+ windowId,
+ };
}
/**
@@ -18,14 +22,14 @@ export function setCanvas(windowId, canvasIndex) {
*/
export function updateViewport(windowId, payload) {
return {
- type: ActionTypes.UPDATE_VIEWPORT,
meta: {
debounce: {
// TODO : set this value in a registry
time: 100,
},
},
- windowId,
payload,
+ type: ActionTypes.UPDATE_VIEWPORT,
+ windowId,
};
}
diff --git a/src/state/actions/companionWindow.js b/src/state/actions/companionWindow.js
index 02ef3a2737fe67911a4e476b25e77a189200194c..7645cf778d35d22e4d8dc572bfe6f3edf7782fe9 100644
--- a/src/state/actions/companionWindow.js
+++ b/src/state/actions/companionWindow.js
@@ -13,11 +13,11 @@ export function addCompanionWindow(windowId, payload, defaults = defaultProps) {
const id = `cw-${uuid()}`;
dispatch({
- type: ActionTypes.ADD_COMPANION_WINDOW,
- id,
- windowId,
companionWindows,
+ id,
payload: { ...defaults, ...payload, id },
+ type: ActionTypes.ADD_COMPANION_WINDOW,
+ windowId,
});
};
}
@@ -25,14 +25,18 @@ export function addCompanionWindow(windowId, payload, defaults = defaultProps) {
/** */
export function updateCompanionWindow(windowId, id, payload) {
return {
- type: ActionTypes.UPDATE_COMPANION_WINDOW,
- windowId,
id,
payload,
+ type: ActionTypes.UPDATE_COMPANION_WINDOW,
+ windowId,
};
}
/** */
export function removeCompanionWindow(windowId, id) {
- return { type: ActionTypes.REMOVE_COMPANION_WINDOW, id, windowId };
+ return {
+ id,
+ type: ActionTypes.REMOVE_COMPANION_WINDOW,
+ windowId,
+ };
}
diff --git a/src/state/actions/config.js b/src/state/actions/config.js
index b626be9ee931ffe064c04cff359298c037ff240b..5bbbd335ac5c4ab8f016973d531b6772135c7642 100644
--- a/src/state/actions/config.js
+++ b/src/state/actions/config.js
@@ -7,7 +7,7 @@ import ActionTypes from './action-types';
* @memberof ActionCreators
*/
export function setConfig(config) {
- return { type: ActionTypes.SET_CONFIG, config };
+ return { config, type: ActionTypes.SET_CONFIG };
}
/**
@@ -17,5 +17,5 @@ export function setConfig(config) {
* @memberof ActionCreators
*/
export function updateConfig(config) {
- return { type: ActionTypes.UPDATE_CONFIG, config };
+ return { config, type: ActionTypes.UPDATE_CONFIG };
}
diff --git a/src/state/actions/infoResponse.js b/src/state/actions/infoResponse.js
index 3e7cf633b069e512bd59c4736ae49fb365e0c67d..352dad4314fbfbe3d8a265c049e29129609d5151 100644
--- a/src/state/actions/infoResponse.js
+++ b/src/state/actions/infoResponse.js
@@ -9,8 +9,8 @@ import ActionTypes from './action-types';
*/
export function requestInfoResponse(infoId) {
return {
- type: ActionTypes.REQUEST_INFO_RESPONSE,
infoId,
+ type: ActionTypes.REQUEST_INFO_RESPONSE,
};
}
@@ -23,9 +23,9 @@ export function requestInfoResponse(infoId) {
*/
export function receiveInfoResponse(infoId, infoJson) {
return {
- type: ActionTypes.RECEIVE_INFO_RESPONSE,
infoId,
infoJson,
+ type: ActionTypes.RECEIVE_INFO_RESPONSE,
};
}
@@ -38,9 +38,9 @@ export function receiveInfoResponse(infoId, infoJson) {
*/
export function receiveInfoResponseFailure(infoId, error) {
return {
- type: ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE,
- infoId,
error,
+ infoId,
+ type: ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE,
};
}
@@ -67,5 +67,5 @@ export function fetchInfoResponse(infoId) {
* @memberof ActionCreators
*/
export function removeInfoResponse(infoId) {
- return { type: ActionTypes.REMOVE_INFO_RESPONSE, infoId };
+ return { infoId, type: ActionTypes.REMOVE_INFO_RESPONSE };
}
diff --git a/src/state/actions/manifest.js b/src/state/actions/manifest.js
index 52b348ee580c106e3d3023e635eeb84e8794b41c..a48aaa7d3786b17a64e1398bd7f3884aa75c8031 100644
--- a/src/state/actions/manifest.js
+++ b/src/state/actions/manifest.js
@@ -9,9 +9,9 @@ import ActionTypes from './action-types';
*/
export function requestManifest(manifestId, properties) {
return {
- type: ActionTypes.REQUEST_MANIFEST,
manifestId,
properties,
+ type: ActionTypes.REQUEST_MANIFEST,
};
}
@@ -24,9 +24,9 @@ export function requestManifest(manifestId, properties) {
*/
export function receiveManifest(manifestId, manifestJson) {
return {
- type: ActionTypes.RECEIVE_MANIFEST,
manifestId,
manifestJson,
+ type: ActionTypes.RECEIVE_MANIFEST,
};
}
@@ -39,9 +39,9 @@ export function receiveManifest(manifestId, manifestJson) {
*/
export function receiveManifestFailure(manifestId, error) {
return {
- type: ActionTypes.RECEIVE_MANIFEST_FAILURE,
- manifestId,
error,
+ manifestId,
+ type: ActionTypes.RECEIVE_MANIFEST_FAILURE,
};
}
@@ -75,5 +75,5 @@ export function fetchManifest(manifestId, properties) {
* @memberof ActionCreators
*/
export function removeManifest(manifestId) {
- return { type: ActionTypes.REMOVE_MANIFEST, manifestId };
+ return { manifestId, type: ActionTypes.REMOVE_MANIFEST };
}
diff --git a/src/state/actions/window.js b/src/state/actions/window.js
index 07fe00a287d7e2c66aa81eb550da6b7fd2446f93..e0fc4498194c201ad91897c03ac1f0713c78de41 100644
--- a/src/state/actions/window.js
+++ b/src/state/actions/window.js
@@ -24,9 +24,9 @@ export function focusWindow(windowId, pan = false) {
position = {};
}
dispatch({
+ position,
type: ActionTypes.FOCUS_WINDOW,
windowId,
- position,
});
};
}
@@ -45,32 +45,39 @@ export function addWindow(options) {
const cwDefault = `cw-${uuid()}`;
const cwThumbs = `cw-${uuid()}`;
const defaultOptions = {
- id: `window-${uuid()}`,
canvasIndex: 0,
collectionIndex: 0,
+ companionWindowIds: [cwDefault, cwThumbs],
+ height: 400,
+ id: `window-${uuid()}`,
manifestId: null,
+ maximized: false,
rangeId: null,
+ rotation: null,
+ selectedAnnotations: {},
+ sideBarPanel: 'info',
thumbnailNavigationId: cwThumbs,
+ view: 'single',
width: 400,
- height: 400,
x: 200 + (Math.floor(numWindows / 10) * 50 + (numWindows * 30) % 300),
y: 200 + ((numWindows * 50) % 300),
- companionWindowIds: [cwDefault, cwThumbs],
- sideBarPanel: 'info',
- rotation: null,
- displayAllAnnotations: false,
- selectedAnnotations: {},
- view: 'single',
- maximized: false,
};
dispatch({
- type: ActionTypes.ADD_WINDOW,
- window: { ...defaultOptions, ...options },
companionWindows: [
- { id: cwDefault, position: 'left', content: 'info' },
- { id: cwThumbs, position: options.thumbnailNavigationPosition || 'far-bottom', content: 'thumbnail_navigation' },
+ {
+ content: 'info',
+ id: cwDefault,
+ position: 'left',
+ },
+ {
+ content: 'thumbnail_navigation',
+ id: cwThumbs,
+ position: options.thumbnailNavigationPosition || 'far-bottom',
+ },
],
+ type: ActionTypes.ADD_WINDOW,
+ window: { ...defaultOptions, ...options },
});
};
}
@@ -95,12 +102,20 @@ export function minimizeWindow(windowId) {
/** */
export function updateWindow(id, payload) {
- return { type: ActionTypes.UPDATE_WINDOW, id, payload };
+ return {
+ id,
+ payload,
+ type: ActionTypes.UPDATE_WINDOW,
+ };
}
/** */
export function setCompanionAreaOpen(id, companionAreaOpen) {
- return { type: ActionTypes.UPDATE_WINDOW, id, payload: { companionAreaOpen } };
+ return {
+ id,
+ payload: { companionAreaOpen },
+ type: ActionTypes.UPDATE_WINDOW,
+ };
}
/**
@@ -114,7 +129,11 @@ export function removeWindow(windowId) {
const { windows } = getState();
const { companionWindowIds } = windows[windowId];
- dispatch({ type: ActionTypes.REMOVE_WINDOW, windowId, companionWindowIds });
+ dispatch({
+ companionWindowIds,
+ type: ActionTypes.REMOVE_WINDOW,
+ windowId,
+ });
};
}
@@ -136,7 +155,11 @@ export function toggleWindowSideBar(windowId) {
* @memberof ActionCreators
*/
export function setWindowSideBarPanel(windowId, panelType) {
- return { type: ActionTypes.SET_WINDOW_SIDE_BAR_PANEL, windowId, panelType };
+ return {
+ panelType,
+ type: ActionTypes.SET_WINDOW_SIDE_BAR_PANEL,
+ windowId,
+ };
}
/**
@@ -152,7 +175,9 @@ export function setWindowThumbnailPosition(windowId, position) {
const { thumbnailNavigationId } = windows[windowId];
dispatch({
- type: ActionTypes.UPDATE_COMPANION_WINDOW, id: thumbnailNavigationId, payload: { position },
+ id: thumbnailNavigationId,
+ payload: { position },
+ type: ActionTypes.UPDATE_COMPANION_WINDOW,
});
};
}
@@ -165,7 +190,11 @@ export function setWindowThumbnailPosition(windowId, position) {
* @memberof ActionCreators
*/
export function setWindowViewType(windowId, viewType) {
- return { type: ActionTypes.SET_WINDOW_VIEW_TYPE, windowId, viewType };
+ return {
+ type: ActionTypes.SET_WINDOW_VIEW_TYPE,
+ viewType,
+ windowId,
+ };
}
/**
@@ -177,11 +206,11 @@ export function setWindowViewType(windowId, viewType) {
*/
export function updateWindowPosition(windowId, position) {
return {
- type: ActionTypes.UPDATE_WINDOW_POSITION,
payload: {
- windowId,
position,
+ windowId,
},
+ type: ActionTypes.UPDATE_WINDOW_POSITION,
};
}
@@ -194,10 +223,10 @@ export function updateWindowPosition(windowId, position) {
*/
export function setWindowSize(windowId, size) {
return {
- type: ActionTypes.SET_WINDOW_SIZE,
payload: {
- windowId,
size,
+ windowId,
},
+ type: ActionTypes.SET_WINDOW_SIZE,
};
}
diff --git a/src/state/actions/workspace.js b/src/state/actions/workspace.js
index a75bfe5b5d38c6f0ff90d783b6edcd4618e29f6b..783ab5bdb14f680e85b20fd7d75bcdb436e2dd3b 100644
--- a/src/state/actions/workspace.js
+++ b/src/state/actions/workspace.js
@@ -7,7 +7,7 @@ import ActionTypes from './action-types';
* @memberof ActionCreators
*/
export function setWorkspaceFullscreen(isFullscreenEnabled) {
- return { type: ActionTypes.SET_WORKSPACE_FULLSCREEN, isFullscreenEnabled };
+ return { isFullscreenEnabled, type: ActionTypes.SET_WORKSPACE_FULLSCREEN };
}
/**
@@ -16,7 +16,7 @@ export function setWorkspaceFullscreen(isFullscreenEnabled) {
* @memberof ActionCreators
*/
export function toggleZoomControls(showZoomControls) {
- return { type: ActionTypes.TOGGLE_ZOOM_CONTROLS, showZoomControls };
+ return { showZoomControls, type: ActionTypes.TOGGLE_ZOOM_CONTROLS };
}
/**
@@ -26,7 +26,7 @@ export function toggleZoomControls(showZoomControls) {
* @memberof ActionCreators
*/
export function updateWorkspaceMosaicLayout(layout) {
- return { type: ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT, layout };
+ return { layout, type: ActionTypes.UPDATE_WORKSPACE_MOSAIC_LAYOUT };
}
/**
@@ -36,7 +36,7 @@ export function updateWorkspaceMosaicLayout(layout) {
* @memberof ActionCreators
*/
export function setWorkspaceAddVisibility(isWorkspaceAddVisible) {
- return { type: ActionTypes.SET_WORKSPACE_ADD_VISIBILITY, isWorkspaceAddVisible };
+ return { isWorkspaceAddVisible, type: ActionTypes.SET_WORKSPACE_ADD_VISIBILITY };
}
/**
@@ -47,13 +47,13 @@ export function setWorkspaceAddVisibility(isWorkspaceAddVisible) {
*/
export function setWorkspaceViewportPosition({ x, y }) {
return {
- type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
payload: {
position: {
x,
y,
},
},
+ type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
};
}
@@ -65,13 +65,13 @@ export function setWorkspaceViewportPosition({ x, y }) {
*/
export function setWorkspaceViewportDimensions({ width, height }) {
return {
- type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
payload: {
position: {
- width,
height,
+ width,
},
},
+ type: ActionTypes.SET_WORKSPACE_VIEWPORT_POSITION,
};
}
/**
diff --git a/src/state/reducers/annotations.js b/src/state/reducers/annotations.js
index 140b68bb72f8555a7f8834f1731c5dc7632c18a2..1eca687ac1b3c5fe5170d05b17d4c253956b979f 100644
--- a/src/state/reducers/annotations.js
+++ b/src/state/reducers/annotations.js
@@ -21,8 +21,8 @@ export const annotationsReducer = (state = {}, action) => {
[action.canvasId]: {
[action.annotationId]: {
id: action.annotationId,
- json: action.annotationJson,
isFetching: false,
+ json: action.annotationJson,
},
},
};
@@ -31,8 +31,8 @@ export const annotationsReducer = (state = {}, action) => {
...state,
[action.canvasId]: {
[action.annotationId]: {
- id: action.annotationId,
error: action.error,
+ id: action.annotationId,
isFetching: false,
},
},
diff --git a/src/state/reducers/infoResponses.js b/src/state/reducers/infoResponses.js
index 87e21815fa6c8c0a5d6ccb9714192a83b7a87238..12808e226c61c98cec9a46183a19614316be7917 100644
--- a/src/state/reducers/infoResponses.js
+++ b/src/state/reducers/infoResponses.js
@@ -18,16 +18,16 @@ export const infoResponsesReducer = (state = {}, action) => {
...state,
[action.infoId]: {
id: action.infoId,
- json: action.infoJson,
isFetching: false,
+ json: action.infoJson,
},
};
case ActionTypes.RECEIVE_INFO_RESPONSE_FAILURE:
return {
...state,
[action.infoId]: {
- id: action.infoId,
error: action.error,
+ id: action.infoId,
isFetching: false,
},
};
diff --git a/src/state/reducers/manifests.js b/src/state/reducers/manifests.js
index e21b3a17fabb887f84093f5348c2343c75498f91..eab3daf4061df36b3eb4a606c82cb4955e8ed9fc 100644
--- a/src/state/reducers/manifests.js
+++ b/src/state/reducers/manifests.js
@@ -20,10 +20,10 @@ export const manifestsReducer = (state = {}, action) => {
...state,
[action.manifestId]: {
...state[action.manifestId],
+ error: null, // Explicitly set the error to null in case this is a re-fetch
id: action.manifestId,
- json: action.manifestJson,
isFetching: false,
- error: null, // Explicitly set the error to null in case this is a re-fetch
+ json: action.manifestJson,
},
};
case ActionTypes.RECEIVE_MANIFEST_FAILURE:
@@ -31,8 +31,8 @@ export const manifestsReducer = (state = {}, action) => {
...state,
[action.manifestId]: {
...state[action.manifestId],
- id: action.manifestId,
error: action.error,
+ id: action.manifestId,
isFetching: false,
},
};
diff --git a/src/state/reducers/rootReducer.js b/src/state/reducers/rootReducer.js
index 087b0024c73299247d717b6865c9dafbd991d8d9..49c3ec0f3bd1314c34d54ef17e29b4ba65d18116 100644
--- a/src/state/reducers/rootReducer.js
+++ b/src/state/reducers/rootReducer.js
@@ -17,14 +17,14 @@ import {
*/
export default function createRootReducer(pluginReducers) {
return combineReducers({
+ annotations: annotationsReducer,
companionWindows: companionWindowsReducer,
- workspace: workspaceReducer,
- windows: windowsReducer,
- manifests: manifestsReducer,
- infoResponses: infoResponsesReducer,
config: configReducer,
+ infoResponses: infoResponsesReducer,
+ manifests: manifestsReducer,
viewers: viewersReducer,
- annotations: annotationsReducer,
+ windows: windowsReducer,
+ workspace: workspaceReducer,
...pluginReducers,
});
}
diff --git a/src/state/reducers/windows.js b/src/state/reducers/windows.js
index 771fef401d85bf34e41388adf1201c3b32f9ec28..76bd83ee1787274525782cae3a7d242643097298 100644
--- a/src/state/reducers/windows.js
+++ b/src/state/reducers/windows.js
@@ -76,8 +76,8 @@ export const windowsReducer = (state = {}, action) => {
...state,
[action.payload.windowId]: {
...state[action.payload.windowId],
- width: action.payload.size.width,
height: action.payload.size.height,
+ width: action.payload.size.width,
x: action.payload.size.x,
y: action.payload.size.y,
},
@@ -96,8 +96,8 @@ export const windowsReducer = (state = {}, action) => {
[action.windowId]: {
...state[action.windowId],
companionAreaOpen: true,
- sideBarPanel: action.payload.content,
companionWindowIds: newCompanionWindowIds.concat([action.id]),
+ sideBarPanel: action.payload.content,
},
};
}
diff --git a/src/state/reducers/workspace.js b/src/state/reducers/workspace.js
index ae1939f1abec215001ecfcbe108479d04f7f6c10..55ecafe29596e27b3453bd5307d4f34661fe168e 100644
--- a/src/state/reducers/workspace.js
+++ b/src/state/reducers/workspace.js
@@ -5,13 +5,13 @@ import ActionTypes from '../actions/action-types';
*/
export const workspaceReducer = (
state = { // we'll need to abstract this more, methinks.
+ exposeModeOn: false,
+ height: 5000,
viewportPosition: {
x: 0,
y: 0,
},
width: 5000,
- height: 5000,
- exposeModeOn: false,
},
action,
) => {
diff --git a/src/state/selectors/index.js b/src/state/selectors/index.js
index d8362934c2e92585382ba880d9dbe5997b1122a4..cc07574c6a8bf1a10fc616351274e308b81d8c29 100644
--- a/src/state/selectors/index.js
+++ b/src/state/selectors/index.js
@@ -58,9 +58,9 @@ export function getAnnotationResourcesByMotivation(annotations, motivations) {
*/
export function getIdAndContentOfResources(resources) {
return resources.map((resource, i) => ({
+ content: resource.chars,
id: resource.id,
targetId: resource.targetId,
- content: resource.chars,
}));
}
@@ -73,9 +73,9 @@ export function getLanguagesFromConfigWithCurrent(state) {
const { availableLanguages, language } = state.config;
return Object.keys(availableLanguages).map(key => ({
- locale: key,
- label: availableLanguages[key],
current: key === language,
+ label: availableLanguages[key],
+ locale: key,
}));
}
diff --git a/src/styles/index.scss b/src/styles/index.scss
index dfb51ff56cc48f9ec044afbc9ec0472fe2311e1e..6326d96202d798e5aa4a53034c8eef5ead4b8d64 100644
--- a/src/styles/index.scss
+++ b/src/styles/index.scss
@@ -101,25 +101,25 @@
&-gallery-container {
flex: 1;
- overflow-y: scroll;
overflow-x: hidden;
+ overflow-y: scroll;
padding: 50px 0 50px 20px;
}
&-gallery-view-item {
+ box-sizing: border-box;
+ cursor: pointer;
display: inline-block;
- max-width: 100px;
height: 160px;
- overflow: hidden;
- text-overflow: elipsis;
margin: 10px 5px;
+ max-width: 100px;
+ overflow: hidden;
padding: 5px;
- box-sizing: border-box;
- cursor: pointer;
- transition: 0.1s transform ease-out;
+ text-overflow: elipsis;
+ transition: .1s transform ease-out;
span {
- text-align: 'center',
+ text-align: 'center';
}
&.current-canvas {
@@ -128,10 +128,10 @@
}
&:hover {
- transition: 0.1s transform ease-out;
- transform: scale(1.05);
border: 2px solid deepskyblue;
padding: 3px;
+ transition: .1s transform ease-out;
+ transform: scale(.05);
}
&:focus {
@@ -187,7 +187,7 @@
&-label-value-metadata {
dd {
- margin-bottom: 0.5em;
+ margin-bottom: .5em;
margin-left: 0;
}
}
diff --git a/webpack.config.js b/webpack.config.js
index 632c39a6bad8387b6bf973f16cc4ba88cda0bd8a..3fde2cf890f093ea3b054883de4e0ee10650c477 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -4,59 +4,51 @@ const TerserPlugin = require('terser-webpack-plugin');
const paths = require('./config/paths');
const eslintLoaderConfig = {
- test: /\.(js|mjs|jsx)$/,
enforce: 'pre',
+ include: paths.appSrc,
+ test: /\.(js|mjs|jsx)$/,
use: [
{
+ loader: require.resolve('eslint-loader'),
options: {
- formatter: require.resolve('react-dev-utils/eslintFormatter'),
eslintPath: require.resolve('eslint'),
+ formatter: require.resolve('react-dev-utils/eslintFormatter'),
},
- loader: require.resolve('eslint-loader'),
},
],
- include: paths.appSrc,
};
const babelLoaderConfig = {
- test: /\.(js|mjs|jsx)$/,
include: paths.appSrc, // CRL
loader: require.resolve('babel-loader'),
options: {
- cacheDirectory: true,
// Save disk space when time isn't as important
cacheCompression: true,
+ cacheDirectory: true,
compact: true,
},
+ test: /\.(js|mjs|jsx)$/,
};
const baseConfig = [
{
entry: './src/index-core.js',
- output: {
- path: path.join(__dirname, 'dist'),
- filename: 'm3core.umd.js',
- libraryTarget: 'umd',
- library: 'm3core',
- },
module: {
rules: [
eslintLoaderConfig,
babelLoaderConfig,
],
},
- },
- {
- entry: './src/index.js',
output: {
- path: path.join(__dirname, 'dist'),
- filename: 'mirador.min.js',
+ filename: 'm3core.umd.js',
+ library: 'm3core',
libraryTarget: 'umd',
- library: 'Mirador',
- libraryExport: 'default',
+ path: path.join(__dirname, 'dist'),
},
- resolve: { extensions: ['.js'] },
+ },
+ {
+ entry: './src/index.js',
module: {
rules: [
eslintLoaderConfig,
@@ -79,11 +71,19 @@ const baseConfig = [
}),
],
},
+ output: {
+ filename: 'mirador.min.js',
+ library: 'Mirador',
+ libraryExport: 'default',
+ libraryTarget: 'umd',
+ path: path.join(__dirname, 'dist'),
+ },
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /@blueprintjs\/(core|icons)/, // ignore optional UI framework dependencies
}),
],
+ resolve: { extensions: ['.js'] },
},
];