From a6d09177ab1dd9154655529ad112e9e1e5119c9e Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Thu, 5 Dec 2024 09:21:22 -0800 Subject: [PATCH] Replace withTranslation HOC with hooks. --- .../src/components/AccessTokenSender.test.js | 1 - .../src/components/AnnotationSettings.test.js | 1 - .../src/components/AnnotationsOverlay.test.js | 1 - .../src/components/AttributionPanel.test.js | 5 +- __tests__/src/components/Branding.test.js | 2 +- .../src/components/CanvasAnnotations.test.js | 2 - __tests__/src/components/CanvasInfo.test.js | 3 +- __tests__/src/components/CanvasLayers.test.js | 13 +++-- .../src/components/ChangeThemeDialog.test.js | 9 ++-- .../src/components/CollapsibleSection.test.js | 5 +- .../src/components/CollectionDialog.test.js | 3 +- .../src/components/CollectionInfo.test.js | 10 ++-- .../src/components/CompanionArea.test.js | 17 +++--- .../src/components/CompanionWindow.test.js | 8 +-- .../components/CompanionWindowFactory.test.js | 14 ++--- __tests__/src/components/ErrorContent.test.js | 3 -- __tests__/src/components/ErrorDialog.test.js | 5 +- .../src/components/FullScreenButton.test.js | 4 +- .../src/components/IIIFAuthentication.test.js | 17 +++--- __tests__/src/components/LayersPanel.test.js | 2 - __tests__/src/components/ManifestForm.test.js | 13 +++-- __tests__/src/components/ManifestInfo.test.js | 3 +- .../src/components/ManifestListItem.test.js | 3 +- .../components/ManifestListItemError.test.js | 7 ++- .../components/ManifestRelatedLinks.test.js | 17 +++--- .../components/MosaicRenderPreview.test.js | 3 +- .../components/OpenSeadragonViewer.test.js | 4 +- __tests__/src/components/SearchHit.test.js | 2 +- __tests__/src/components/SearchPanel.test.js | 14 ++--- .../components/SearchPanelControls.test.js | 2 +- .../components/SearchPanelNavigation.test.js | 10 ++-- .../src/components/SearchResults.test.js | 16 +++--- .../src/components/SidebarIndexList.test.js | 1 - .../components/ThumbnailNavigation.test.js | 1 - __tests__/src/components/ViewerInfo.test.js | 3 +- .../src/components/ViewerNavigation.test.js | 29 +++++------ __tests__/src/components/Window.test.js | 7 +-- .../WindowAuthenticationBar.test.js | 15 +++--- .../WindowCanvasNavigationControls.test.js | 12 ++--- __tests__/src/components/WindowList.test.js | 2 +- .../src/components/WindowListButton.test.js | 7 ++- .../src/components/WindowSideBar.test.js | 1 - .../WindowSideBarAnnotationsPanel.test.js | 4 +- .../components/WindowSideBarButtons.test.js | 2 - .../WindowSideBarCanvasPanel.test.js | 9 ++-- .../components/WindowSideBarInfoPanel.test.js | 10 ++-- .../WindowThumbnailSettings.test.js | 20 +++---- __tests__/src/components/WindowTopBar.test.js | 35 ++++++------- .../components/WindowTopBarPluginMenu.test.js | 7 ++- .../src/components/WindowTopMenu.test.js | 14 ++--- .../components/WindowTopMenuButton.test.js | 11 ++-- .../src/components/WindowViewSettings.test.js | 24 ++++----- __tests__/src/components/Workspace.test.js | 17 +++--- __tests__/src/components/WorkspaceAdd.test.js | 19 ++++--- .../src/components/WorkspaceAddButton.test.js | 7 ++- .../src/components/WorkspaceArea.test.js | 23 ++++---- .../components/WorkspaceControlPanel.test.js | 16 +++--- .../WorkspaceControlPanelButtons.test.js | 6 +-- .../src/components/WorkspaceElastic.test.js | 2 +- .../src/components/WorkspaceExport.test.js | 10 ++-- .../src/components/WorkspaceMenu.test.js | 8 +-- .../components/WorkspaceMenuButton.test.js | 2 +- .../src/components/WorkspaceMosaic.test.js | 6 +-- .../components/WorkspaceOptionsButton.test.js | 5 +- .../components/WorkspaceOptionsMenu.test.js | 5 +- .../WorkspaceSelectionDialog.test.js | 10 ++-- __tests__/src/components/ZoomControls.test.js | 12 ++--- __tests__/utils/test-utils.js | 14 ++++- setupJest.js | 20 ------- src/components/AnnotationSettings.js | 5 +- src/components/AttributionPanel.js | 5 +- src/components/Branding.js | 5 +- src/components/CanvasAnnotations.js | 5 +- src/components/CanvasInfo.js | 4 +- src/components/CanvasLayers.js | 16 +++--- src/components/ChangeThemeDialog.js | 5 +- src/components/CollapsibleSection.js | 5 +- src/components/CollectionDialog.js | 5 +- src/components/CollectionInfo.js | 6 ++- src/components/CompanionArea.js | 5 +- src/components/CompanionWindow.js | 5 +- src/components/CompanionWindowFactory.js | 5 +- src/components/CustomPanel.js | 5 +- src/components/ErrorContent.js | 5 +- src/components/ErrorDialog.js | 5 +- src/components/FullScreenButton.js | 5 +- src/components/IIIFAuthentication.js | 5 +- src/components/LayersPanel.js | 5 +- src/components/ManifestForm.js | 5 +- src/components/ManifestInfo.js | 5 +- src/components/ManifestListItem.js | 4 +- src/components/ManifestListItemError.js | 5 +- src/components/ManifestRelatedLinks.js | 4 +- src/components/MinimalWindow.js | 4 +- src/components/MosaicRenderPreview.js | 4 +- src/components/OpenSeadragonViewer.js | 5 +- src/components/SearchHit.js | 5 +- src/components/SearchPanel.js | 5 +- src/components/SearchPanelControls.js | 5 +- src/components/SearchPanelNavigation.js | 5 +- src/components/SearchResults.js | 4 +- src/components/SelectCollection.js | 5 +- src/components/ThumbnailNavigation.js | 5 +- src/components/ViewerInfo.js | 4 +- src/components/ViewerNavigation.js | 5 +- src/components/Window.js | 5 +- src/components/WindowAuthenticationBar.js | 5 +- src/components/WindowList.js | 5 +- src/components/WindowListButton.js | 5 +- src/components/WindowSideBar.js | 5 +- .../WindowSideBarAnnotationsPanel.js | 5 +- src/components/WindowSideBarButtons.js | 15 ++---- src/components/WindowSideBarCanvasPanel.js | 4 +- .../WindowSideBarCollectionPanel.js | 4 +- src/components/WindowSideBarInfoPanel.js | 4 +- src/components/WindowThumbnailSettings.js | 5 +- src/components/WindowTopBar.js | 5 +- src/components/WindowTopBarPluginMenu.js | 5 +- src/components/WindowTopMenuButton.js | 5 +- src/components/WindowViewSettings.js | 5 +- src/components/Workspace.js | 52 ++++++++++--------- src/components/WorkspaceAdd.js | 5 +- src/components/WorkspaceAddButton.js | 5 +- src/components/WorkspaceArea.js | 4 +- src/components/WorkspaceControlPanel.js | 7 +-- src/components/WorkspaceExport.js | 5 +- src/components/WorkspaceImport.js | 5 +- src/components/WorkspaceMenu.js | 5 +- src/components/WorkspaceMenuButton.js | 9 ++-- src/components/WorkspaceOptionsButton.js | 9 ++-- src/components/WorkspaceOptionsMenu.js | 5 +- src/components/WorkspaceSelectionDialog.js | 5 +- src/components/ZoomControls.js | 5 +- src/containers/AnnotationSettings.js | 2 - src/containers/AnnotationsOverlay.js | 2 - src/containers/AttributionPanel.js | 2 - src/containers/AudioViewer.js | 2 - src/containers/CanvasAnnotations.js | 2 - src/containers/CanvasInfo.js | 2 - src/containers/CanvasLayers.js | 2 - src/containers/ChangeThemeDialog.js | 2 - src/containers/CollapsibleSection.js | 8 +-- src/containers/CollectionDialog.js | 2 - src/containers/CollectionInfo.js | 2 - src/containers/CompanionArea.js | 2 - src/containers/CompanionWindow.js | 2 - src/containers/CompanionWindowFactory.js | 2 - src/containers/CustomPanel.js | 2 - src/containers/ErrorContent.js | 2 - src/containers/ErrorDialog.js | 2 - src/containers/FullScreenButton.js | 2 - src/containers/IIIFAuthentication.js | 2 - src/containers/IIIFThumbnail.js | 2 - src/containers/LayersPanel.js | 2 - src/containers/LocalePicker.js | 8 +-- src/containers/ManifestForm.js | 2 - src/containers/ManifestInfo.js | 2 - src/containers/ManifestListItem.js | 2 - src/containers/ManifestListItemError.js | 2 - src/containers/ManifestRelatedLinks.js | 2 - src/containers/MinimalWindow.js | 2 - src/containers/MosaicRenderPreview.js | 2 - src/containers/OpenSeadragonViewer.js | 2 - src/containers/SearchHit.js | 2 - src/containers/SearchPanel.js | 2 - src/containers/SearchPanelControls.js | 2 - src/containers/SearchPanelNavigation.js | 2 - src/containers/SearchResults.js | 2 - src/containers/SelectCollection.js | 2 - src/containers/SidebarIndexItem.js | 2 - src/containers/SidebarIndexList.js | 2 - src/containers/SidebarIndexTableOfContents.js | 2 - src/containers/SidebarIndexThumbnail.js | 2 - src/containers/ThumbnailCanvasGrouping.js | 2 - src/containers/ThumbnailNavigation.js | 2 - src/containers/VideoViewer.js | 2 - src/containers/ViewerInfo.js | 2 - src/containers/ViewerNavigation.js | 2 - src/containers/Window.js | 2 - src/containers/WindowAuthenticationBar.js | 2 - src/containers/WindowList.js | 2 - src/containers/WindowListButton.js | 2 - src/containers/WindowSideBar.js | 2 - .../WindowSideBarAnnotationsPanel.js | 2 - src/containers/WindowSideBarButtons.js | 2 - src/containers/WindowSideBarCanvasPanel.js | 2 - .../WindowSideBarCollectionPanel.js | 2 - src/containers/WindowSideBarInfoPanel.js | 2 - src/containers/WindowThumbnailSettings.js | 2 - src/containers/WindowTopBar.js | 2 - src/containers/WindowTopBarPluginArea.js | 2 - src/containers/WindowTopBarPluginMenu.js | 2 - src/containers/WindowTopBarTitle.js | 2 - src/containers/WindowTopMenu.js | 2 - src/containers/WindowTopMenuButton.js | 2 - src/containers/WindowViewSettings.js | 2 - src/containers/Workspace.js | 2 - src/containers/WorkspaceAdd.js | 2 - src/containers/WorkspaceAddButton.js | 2 - src/containers/WorkspaceArea.js | 2 - src/containers/WorkspaceControlPanel.js | 2 - src/containers/WorkspaceExport.js | 2 - src/containers/WorkspaceImport.js | 2 - src/containers/WorkspaceMenu.js | 2 - src/containers/WorkspaceMenuButton.js | 2 - src/containers/WorkspaceOptionsButton.js | 2 - src/containers/WorkspaceOptionsMenu.js | 8 +-- src/containers/WorkspaceSelectionDialog.js | 2 - src/containers/ZoomControls.js | 2 - 209 files changed, 494 insertions(+), 679 deletions(-) diff --git a/__tests__/src/components/AccessTokenSender.test.js b/__tests__/src/components/AccessTokenSender.test.js index 251896c4b9..e0b0b0eda5 100644 --- a/__tests__/src/components/AccessTokenSender.test.js +++ b/__tests__/src/components/AccessTokenSender.test.js @@ -7,7 +7,6 @@ import { AccessTokenSender } from '../../../src/components/AccessTokenSender'; function createWrapper(props) { return render( key} handleAccessTokenMessage={() => {}} {...props} />, diff --git a/__tests__/src/components/AnnotationSettings.test.js b/__tests__/src/components/AnnotationSettings.test.js index 84e04d7b86..c0b9a573a8 100644 --- a/__tests__/src/components/AnnotationSettings.test.js +++ b/__tests__/src/components/AnnotationSettings.test.js @@ -8,7 +8,6 @@ function createWrapper(props) { k} toggleAnnotationDisplay={() => {}} windowId="abc123" {...props} diff --git a/__tests__/src/components/AnnotationsOverlay.test.js b/__tests__/src/components/AnnotationsOverlay.test.js index 0904cb7cb4..3b8867ac04 100644 --- a/__tests__/src/components/AnnotationsOverlay.test.js +++ b/__tests__/src/components/AnnotationsOverlay.test.js @@ -25,7 +25,6 @@ const createWrapper = (props) => { windowId="base" config={{}} updateViewport={jest.fn()} - t={k => k} canvasWorld={new CanvasWorld(canvases)} {...props} /> diff --git a/__tests__/src/components/AttributionPanel.test.js b/__tests__/src/components/AttributionPanel.test.js index 21e55cf083..24e82f0377 100644 --- a/__tests__/src/components/AttributionPanel.test.js +++ b/__tests__/src/components/AttributionPanel.test.js @@ -12,7 +12,6 @@ function createWrapper(props) { return render( str} windowId="window" {...props} />, @@ -34,14 +33,14 @@ describe('AttributionPanel', () => { it('renders the rights statement', () => { createWrapper({ rights: ['http://example.com', 'http://stanford.edu'] }); - expect(screen.getByText('rights')).toBeInTheDocument(); + expect(screen.getByText('License')).toBeInTheDocument(); expect(screen.getByRole('link', { name: 'http://example.com' })).toHaveAttribute('href', 'http://example.com'); expect(screen.getByRole('link', { name: 'http://stanford.edu' })).toHaveAttribute('href', 'http://stanford.edu'); }); it('does not render the rights statement if it is empty', () => { createWrapper({ rights: [] }); - expect(screen.queryByText('rights')).not.toBeInTheDocument(); + expect(screen.queryByText('License')).not.toBeInTheDocument(); }); // Requires canvas to handle img loading. diff --git a/__tests__/src/components/Branding.test.js b/__tests__/src/components/Branding.test.js index 33a6f8ae9e..eb2f745956 100644 --- a/__tests__/src/components/Branding.test.js +++ b/__tests__/src/components/Branding.test.js @@ -12,7 +12,7 @@ describe('Branding', () => { it('renders additional items for the wide variant', () => { render(); - expect(screen.getByText('mirador')).toBeInTheDocument(); + expect(screen.getByText('Mirador')).toBeInTheDocument(); expect(screen.getByRole('link')).toBeInTheDocument(); }); }); diff --git a/__tests__/src/components/CanvasAnnotations.test.js b/__tests__/src/components/CanvasAnnotations.test.js index d5eb9fc354..54cc066fa4 100644 --- a/__tests__/src/components/CanvasAnnotations.test.js +++ b/__tests__/src/components/CanvasAnnotations.test.js @@ -1,6 +1,5 @@ import { render, screen } from 'test-utils'; import userEvent from '@testing-library/user-event'; -import { t } from 'i18next'; import { CanvasAnnotations } from '../../../src/components/CanvasAnnotations'; import { ScrollTo } from '../../../src/components/ScrollTo'; @@ -15,7 +14,6 @@ function createWrapper(props) { index={0} label="A Canvas Label" selectAnnotation={() => {}} - t={t} totalSize={1} windowId="abc" {...props} diff --git a/__tests__/src/components/CanvasInfo.test.js b/__tests__/src/components/CanvasInfo.test.js index a8af19bacd..da5bef30b0 100644 --- a/__tests__/src/components/CanvasInfo.test.js +++ b/__tests__/src/components/CanvasInfo.test.js @@ -15,13 +15,12 @@ describe('CanvasInfo', () => { canvasDescription="The Canvas Description" canvasMetadata={metadata} id="xyz" - t={str => str} />, ); }); it('renders the content in a CollapsibleSection', async () => { - expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('currentItem'); + expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('Current item'); expect(screen.getByRole('heading', { level: 5 })).toHaveTextContent(/The Canvas Label/); await user.click(screen.getByRole('button')); diff --git a/__tests__/src/components/CanvasLayers.test.js b/__tests__/src/components/CanvasLayers.test.js index 1d5133fafc..b149425531 100644 --- a/__tests__/src/components/CanvasLayers.test.js +++ b/__tests__/src/components/CanvasLayers.test.js @@ -14,7 +14,6 @@ function createWrapper(props) { label="A Canvas Label" layerMetadata={{}} layers={[]} - t={t => t} totalSize={1} updateLayers={() => {}} windowId="abc" @@ -28,7 +27,7 @@ describe('CanvasLayers', () => { it('displays the canvas label', () => { createWrapper({ totalSize: 2 }); - expect(screen.getByText('annotationCanvasLabel', { container: '.MuiTypography-overline' })).toBeInTheDocument(); + expect(screen.getByText('Left: [A Canvas Label]', { container: '.MuiTypography-overline' })).toBeInTheDocument(); }); }); @@ -44,9 +43,9 @@ describe('CanvasLayers', () => { expect(screen.getAllByRole('listitem')[0]).toHaveTextContent('1'); expect(screen.getAllByRole('listitem')[1]).toHaveTextContent('2'); - expect(screen.getAllByRole('button', { name: 'layer_hide' }).length).toEqual(2); - expect(screen.getAllByRole('button', { name: 'layer_moveToTop' }).length).toEqual(2); - expect(screen.getAllByRole('spinbutton', { name: 'layer_opacity' }).length).toEqual(2); + expect(screen.getAllByRole('button', { name: 'Hide layer' }).length).toEqual(2); + expect(screen.getAllByRole('button', { name: 'Move layer to top' }).length).toEqual(2); + expect(screen.getAllByRole('spinbutton', { name: 'Layer opacity' }).length).toEqual(2); }); it('handles drag + drop of layers', async () => { @@ -99,7 +98,7 @@ describe('CanvasLayers', () => { }); it('has a button for moving a layer to the top', async () => { - await user.click(screen.getAllByLabelText('layer_moveToTop')[1]); + await user.click(screen.getAllByLabelText('Move layer to top')[1]); expect(updateLayers).toHaveBeenCalledWith('abc', 'https://prtd.app/hamilton/canvas/p1.json', { 'https://prtd.app/image/iiif/2/hamilton%2fHL_524_1r_00_PSC/full/862,1024/0/default.jpg': { @@ -112,7 +111,7 @@ describe('CanvasLayers', () => { }); it('has a button for toggling visibility', async () => { - await user.click(screen.getAllByLabelText('layer_hide')[1]); + await user.click(screen.getAllByLabelText('Hide layer')[1]); expect(updateLayers).toHaveBeenCalledWith('abc', 'https://prtd.app/hamilton/canvas/p1.json', { 'https://prtd.app/image/iiif/2/hamilton%2fHL_524_1r_00_TS_Blue/full/862,1024/0/default.png': { diff --git a/__tests__/src/components/ChangeThemeDialog.test.js b/__tests__/src/components/ChangeThemeDialog.test.js index 906a52fb29..1757dd5172 100644 --- a/__tests__/src/components/ChangeThemeDialog.test.js +++ b/__tests__/src/components/ChangeThemeDialog.test.js @@ -12,7 +12,6 @@ function createWrapper(props) { handleClose={() => {}} open setSelectedTheme={() => {}} - t={t => (t)} selectedTheme="light" themeIds={['light', 'dark']} {...props} @@ -37,8 +36,8 @@ describe('ChangeThemeDialog', () => { const menuItems = screen.queryAllByRole('menuitem'); expect(menuItems.length).toBe(2); - expect(menuItems[0]).toHaveTextContent('light'); - expect(menuItems[1]).toHaveTextContent('dark'); + expect(menuItems[0]).toHaveTextContent('Light theme'); + expect(menuItems[1]).toHaveTextContent('Dark theme'); }); it('shows up theme selection properly', async () => { @@ -46,7 +45,7 @@ describe('ChangeThemeDialog', () => { const setSelectedTheme = jest.fn(); createWrapper({ setSelectedTheme }); - const menuItem = screen.getByRole('menuitem', { name: 'light' }); + const menuItem = screen.getByRole('menuitem', { name: 'Light theme' }); expect(menuItem).toBeInTheDocument(); await user.click(menuItem); @@ -58,7 +57,7 @@ describe('ChangeThemeDialog', () => { it('focuses the selected item', () => { createWrapper({ selectedTheme: 'light' }); - const menuItem = screen.getByRole('menuitem', { name: 'light' }); + const menuItem = screen.getByRole('menuitem', { name: 'Light theme' }); expect(menuItem).toHaveFocus(); }); }); diff --git a/__tests__/src/components/CollapsibleSection.test.js b/__tests__/src/components/CollapsibleSection.test.js index aad2dd0f4c..1617590e61 100644 --- a/__tests__/src/components/CollapsibleSection.test.js +++ b/__tests__/src/components/CollapsibleSection.test.js @@ -11,7 +11,6 @@ function createWrapper(props) { classes={{}} id="abc123" label="The Section Label" - t={k => k} {...props} > Child content @@ -29,9 +28,9 @@ describe('CollapsibleSection', () => { }); it('renders the appropriate i18n label based on open state', async () => { - expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'collapseSection'); + expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'Collapse "The Section Label" section'); await userEvent.click(screen.getByRole('button')); - expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'expandSection'); + expect(screen.getByRole('button')).toHaveAttribute('aria-label', 'Expand "The Section Label" section'); }); it('displays children based on the open state', async () => { diff --git a/__tests__/src/components/CollectionDialog.test.js b/__tests__/src/components/CollectionDialog.test.js index f8e7afa90e..460e6638be 100644 --- a/__tests__/src/components/CollectionDialog.test.js +++ b/__tests__/src/components/CollectionDialog.test.js @@ -17,7 +17,6 @@ function createWrapper(props) { classes={{}} ready manifest={manifest} - t={(key) => key} windowId="window" {...props} />, @@ -45,7 +44,7 @@ describe('CollectionDialog', () => { const hideCollectionDialog = jest.fn(); createWrapper({ hideCollectionDialog }); - await user.click(screen.getByRole('button', { name: 'close' })); + await user.click(screen.getByRole('button', { name: 'Close' })); expect(hideCollectionDialog).toHaveBeenCalled(); }); }); diff --git a/__tests__/src/components/CollectionInfo.test.js b/__tests__/src/components/CollectionInfo.test.js index bbeb3d6b85..f422f5f18f 100644 --- a/__tests__/src/components/CollectionInfo.test.js +++ b/__tests__/src/components/CollectionInfo.test.js @@ -19,12 +19,12 @@ describe('CollectionInfo', () => { const user = userEvent.setup(); createWrapper(); - expect(screen.getByRole('heading', { name: 'collection' })).toBeVisible(); - expect(screen.getByRole('button', { name: 'showCollection' })).toBeVisible(); + expect(screen.getByRole('heading', { name: 'Collection' })).toBeVisible(); + expect(screen.getByRole('button', { name: 'Show collection' })).toBeVisible(); - await user.click(screen.getByRole('button', { name: 'collapseSection' })); + await user.click(screen.getByRole('button', { name: 'Collapse "Collection" section' })); - expect(screen.queryByRole('button', { name: 'showCollection' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Show collection' })).not.toBeInTheDocument(); }); it('without a collectionPath, renders nothing', () => { const wrapper = createWrapper({ collectionPath: [] }); @@ -36,7 +36,7 @@ describe('CollectionInfo', () => { createWrapper({ showCollectionDialog }); - await user.click(screen.getByRole('button', { name: 'showCollection' })); + await user.click(screen.getByRole('button', { name: 'Show collection' })); expect(showCollectionDialog).toHaveBeenCalled(); }); }); diff --git a/__tests__/src/components/CompanionArea.test.js b/__tests__/src/components/CompanionArea.test.js index 53e7bcdb0a..e80fbedc70 100644 --- a/__tests__/src/components/CompanionArea.test.js +++ b/__tests__/src/components/CompanionArea.test.js @@ -13,7 +13,6 @@ function createWrapper(props) { position="right" companionAreaOpen companionWindowIds={['foo', 'baz']} - t={key => key} {...props} />, { preloadedState: { companionWindows: { baz: { content: 'attribution' }, foo: { content: 'info' } } } }, @@ -36,8 +35,8 @@ describe('CompanionArea', () => { it('renders the appropriate components', () => { createWrapper(); - expect(screen.getByRole('heading', { name: 'aboutThisItem' })).toBeInTheDocument(); - expect(screen.getByRole('heading', { name: 'attributionTitle' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'About this item' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Rights' })).toBeInTheDocument(); }); it('has a toggle to show the companion area window in the left position', async () => { @@ -51,10 +50,10 @@ describe('CompanionArea', () => { sideBarOpen: true, }); - expect(screen.getByRole('button', { name: 'expandSidePanel' })).toHaveAttribute('aria-expanded', 'false'); + expect(screen.getByRole('button', { name: 'Expand sidebar' })).toHaveAttribute('aria-expanded', 'false'); expect(screen.queryByRole('complementary')).not.toBeInTheDocument(); - await user.click(screen.getByRole('button', { name: 'expandSidePanel' })); + await user.click(screen.getByRole('button', { name: 'Expand sidebar' })); expect(setCompanionAreaOpen).toHaveBeenCalledWith('abc123', true); }); @@ -70,8 +69,8 @@ describe('CompanionArea', () => { sideBarOpen: true, }); - expect(screen.getByRole('button', { name: 'collapseSidePanel' })).toHaveAttribute('aria-expanded', 'true'); - await user.click(screen.getByRole('button', { name: 'collapseSidePanel' })); + expect(screen.getByRole('button', { name: 'Collapse sidebar' })).toHaveAttribute('aria-expanded', 'true'); + await user.click(screen.getByRole('button', { name: 'Collapse sidebar' })); expect(setCompanionAreaOpen).toHaveBeenCalledWith('abc123', false); }); @@ -84,7 +83,7 @@ describe('CompanionArea', () => { sideBarOpen: false, }); - expect(screen.queryByRole('button', { name: 'collapseSidePanel' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Collapse sidebar' })).not.toBeInTheDocument(); }); it('does not show a toggle in other positions', () => { @@ -95,6 +94,6 @@ describe('CompanionArea', () => { sideBarOpen: true, }); - expect(screen.queryByRole('button', { name: 'collapseSidePanel' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Collapse sidebar' })).not.toBeInTheDocument(); }); }); diff --git a/__tests__/src/components/CompanionWindow.test.js b/__tests__/src/components/CompanionWindow.test.js index a7fe7b71ef..d25bf855c7 100644 --- a/__tests__/src/components/CompanionWindow.test.js +++ b/__tests__/src/components/CompanionWindow.test.js @@ -42,7 +42,7 @@ describe('CompanionWindow', () => { updateCompanionWindow, }); - await user.click(screen.getByRole('button', { name: 'openInCompanionWindow' })); + await user.click(screen.getByRole('button', { name: 'Open in separate panel' })); expect(updateCompanionWindow).toHaveBeenCalledWith({ position: 'right' }); }); @@ -57,7 +57,7 @@ describe('CompanionWindow', () => { onCloseClick: removeCompanionWindowEvent, }); - await user.click(screen.getByRole('button', { name: 'closeCompanionWindow' })); + await user.click(screen.getByRole('button', { name: 'Close panel' })); expect(removeCompanionWindowEvent).toHaveBeenCalledTimes(1); }); @@ -97,7 +97,7 @@ describe('CompanionWindow', () => { expect(screen.getByRole('complementary')).toHaveClass('mirador-companion-window-right'); - await user.click(screen.getByRole('button', { name: 'moveCompanionWindowToBottom' })); + await user.click(screen.getByRole('button', { name: 'Move to bottom' })); expect(updateCompanionWindow).toHaveBeenCalledWith({ position: 'bottom' }); }); @@ -115,7 +115,7 @@ describe('CompanionWindow', () => { expect(screen.getByRole('complementary')).toHaveClass('mirador-companion-window-bottom '); - await user.click(screen.getByRole('button', { name: 'moveCompanionWindowToRight' })); + await user.click(screen.getByRole('button', { name: 'Move to right' })); expect(updateCompanionWindow).toHaveBeenCalledWith({ position: 'right' }); }); diff --git a/__tests__/src/components/CompanionWindowFactory.test.js b/__tests__/src/components/CompanionWindowFactory.test.js index 5019630aa5..bc4ce436a3 100644 --- a/__tests__/src/components/CompanionWindowFactory.test.js +++ b/__tests__/src/components/CompanionWindowFactory.test.js @@ -22,7 +22,7 @@ describe('CompanionWindowFactory', () => { content: 'info', }); - expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('aboutThisItem'); + expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('About this item'); }); }); @@ -32,7 +32,7 @@ describe('CompanionWindowFactory', () => { content: 'canvas', }); - expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('canvasIndex'); + expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Index'); }); }); @@ -42,7 +42,7 @@ describe('CompanionWindowFactory', () => { content: 'annotations', }); - expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('annotations'); + expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Annotations'); }); }); @@ -52,7 +52,7 @@ describe('CompanionWindowFactory', () => { content: 'attribution', }); - expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('attributionTitle'); + expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Rights'); }); }); @@ -62,7 +62,7 @@ describe('CompanionWindowFactory', () => { content: 'thumbnailNavigation', }); - expect(screen.getByRole('grid')).toHaveAccessibleName('thumbnailNavigation'); + expect(screen.getByRole('grid')).toHaveAccessibleName('Thumbnails'); }); }); @@ -72,7 +72,7 @@ describe('CompanionWindowFactory', () => { content: 'search', }); - expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('searchTitle'); + expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Search'); }); }); @@ -82,7 +82,7 @@ describe('CompanionWindowFactory', () => { content: 'layers', }); - expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('layers'); + expect(screen.getByRole('heading', { level: 3 })).toHaveAccessibleName('Layers'); }); }); }); diff --git a/__tests__/src/components/ErrorContent.test.js b/__tests__/src/components/ErrorContent.test.js index f87af1cfbe..8c5a3da561 100644 --- a/__tests__/src/components/ErrorContent.test.js +++ b/__tests__/src/components/ErrorContent.test.js @@ -1,4 +1,3 @@ -import { t } from 'i18next'; import { render, screen } from 'test-utils'; import { ErrorContent } from '../../../src/components/ErrorContent'; @@ -11,7 +10,6 @@ describe('ErrorContent', () => { windowId="xyz" manifestId="foo" classes={{}} - t={t} />, { preloadedState: { @@ -42,7 +40,6 @@ describe('ErrorContent', () => { manifestId="foo" showJsError={false} classes={{}} - t={t} />, { preloadedState: { diff --git a/__tests__/src/components/ErrorDialog.test.js b/__tests__/src/components/ErrorDialog.test.js index 650f4df5e2..137f2f72ee 100644 --- a/__tests__/src/components/ErrorDialog.test.js +++ b/__tests__/src/components/ErrorDialog.test.js @@ -8,7 +8,6 @@ import { ErrorDialog } from '../../../src/components/ErrorDialog'; function createWrapper(props) { return render( key} {...props} />, ); @@ -21,7 +20,7 @@ describe('ErrorDialog', () => { createWrapper({ error }); expect(screen.getByRole('dialog')).toBeInTheDocument(); - expect(screen.getByRole('heading')).toHaveTextContent('errorDialogTitle'); + expect(screen.getByRole('heading')).toHaveTextContent('An error occurred'); }); it('shows up error message correctly', () => { @@ -39,7 +38,7 @@ describe('ErrorDialog', () => { createWrapper({ error, removeError: mockHandleClick }); - await user.click(screen.getByRole('button', { name: 'errorDialogConfirm' })); + await user.click(screen.getByRole('button', { name: 'OK' })); expect(mockHandleClick).toHaveBeenCalledTimes(1); }); }); diff --git a/__tests__/src/components/FullScreenButton.test.js b/__tests__/src/components/FullScreenButton.test.js index 6b28ddaf52..fb908daf30 100644 --- a/__tests__/src/components/FullScreenButton.test.js +++ b/__tests__/src/components/FullScreenButton.test.js @@ -33,7 +33,7 @@ describe('FullScreenButton', () => { }); it('has the proper aria-label i18n key', () => { - expect(screen.getByRole('button')).toHaveAccessibleName('workspaceFullScreen'); + expect(screen.getByRole('button')).toHaveAccessibleName('Full screen'); }); it('triggers the handle enter with the appropriate boolean', async () => { @@ -53,7 +53,7 @@ describe('FullScreenButton', () => { }); it('has the proper aria-label', () => { - expect(screen.getByRole('button')).toHaveAccessibleName('exitFullScreen'); + expect(screen.getByRole('button')).toHaveAccessibleName('Exit full screen'); }); it('triggers the handle exit with the appropriate boolean', async () => { diff --git a/__tests__/src/components/IIIFAuthentication.test.js b/__tests__/src/components/IIIFAuthentication.test.js index d49d5e712d..2c920c3066 100644 --- a/__tests__/src/components/IIIFAuthentication.test.js +++ b/__tests__/src/components/IIIFAuthentication.test.js @@ -18,7 +18,6 @@ function createWrapper(props) { resetAuthenticationState={() => {}} resolveAccessTokenRequest={() => {}} resolveAuthenticationRequest={() => {}} - t={key => key} windowId="w" {...props} />, @@ -33,7 +32,7 @@ describe('IIIFAuthentication', () => { describe('without an auth service', () => { it('renders nothing', () => { createWrapper({ authServiceId: null }); - expect(screen.queryByRole('button', { name: 'login' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Log in' })).not.toBeInTheDocument(); expect(screen.queryByRole('button')).not.toBeInTheDocument(); }); }); @@ -41,22 +40,22 @@ describe('IIIFAuthentication', () => { it('renders a login bar', async () => { const handleAuthInteraction = jest.fn(); createWrapper({ handleAuthInteraction }); - await user.click(screen.getByRole('button', { name: 'login' })); + await user.click(screen.getByRole('button', { name: 'Log in' })); expect(handleAuthInteraction).toHaveBeenCalledWith('w', 'http://example.com/auth'); }); it('renders nothing for a non-interactive login', () => { createWrapper({ isInteractive: false }); - expect(screen.queryByText('login')).not.toBeInTheDocument(); + expect(screen.queryByText('Log in')).not.toBeInTheDocument(); }); }); describe('with a failed authentication', () => { it('renders with an error message', async () => { const handleAuthInteraction = jest.fn(); createWrapper({ handleAuthInteraction, status: 'failed' }); - await user.click(screen.getByRole('button', { name: 'continue' })); - const confirmBtn = screen.getByRole('button', { name: /retry/ }); + await user.click(screen.getByRole('button', { name: 'Continue' })); + const confirmBtn = screen.getByRole('button', { name: /Retry/ }); expect(screen.getByText('Login failed')).toBeInTheDocument(); - expect(screen.getByText('cancel')).toBeInTheDocument(); + expect(screen.getByText('Cancel')).toBeInTheDocument(); expect(screen.getByText('... and this is why.')).toBeInTheDocument(); await user.click(confirmBtn); expect(handleAuthInteraction).toHaveBeenCalledWith('w', 'http://example.com/auth'); @@ -70,7 +69,7 @@ describe('IIIFAuthentication', () => { window.open = mockWindowOpen; const resolveCookieMock = jest.fn(); createWrapper({ resolveAuthenticationRequest: resolveCookieMock, status: 'cookie' }); - expect(screen.getByRole('button', { name: 'login' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Log in' })).toBeInTheDocument(); expect(mockWindowOpen).toHaveBeenCalledWith(`http://example.com/auth?origin=${window.origin}`, 'IiifLoginSender', 'centerscreen'); mockWindow.closed = true; jest.runOnlyPendingTimers(); @@ -80,7 +79,7 @@ describe('IIIFAuthentication', () => { it('does the IIIF access token behavior', async () => { const resolveTokenMock = jest.fn(); createWrapper({ resolveAccessTokenRequest: resolveTokenMock, status: 'token' }); - expect(screen.getByRole('button', { name: 'login' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Log in' })).toBeInTheDocument(); window.dispatchEvent(new MessageEvent('message', { data: { messageId: 'http://example.com/token' }, })); diff --git a/__tests__/src/components/LayersPanel.test.js b/__tests__/src/components/LayersPanel.test.js index 82eb293e86..098c9bb0fe 100644 --- a/__tests__/src/components/LayersPanel.test.js +++ b/__tests__/src/components/LayersPanel.test.js @@ -9,7 +9,6 @@ function createWrapper(props) { return render( str} windowId="window" {...props} />, @@ -22,7 +21,6 @@ describe('LayersPanel', () => { const canvasIds = ['a', 'b']; createWrapper({ canvasIds }); - expect(screen.getAllByText('annotationCanvasLabel').length).toBe(2); expect(screen.getAllByRole('list').length).toBe(2); }); }); diff --git a/__tests__/src/components/ManifestForm.test.js b/__tests__/src/components/ManifestForm.test.js index edb81fa6ee..ef0296385c 100644 --- a/__tests__/src/components/ManifestForm.test.js +++ b/__tests__/src/components/ManifestForm.test.js @@ -7,7 +7,6 @@ function createWrapper(props) { return render( {}} - t={str => str} {...props} />, ); @@ -17,13 +16,13 @@ describe('ManifestForm', () => { it('renders nothing if it is not open', () => { createWrapper({ addResourcesOpen: false }); - expect(screen.queryByRole('textbox', { name: 'addManifestUrl' })).not.toBeInTheDocument(); + expect(screen.queryByRole('textbox', { name: 'Resource location' })).not.toBeInTheDocument(); }); it('renders the form fields', () => { createWrapper({ addResourcesOpen: true }); - expect(screen.getByRole('textbox', { name: 'addManifestUrl' })).toBeInTheDocument(); + expect(screen.getByRole('textbox', { name: 'Resource location' })).toBeInTheDocument(); expect(screen.getByRole('button')).toHaveAttribute('type', 'submit'); }); @@ -32,9 +31,9 @@ describe('ManifestForm', () => { const onCancel = jest.fn(); createWrapper({ addResourcesOpen: true, onCancel }); - await user.type(screen.getByRole('textbox', { name: 'addManifestUrl' }), 'asdf'); + await user.type(screen.getByRole('textbox', { name: 'Resource location' }), 'asdf'); - await user.click(screen.getByRole('button', { name: 'cancel' })); + await user.click(screen.getByRole('button', { name: 'Cancel' })); expect(onCancel).toHaveBeenCalled(); expect(screen.getByRole('textbox')).toHaveValue(''); @@ -45,8 +44,8 @@ describe('ManifestForm', () => { const addResource = jest.fn(); const onSubmit = jest.fn(); createWrapper({ addResource, addResourcesOpen: true, onSubmit }); - await user.type(screen.getByRole('textbox', { name: 'addManifestUrl' }), 'http://example.com/iiif'); - await user.click(screen.getByRole('button', { name: 'fetchManifest' })); + await user.type(screen.getByRole('textbox', { name: 'Resource location' }), 'http://example.com/iiif'); + await user.click(screen.getByRole('button', { name: 'Add' })); expect(addResource).toHaveBeenCalledWith('http://example.com/iiif'); expect(onSubmit).toHaveBeenCalled(); diff --git a/__tests__/src/components/ManifestInfo.test.js b/__tests__/src/components/ManifestInfo.test.js index 46e90bcc09..5ff6c177ff 100644 --- a/__tests__/src/components/ManifestInfo.test.js +++ b/__tests__/src/components/ManifestInfo.test.js @@ -13,13 +13,12 @@ describe('ManifestInfo', () => { manifestDescription="The Manifest Description" manifestMetadata={metadata} manifestSummary="The Manifest Summary" - t={str => str} />, ); }); it('renders the content in a CollapsibleSection', () => { - expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('resource'); + expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('Resource'); }); it('renders manifest label', () => { diff --git a/__tests__/src/components/ManifestListItem.test.js b/__tests__/src/components/ManifestListItem.test.js index 11fbb7c0ce..f58674f383 100644 --- a/__tests__/src/components/ManifestListItem.test.js +++ b/__tests__/src/components/ManifestListItem.test.js @@ -12,7 +12,6 @@ function createWrapper(props) { ready addWindow={() => {}} fetchManifest={() => {}} - t={t => t} {...props} />, ); @@ -44,7 +43,7 @@ describe('ManifestListItem', () => { it('renders an error message if fetching the manifest failed', () => { createWrapper({ error: 'This is an error message' }); - expect(screen.getByText('manifestError')).toBeInTheDocument(); + expect(screen.getByText('The resource cannot be added:')).toBeInTheDocument(); expect(screen.getByText('http://example.com')).toBeInTheDocument(); }); it('updates and adds window when button clicked', async () => { diff --git a/__tests__/src/components/ManifestListItemError.test.js b/__tests__/src/components/ManifestListItemError.test.js index aef9880b7a..72aa930f7c 100644 --- a/__tests__/src/components/ManifestListItemError.test.js +++ b/__tests__/src/components/ManifestListItemError.test.js @@ -12,7 +12,6 @@ function createWrapper(props) { manifestId="http://example.com" onDismissClick={() => {}} onTryAgainClick={() => {}} - t={key => key} {...props} />, ); @@ -24,7 +23,7 @@ describe('ManifestListItemError', () => { it('renders the failed manifest url and error key', () => { createWrapper(); - expect(screen.getByText('manifestError')).toBeInTheDocument(); + expect(screen.getByText('The resource cannot be added:')).toBeInTheDocument(); expect(screen.getByText('http://example.com')).toBeInTheDocument(); }); @@ -33,7 +32,7 @@ describe('ManifestListItemError', () => { mockFn = jest.fn(); createWrapper({ onDismissClick: mockFn }); - await user.click(screen.getByRole('button', { name: 'dismiss' })); + await user.click(screen.getByRole('button', { name: 'Dismiss' })); expect(mockFn).toHaveBeenCalledWith('http://example.com'); }); @@ -43,7 +42,7 @@ describe('ManifestListItemError', () => { mockFn = jest.fn(); createWrapper({ onTryAgainClick: mockFn }); - await user.click(screen.getByRole('button', { name: 'tryAgain' })); + await user.click(screen.getByRole('button', { name: 'Try again' })); expect(mockFn).toHaveBeenCalledWith('http://example.com'); }); diff --git a/__tests__/src/components/ManifestRelatedLinks.test.js b/__tests__/src/components/ManifestRelatedLinks.test.js index fe07eae5c8..3d236ec193 100644 --- a/__tests__/src/components/ManifestRelatedLinks.test.js +++ b/__tests__/src/components/ManifestRelatedLinks.test.js @@ -43,48 +43,47 @@ describe('ManifestRelatedLinks', () => { value: 'http://example.com/b', }, ]} - t={str => str} />, ); }); it('renders the content in a CollapsibleSection', async () => { const user = userEvent.setup(); - expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('related'); - expect(screen.getByRole('heading', { level: 5 })).toHaveTextContent(/links/); + expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('Related'); + expect(screen.getByRole('heading', { level: 5 })).toHaveTextContent(/Links/); - await user.click(screen.getByRole('button', { name: 'collapseSection' })); + await user.click(screen.getByRole('button', { name: 'Collapse "Related" section' })); expect(screen.queryByRole('heading', { level: 5 })).not.toBeInTheDocument(); }); it('renders manifest homepage information', () => { - expect(screen.getByText('iiif_homepage').tagName).toEqual('DT'); + expect(screen.getByText('About this resource').tagName).toEqual('DT'); expect(screen.getByRole('link', { name: 'Home page' })).toHaveAttribute('href', 'http://example.com/'); }); it('renders manifest renderings information', () => { - expect(screen.getByText('iiif_renderings').tagName).toEqual('DT'); + expect(screen.getByText('Alternate formats').tagName).toEqual('DT'); expect(screen.getByRole('link', { name: 'PDF Version' })).toHaveAttribute('href', 'http://example.com/pdf'); }); it('renders related information', () => { - expect(screen.getByText('iiif_related').tagName).toEqual('DT'); + expect(screen.getAllByText('Related')[1].tagName).toEqual('DT'); expect(screen.getByRole('link', { name: 'http://example.com/related' })).toHaveAttribute('href', 'http://example.com/related'); expect(screen.getByRole('link', { name: 'Video' })).toHaveAttribute('href', 'http://example.com/video'); expect(screen.getByText('(video/ogg)')).toBeInTheDocument(); }); it('renders manifest seeAlso information', () => { - expect(screen.getByText('iiif_seeAlso').tagName).toEqual('DT'); + expect(screen.getByText('See also').tagName).toEqual('DT'); expect(screen.getByRole('link', { name: 'A' })).toHaveAttribute('href', 'http://example.com/a'); expect(screen.getByText('(text/html)')).toBeInTheDocument(); expect(screen.getByRole('link', { name: 'http://example.com/b' })).toHaveAttribute('href', 'http://example.com/b'); }); it('renders manifest links', () => { - expect(screen.getByText('iiif_manifest').tagName).toEqual('DT'); + expect(screen.getByText('IIIF manifest').tagName).toEqual('DT'); expect(screen.getByRole('link', { name: 'http://example.com/' })).toHaveAttribute('href', 'http://example.com/'); }); }); diff --git a/__tests__/src/components/MosaicRenderPreview.test.js b/__tests__/src/components/MosaicRenderPreview.test.js index 9739efe160..70cd162288 100644 --- a/__tests__/src/components/MosaicRenderPreview.test.js +++ b/__tests__/src/components/MosaicRenderPreview.test.js @@ -6,12 +6,11 @@ describe('MosaicRenderPreview', () => { it('it renders the given title prop passed through the t prop function', () => { render( `${k} ${args.title}`} title="The Title Prop" windowId="abc123" />, ); - expect(screen.getByRole('heading')).toHaveTextContent('previewWindowTitle The Title Prop'); + expect(screen.getByRole('heading')).toHaveTextContent('The Title Prop'); }); }); diff --git a/__tests__/src/components/OpenSeadragonViewer.test.js b/__tests__/src/components/OpenSeadragonViewer.test.js index 90e5311e1f..b1bd9e88d8 100644 --- a/__tests__/src/components/OpenSeadragonViewer.test.js +++ b/__tests__/src/components/OpenSeadragonViewer.test.js @@ -26,8 +26,8 @@ function createWrapper(props) { windowId="base" config={{}} updateViewport={jest.fn()} - t={k => k} canvasWorld={new CanvasWorld(canvases)} + t={k => k} {...props} > @@ -49,7 +49,7 @@ describe('OpenSeadragonViewer', () => { it('renders the component', () => { createWrapper({}); - expect(screen.getByLabelText('item')).toHaveClass('mirador-osd-container'); + expect(screen.getByLabelText('Item:')).toHaveClass('mirador-osd-container'); }); it('renders child components enhanced with additional props', async () => { diff --git a/__tests__/src/components/SearchHit.test.js b/__tests__/src/components/SearchHit.test.js index e999a8b1e8..bb844f6df6 100644 --- a/__tests__/src/components/SearchHit.test.js +++ b/__tests__/src/components/SearchHit.test.js @@ -93,7 +93,7 @@ describe('SearchHit', () => { rerender(); expect(announcer).toHaveBeenCalledWith( - 'pagination The Canvas Label The Annotation Label Light up the moose , and start the chai', + '1 of 9 The Canvas Label The Annotation Label Light up the moose , and start the chai', 'polite', ); }); diff --git a/__tests__/src/components/SearchPanel.test.js b/__tests__/src/components/SearchPanel.test.js index f69d82fa95..1949b525ac 100644 --- a/__tests__/src/components/SearchPanel.test.js +++ b/__tests__/src/components/SearchPanel.test.js @@ -24,14 +24,14 @@ describe('SearchPanel', () => { it('renders a CompanionWindow', () => { createWrapper(); expect(screen.getByRole('complementary')).toBeInTheDocument(); - expect(screen.getByRole('heading', { name: 'searchTitle' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Search' })).toBeInTheDocument(); }); it('passes a Clear chip as the CompanionWindow title prop', () => { createWrapper({ query: 'Wolpertinger' }); - expect(screen.getByRole('heading', { name: /searchTitle/ })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'clearSearch' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: /Search/ })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'clear' })).toBeInTheDocument(); }); it('the Clear chip calls the removeSearch prop', async () => { @@ -40,7 +40,7 @@ describe('SearchPanel', () => { createWrapper({ query: 'Wolpertinger', removeSearch }); - await user.click(screen.getByRole('button', { name: 'clearSearch' })); + await user.click(screen.getByRole('button', { name: 'clear' })); expect(removeSearch).toHaveBeenCalled(); }); @@ -48,14 +48,14 @@ describe('SearchPanel', () => { it('does not render a Clear chip if there is no search query to be cleared', () => { createWrapper(); - expect(screen.queryByRole('button', { name: 'clearSearch' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'clear' })).not.toBeInTheDocument(); }); it('has the SearchPanelControls component', () => { createWrapper(); - expect(screen.getByRole('combobox', { name: 'searchInputLabel' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'searchSubmitAria' })).toBeInTheDocument(); + expect(screen.getByRole('combobox', { name: 'search terms' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Submit search' })).toBeInTheDocument(); }); it('has the SearchResults list', () => { diff --git a/__tests__/src/components/SearchPanelControls.test.js b/__tests__/src/components/SearchPanelControls.test.js index 133d6dbf73..547f5328b2 100644 --- a/__tests__/src/components/SearchPanelControls.test.js +++ b/__tests__/src/components/SearchPanelControls.test.js @@ -99,7 +99,7 @@ describe('SearchPanelControls', () => { createWrapper({ fetchSearch, query: '', searchService }); await user.clear(screen.getByRole('combobox')); - await user.click(screen.getByRole('button', { name: 'searchSubmitAria' })); + await user.click(screen.getByRole('button', { name: 'Submit search' })); expect(fetchSearch).not.toHaveBeenCalled(); }); diff --git a/__tests__/src/components/SearchPanelNavigation.test.js b/__tests__/src/components/SearchPanelNavigation.test.js index f4690e82bc..c01286f15a 100644 --- a/__tests__/src/components/SearchPanelNavigation.test.js +++ b/__tests__/src/components/SearchPanelNavigation.test.js @@ -26,11 +26,11 @@ describe('SearchPanelNavigation', () => { selectAnnotation, selectedContentSearchAnnotation: ['2'], }); - expect(screen.getByText('pagination')).toBeInTheDocument(); + expect(screen.getByText('2 of 3')).toBeInTheDocument(); expect(screen.getAllByRole('button').length).toEqual(2); - await user.click(screen.getByRole('button', { name: 'searchPreviousResult' })); + await user.click(screen.getByRole('button', { name: 'Previous result' })); expect(selectAnnotation).toHaveBeenCalledWith('1'); - await user.click(screen.getByRole('button', { name: 'searchNextResult' })); + await user.click(screen.getByRole('button', { name: 'Next result' })); expect(selectAnnotation).toHaveBeenCalledWith('3'); }); it('buttons disabled when no next/prev', () => { @@ -38,8 +38,8 @@ describe('SearchPanelNavigation', () => { searchHits: [{ annotations: ['1'] }], selectedContentSearchAnnotation: ['1'], }); - expect(screen.getByRole('button', { name: 'searchPreviousResult' })).toBeDisabled(); - expect(screen.getByRole('button', { name: 'searchNextResult' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Previous result' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Next result' })).toBeDisabled(); }); }); }); diff --git a/__tests__/src/components/SearchResults.test.js b/__tests__/src/components/SearchResults.test.js index 3579a9789a..2cec72d2ca 100644 --- a/__tests__/src/components/SearchResults.test.js +++ b/__tests__/src/components/SearchResults.test.js @@ -79,13 +79,13 @@ describe('SearchResults', () => { const user = userEvent.setup(); createWrapper({}); - await user.click(screen.getByRole('button', { name: 'more' })); + await user.click(screen.getByRole('button', { name: 'more...' })); expect(screen.getByRole('listitem')).toHaveTextContent(/start the chainsaw/); - expect(screen.queryByRole('button', { name: 'more' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'more...' })).not.toBeInTheDocument(); - await user.click(screen.getByRole('button', { name: 'backToResults' })); - expect(screen.getByRole('button', { name: 'more' })).toBeInTheDocument(); + await user.click(screen.getByRole('button', { name: 'Back to results' })); + expect(screen.getByRole('button', { name: 'more...' })).toBeInTheDocument(); }); describe('annotation-only search results', () => { @@ -108,7 +108,7 @@ describe('SearchResults', () => { searchHits: [], }); - expect(screen.getByText('searchNoResults')).toHaveClass('MuiTypography-body1'); + expect(screen.getByText('No results found')).toHaveClass('MuiTypography-body1'); }); it('while fetching', () => { @@ -118,7 +118,7 @@ describe('SearchResults', () => { searchHits: [], }); - expect(screen.queryByText('searchNoResults')).not.toBeInTheDocument(); + expect(screen.queryByText('No results found')).not.toBeInTheDocument(); }); it('without a query', () => { @@ -126,7 +126,7 @@ describe('SearchResults', () => { isFetching: false, query: '', }); - expect(screen.queryByText('searchNoResults')).not.toBeInTheDocument(); + expect(screen.queryByText('No results found')).not.toBeInTheDocument(); }); }); @@ -139,7 +139,7 @@ describe('SearchResults', () => { nextSearch: 'search?page=2', }); - await user.click(screen.getByRole('button', { name: /moreResults/ })); + await user.click(screen.getByRole('button', { name: /More results/ })); expect(fetchSearch).toHaveBeenCalledWith('window', 'cwid', 'search?page=2', 'query'); }); }); diff --git a/__tests__/src/components/SidebarIndexList.test.js b/__tests__/src/components/SidebarIndexList.test.js index e86e60fea3..842bd23270 100644 --- a/__tests__/src/components/SidebarIndexList.test.js +++ b/__tests__/src/components/SidebarIndexList.test.js @@ -16,7 +16,6 @@ function createWrapper(props) { id="asdf" canvases={canvases} classes={{}} - t={key => key} windowId="xyz" setCanvas={() => {}} config={{ canvasNavigation: { height: 100 } }} diff --git a/__tests__/src/components/ThumbnailNavigation.test.js b/__tests__/src/components/ThumbnailNavigation.test.js index 0cb5607614..339ef32fff 100644 --- a/__tests__/src/components/ThumbnailNavigation.test.js +++ b/__tests__/src/components/ThumbnailNavigation.test.js @@ -21,7 +21,6 @@ function Subject({ fixture = manifestJson, ...props }) { windowId="foobar" thumbnailNavigation={{ height: 150, width: 100 }} position="far-bottom" - t={k => k} {...props} /> ); diff --git a/__tests__/src/components/ViewerInfo.test.js b/__tests__/src/components/ViewerInfo.test.js index 87adf53f13..2c9a4e0ff7 100644 --- a/__tests__/src/components/ViewerInfo.test.js +++ b/__tests__/src/components/ViewerInfo.test.js @@ -9,7 +9,6 @@ function createWrapper(props) { canvasCount={8} canvasIndex={2} canvasLabel="testLabel" - t={k => k} {...props} />, ); @@ -18,7 +17,7 @@ function createWrapper(props) { describe('ViewerNavigation', () => { it('renders the component', () => { createWrapper(); - expect(screen.getByText('pagination', { selector: 'span' })).toBeInTheDocument(); + expect(screen.getByText('3 of 8', { selector: 'span' })).toBeInTheDocument(); expect(screen.getByText(/testLabel/i, { selector: 'span' })).toBeInTheDocument(); }); }); diff --git a/__tests__/src/components/ViewerNavigation.test.js b/__tests__/src/components/ViewerNavigation.test.js index 7a70cd6e23..6a88f91518 100644 --- a/__tests__/src/components/ViewerNavigation.test.js +++ b/__tests__/src/components/ViewerNavigation.test.js @@ -8,7 +8,6 @@ function createWrapper(props) { (k)} {...props} />, ); @@ -39,8 +38,8 @@ describe('ViewerNavigation', () => { setNextCanvas, setPreviousCanvas, }); - expect(screen.getByRole('button', { name: 'nextCanvas' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'nextCanvas' })).toBeEnabled(); + expect(screen.getByRole('button', { name: 'Next item' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Next item' })).toBeEnabled(); }); it('setNextCanvas function is called after click', async () => { createWrapper({ @@ -50,7 +49,7 @@ describe('ViewerNavigation', () => { setPreviousCanvas, }); const user = userEvent.setup(); - await user.click(screen.getByRole('button', { name: 'nextCanvas' })); + await user.click(screen.getByRole('button', { name: 'Next item' })); expect(setNextCanvas).toHaveBeenCalled(); }); }); @@ -62,7 +61,7 @@ describe('ViewerNavigation', () => { setNextCanvas, setPreviousCanvas, }); - expect(screen.getByRole('button', { name: 'nextCanvas' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Next item' })).toBeDisabled(); }); }); describe('when previous canvases are present', () => { @@ -73,8 +72,8 @@ describe('ViewerNavigation', () => { setNextCanvas, setPreviousCanvas, }); - expect(screen.getByRole('button', { name: 'previousCanvas' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'previousCanvas' })).toBeEnabled(); + expect(screen.getByRole('button', { name: 'Previous item' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Previous item' })).toBeEnabled(); }); it('setPreviousCanvas function is called after click', async () => { createWrapper({ @@ -84,7 +83,7 @@ describe('ViewerNavigation', () => { setPreviousCanvas, }); const user = userEvent.setup(); - await user.click(screen.getByRole('button', { name: 'previousCanvas' })); + await user.click(screen.getByRole('button', { name: 'Previous item' })); expect(setPreviousCanvas).toHaveBeenCalled(); }); }); @@ -96,7 +95,7 @@ describe('ViewerNavigation', () => { setNextCanvas, setPreviousCanvas, }); - expect(screen.getByRole('button', { name: 'previousCanvas' })).toBeDisabled(); + expect(screen.getByRole('button', { name: 'Previous item' })).toBeDisabled(); }); }); describe('when viewingDirection is right-to-left', () => { @@ -108,8 +107,8 @@ describe('ViewerNavigation', () => { setPreviousCanvas, viewingDirection: 'right-to-left', }); - expect(screen.getByRole('button', { name: 'previousCanvas' }).querySelector('svg')).not.toHaveStyle('transform: rotate(180deg);'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('button', { name: 'nextCanvas' }).querySelector('svg')).toHaveStyle('transform: rotate(180deg);'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('button', { name: 'Previous item' }).querySelector('svg')).not.toHaveStyle('transform: rotate(180deg);'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('button', { name: 'Next item' }).querySelector('svg')).toHaveStyle('transform: rotate(180deg);'); // eslint-disable-line testing-library/no-node-access }); it('sets the dir="rtl"', () => { @@ -134,8 +133,8 @@ describe('ViewerNavigation', () => { setPreviousCanvas, viewingDirection: 'top-to-bottom', }); - expect(screen.getByRole('button', { name: 'previousCanvas' }).querySelector('svg')).toHaveStyle('transform: rotate(270deg);'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('button', { name: 'nextCanvas' }).querySelector('svg')).toHaveStyle('transform: rotate(90deg);'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('button', { name: 'Previous item' }).querySelector('svg')).toHaveStyle('transform: rotate(270deg);'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('button', { name: 'Next item' }).querySelector('svg')).toHaveStyle('transform: rotate(90deg);'); // eslint-disable-line testing-library/no-node-access }); }); describe('when viewingDirection is bottom-to-top', () => { @@ -147,8 +146,8 @@ describe('ViewerNavigation', () => { setPreviousCanvas, viewingDirection: 'bottom-to-top', }); - expect(screen.getByRole('button', { name: 'previousCanvas' }).querySelector('svg')).toHaveStyle('transform: rotate(90deg);'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('button', { name: 'nextCanvas' }).querySelector('svg')).toHaveStyle('transform: rotate(270deg);'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('button', { name: 'Previous item' }).querySelector('svg')).toHaveStyle('transform: rotate(90deg);'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('button', { name: 'Next item' }).querySelector('svg')).toHaveStyle('transform: rotate(270deg);'); // eslint-disable-line testing-library/no-node-access }); }); }); diff --git a/__tests__/src/components/Window.test.js b/__tests__/src/components/Window.test.js index de3bc26c5c..f06f3fc85f 100644 --- a/__tests__/src/components/Window.test.js +++ b/__tests__/src/components/Window.test.js @@ -10,7 +10,6 @@ function createWrapper(props, state, renderOptions) { windowId="xyz" manifestId="foo" classes={{}} - t={k => k} {...props} />, { @@ -30,11 +29,11 @@ function createWrapper(props, state, renderOptions) { describe('Window', () => { it('should render outer element', () => { createWrapper(); - expect(screen.getByLabelText('window')).toHaveClass('mirador-window'); + expect(screen.getByLabelText('Window:')).toHaveClass('mirador-window'); }); it('should render ', () => { createWrapper(); - expect(screen.getByRole('navigation', { accessibleName: 'windowNavigation' })).toBeInTheDocument(); + expect(screen.getByRole('navigation', { accessibleName: 'Window navigation' })).toBeInTheDocument(); }); it('should render ', () => { createWrapper(); @@ -54,7 +53,6 @@ describe('Window', () => { windowId="xyz" manifestId="foo" classes={{}} - t={k => k} windowDraggable workspaceType="mosaic" /> @@ -80,7 +78,6 @@ describe('Window', () => { windowId="xyz" manifestId="foo" classes={{}} - t={k => k} windowDraggable={false} workspaceType="mosaic" /> diff --git a/__tests__/src/components/WindowAuthenticationBar.test.js b/__tests__/src/components/WindowAuthenticationBar.test.js index c4368b8113..641c977375 100644 --- a/__tests__/src/components/WindowAuthenticationBar.test.js +++ b/__tests__/src/components/WindowAuthenticationBar.test.js @@ -15,7 +15,6 @@ function createWrapper(props) { label="Log in to see more" onConfirm={() => {}} status="ok" - t={key => key} windowId="w" {...props} />, @@ -48,24 +47,24 @@ describe('AuthenticationControl', () => { // disable transition animations for easier testing of the Mui Collapse open/close state config.disabled = true; // initial collapsed state: Presence of continue button text. Hidden cancelBtn, loginBtn, and description - expect(screen.getByText('continue')).toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'cancel' })).not.toBeInTheDocument(); + expect(screen.getByText('Continue')).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Cancel' })).not.toBeInTheDocument(); expect(screen.queryByRole('button', { name: 'Login' })).not.toBeInTheDocument(); expect(within(collapseEl).getByText('long description')).not.toBeVisible(); // click to expand await user.click(continueBtn); // expanded state: Removal of continue button text from DOM. Visible cancelBtn, loginBtn, and description - expect(screen.queryByText('continue')).not.toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'cancel' })).toBeVisible(); + expect(screen.queryByText('Continue')).not.toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Cancel' })).toBeVisible(); expect(screen.getByRole('button', { name: 'Login' })).toBeVisible(); expect(within(collapseEl).getByText('long description')).toBeVisible(); expect(collapseEl).toHaveClass('MuiCollapse-entered'); // click the cancel button to collapse - await user.click(screen.getByRole('button', { name: 'cancel' })); + await user.click(screen.getByRole('button', { name: 'Cancel' })); // collapsed state: Presence of continue button text. Hidden cancelBtn, loginBtn, and description - expect(screen.getByText('continue')).toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'cancel' })).not.toBeInTheDocument(); + expect(screen.getByText('Continue')).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Cancel' })).not.toBeInTheDocument(); expect(screen.queryByRole('button', { name: 'Login' })).not.toBeInTheDocument(); expect(within(collapseEl).getByText('long description')).not.toBeVisible(); // re-enable transition animation diff --git a/__tests__/src/components/WindowCanvasNavigationControls.test.js b/__tests__/src/components/WindowCanvasNavigationControls.test.js index de08147cc3..d851ffdd28 100644 --- a/__tests__/src/components/WindowCanvasNavigationControls.test.js +++ b/__tests__/src/components/WindowCanvasNavigationControls.test.js @@ -20,9 +20,9 @@ function Subject({ ...props }) { describe('WindowCanvasNavigationControls', () => { it('renders properly', async () => { const { container } = render(); - expect(screen.getByLabelText('previousCanvas', { selector: 'button' })).toBeInTheDocument(); - expect(screen.getByLabelText('nextCanvas', { selector: 'button' })).toBeInTheDocument(); - expect(screen.getByText('pagination')).toBeInTheDocument(); + expect(screen.getByLabelText('Previous item', { selector: 'button' })).toBeInTheDocument(); + expect(screen.getByLabelText('Next item', { selector: 'button' })).toBeInTheDocument(); + expect(screen.getByText(/1 of/)).toBeInTheDocument(); expect(container.firstChild).not.toHaveClass('mirador-canvas-nav-stacked'); // eslint-disable-line testing-library/no-node-access }); @@ -38,8 +38,8 @@ describe('WindowCanvasNavigationControls', () => { it('shows the zoom control component when specified', () => { render(); - expect(screen.getByRole('button', { name: 'zoomIn' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'zoomOut' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'zoomReset' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Zoom in' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Zoom out' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Reset zoom' })).toBeInTheDocument(); }); }); diff --git a/__tests__/src/components/WindowList.test.js b/__tests__/src/components/WindowList.test.js index dcf626f003..fba750a8c7 100644 --- a/__tests__/src/components/WindowList.test.js +++ b/__tests__/src/components/WindowList.test.js @@ -46,7 +46,7 @@ describe('WindowList', () => { it('renders without an error', async () => { const user = userEvent.setup(); expect(screen.getByRole('menuitem')).toBeInTheDocument(); - await user.click(screen.getByRole('menuitem', { name: 'untitled' })); + await user.click(screen.getByRole('menuitem', { name: '[Untitled]' })); expect(handleClose).toBeCalled(); expect(focusWindow).toBeCalledWith('xyz', true); diff --git a/__tests__/src/components/WindowListButton.test.js b/__tests__/src/components/WindowListButton.test.js index d889f578fb..eff13f230e 100644 --- a/__tests__/src/components/WindowListButton.test.js +++ b/__tests__/src/components/WindowListButton.test.js @@ -9,7 +9,6 @@ import { WindowListButton } from '../../../src/components/WindowListButton'; function createWrapper(props) { return render( str} windowCount={3} {...props} />, @@ -35,10 +34,10 @@ describe('WindowListButton', () => { createWrapper(); await user.click(screen.getByRole('button')); - expect(screen.getByText('openWindows', { container: '.MuiListSubheader-root' })).toBeInTheDocument(); + expect(screen.getByText('Current open windows', { container: '.MuiListSubheader-root' })).toBeInTheDocument(); - await user.click(screen.getByRole('menuitem', { name: 'untitled' })); + await user.click(screen.getByRole('menuitem', { name: '[Untitled]' })); - expect(screen.queryByText('openWindows', { container: '.MuiListSubheader-root' })).not.toBeInTheDocument(); + expect(screen.queryByText('Current open windows', { container: '.MuiListSubheader-root' })).not.toBeInTheDocument(); }); }); diff --git a/__tests__/src/components/WindowSideBar.test.js b/__tests__/src/components/WindowSideBar.test.js index 0fa75243cf..43d6e20743 100644 --- a/__tests__/src/components/WindowSideBar.test.js +++ b/__tests__/src/components/WindowSideBar.test.js @@ -5,7 +5,6 @@ import { WindowSideBar } from '../../../src/components/WindowSideBar'; function createWrapper({ ...props }) { return render( k} windowId="xyz" {...props} />, diff --git a/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js b/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js index 6aa4b1f564..f5c3942093 100644 --- a/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js +++ b/__tests__/src/components/WindowSideBarAnnotationsPanel.test.js @@ -1,5 +1,4 @@ import { render, screen } from 'test-utils'; -import { t } from 'i18next'; import CanvasAnnotations from '../../../src/containers/CanvasAnnotations'; import { WindowSideBarAnnotationsPanel } from '../../../src/components/WindowSideBarAnnotationsPanel'; @@ -11,7 +10,6 @@ function createWrapper(props, state) { annotationCount={4} classes={{}} id="xyz" - t={t} windowId="abc" {...props} />, @@ -31,7 +29,7 @@ describe('WindowSideBarAnnotationsPanel', () => { it('has the AnnotationSettings component', () => { createWrapper(); - expect(screen.getByRole('button', { name: 'highlightAllAnnotations' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Highlight all' })).toBeInTheDocument(); }); it('renders the annotationsCount', () => { diff --git a/__tests__/src/components/WindowSideBarButtons.test.js b/__tests__/src/components/WindowSideBarButtons.test.js index 919733154d..5fcd836ac0 100644 --- a/__tests__/src/components/WindowSideBarButtons.test.js +++ b/__tests__/src/components/WindowSideBarButtons.test.js @@ -1,6 +1,5 @@ import { render, screen } from 'test-utils'; import userEvent from '@testing-library/user-event'; -import { t } from 'i18next'; import { WindowSideBarButtons } from '../../../src/components/WindowSideBarButtons'; /** create wrapper */ @@ -8,7 +7,6 @@ function createWrapper(props) { return render( {}} - t={t} {...props} panels={{ annotations: true, diff --git a/__tests__/src/components/WindowSideBarCanvasPanel.test.js b/__tests__/src/components/WindowSideBarCanvasPanel.test.js index 9c3c48ca0a..3e997554d4 100644 --- a/__tests__/src/components/WindowSideBarCanvasPanel.test.js +++ b/__tests__/src/components/WindowSideBarCanvasPanel.test.js @@ -24,7 +24,6 @@ function createWrapper(props) { id="asdf" canvases={canvases} classes={{}} - t={key => key} windowId="xyz" setCanvas={() => {}} config={{ canvasNavigation: { height: 100 } }} @@ -43,20 +42,20 @@ describe('WindowSideBarCanvasPanel', () => { it('renders SidebarIndexList', () => { createWrapper({ multipleSequences: false }); - expect(screen.getByRole('heading', { name: 'canvasIndex' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Index' })).toBeInTheDocument(); expect(screen.getByRole('menu')).toBeInTheDocument(); }); it('without a treeStructure will not render the table of contents tab', () => { createWrapper({ multipleSequences: false }); - expect(screen.queryByRole('tab', { name: 'tableOfContentsList' })).not.toBeInTheDocument(); + expect(screen.queryByRole('tab', { name: 'Table of contents' })).not.toBeInTheDocument(); }); it('renders form control when multiple sequences present', () => { createWrapper({ multipleSequences: true, showToc: true }); - expect(screen.getByRole('tab', { name: 'tableOfContentsList' })).toBeInTheDocument(); + expect(screen.getByRole('tab', { name: 'Table of contents' })).toBeInTheDocument(); }); it('renders correct number of sequences in form control', async () => { @@ -80,7 +79,7 @@ describe('WindowSideBarCanvasPanel', () => { const updateVariant = jest.fn(); createWrapper({ multipleSequences: false, updateVariant }); - await user.click(screen.getByRole('tab', { name: 'thumbnailList' })); + await user.click(screen.getByRole('tab', { name: 'Thumbnail list' })); expect(updateVariant).toHaveBeenCalledWith('thumbnail'); }); }); diff --git a/__tests__/src/components/WindowSideBarInfoPanel.test.js b/__tests__/src/components/WindowSideBarInfoPanel.test.js index 7709eb43fa..9cb59b8d2e 100644 --- a/__tests__/src/components/WindowSideBarInfoPanel.test.js +++ b/__tests__/src/components/WindowSideBarInfoPanel.test.js @@ -8,7 +8,6 @@ function createWrapper(props) { str} {...props} />, { preloadedState: { companionWindows: { asdf: { content: 'info' } } } }, @@ -18,20 +17,19 @@ describe('WindowSideBarInfoPanel', () => { describe('when metadata is present', () => { it('renders headers', () => { createWrapper(); - expect(screen.getByRole('heading', { name: 'aboutThisItem' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'About this item' })).toBeInTheDocument(); }); it('renders the manifest elements', () => { createWrapper(); - expect(screen.getByRole('heading', { name: 'resource' })).toBeInTheDocument(); - expect(screen.getByRole('heading', { name: 'related' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Resource' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Related' })).toBeInTheDocument(); }); it('renders the canvas elements', () => { createWrapper({ canvasIds: ['1', '2'] }); - - expect(screen.getAllByRole('heading', { name: 'currentItem' }).length).toEqual(2); + expect(screen.getAllByRole('heading', { name: /(Left|Right)/ }).length).toEqual(2); }); }); }); diff --git a/__tests__/src/components/WindowThumbnailSettings.test.js b/__tests__/src/components/WindowThumbnailSettings.test.js index 27c0c03435..847c8f4888 100644 --- a/__tests__/src/components/WindowThumbnailSettings.test.js +++ b/__tests__/src/components/WindowThumbnailSettings.test.js @@ -20,21 +20,21 @@ describe('WindowThumbnailSettings', () => { it('renders all elements correctly', () => { createWrapper(); expect(screen.getByRole('presentation', { selector: 'li' })).toBeInTheDocument(); - expect(screen.getByRole('menuitem', { name: /off/ })).toBeInTheDocument(); - expect(screen.getByRole('menuitem', { name: /bottom/ })).toBeInTheDocument(); - expect(screen.getByRole('menuitem', { name: /right/ })).toBeInTheDocument(); + expect(screen.getByRole('menuitem', { name: /Off/ })).toBeInTheDocument(); + expect(screen.getByRole('menuitem', { name: /Bottom/ })).toBeInTheDocument(); + expect(screen.getByRole('menuitem', { name: /Right/ })).toBeInTheDocument(); }); it('for far-bottom it should set the correct label active (by setting the secondary color)', () => { createWrapper({ thumbnailNavigationPosition: 'far-bottom' }); - expect(screen.getByRole('menuitem', { name: /bottom/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /right/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /off/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Bottom/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Right/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Off/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access }); it('for far-right it should set the correct label active (by setting the secondary color)', () => { createWrapper({ thumbnailNavigationPosition: 'far-right' }); - expect(screen.getByRole('menuitem', { name: /right/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /off/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /bottom/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Right/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Off/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Bottom/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access }); it('updates state when the thumbnail config selection changes', async () => { @@ -57,6 +57,6 @@ describe('WindowThumbnailSettings', () => { it('when rtl flips an icon', () => { createWrapper({ direction: 'rtl' }); - expect(screen.getByRole('menuitem', { name: /right/ }).querySelector('svg')).toHaveStyle('transform: rotate(180deg);'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Right/ }).querySelector('svg')).toHaveStyle('transform: rotate(180deg);'); // eslint-disable-line testing-library/no-node-access }); }); diff --git a/__tests__/src/components/WindowTopBar.test.js b/__tests__/src/components/WindowTopBar.test.js index 8f2984dc26..97433f706f 100644 --- a/__tests__/src/components/WindowTopBar.test.js +++ b/__tests__/src/components/WindowTopBar.test.js @@ -11,7 +11,6 @@ function Subject({ ...props }) { str} focusWindow={() => {}} maximized={false} maximizeWindow={() => {}} @@ -31,12 +30,12 @@ describe('WindowTopBar', () => { it('renders all default components', () => { render(); - expect(screen.getByRole('navigation', { name: 'windowNavigation' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'toggleWindowSideBar' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'windowMenu' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'maximizeWindow' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'closeWindow' })).toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'allowFullscreen' })).not.toBeInTheDocument(); + expect(screen.getByRole('navigation', { name: 'Window navigation' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Toggle sidebar' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Window views & thumbnail display' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Maximize window' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Close window' })).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Full screen' })).not.toBeInTheDocument(); }); it('uses allow flags to override defaults', () => { @@ -47,17 +46,17 @@ describe('WindowTopBar', () => { allowTopMenuButton={false} allowFullscreen />); - expect(screen.queryByRole('button', { name: 'toggleWindowSideBar' })).not.toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'windowMenu' })).not.toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'maximizeWindow' })).not.toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'closeWindow' })).not.toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'workspaceFullScreen' })).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Toggle sidebar' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Window views & thumbnail display' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Maximize window' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Close window' })).not.toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Full screen' })).toBeInTheDocument(); }); it('triggers window focus when clicked', () => { const focusWindow = jest.fn(); render(); - const toolbar = screen.getByRole('navigation', { name: 'windowNavigation' }).firstChild; // eslint-disable-line testing-library/no-node-access + const toolbar = screen.getByRole('navigation', { name: 'Window navigation' }).firstChild; // eslint-disable-line testing-library/no-node-access expect(toolbar).toBeInTheDocument(); // we specifically need mouseDown not click for MUI Toolbar here fireEvent.mouseDown(toolbar); @@ -70,7 +69,7 @@ describe('WindowTopBar', () => { , { preloadedState: { windows: { xyz: { sideBarOpen: false } } } }, ); - const button = screen.getByRole('button', { name: 'toggleWindowSideBar' }); + const button = screen.getByRole('button', { name: 'Toggle sidebar' }); expect(button).toBeInTheDocument(); await user.click(button); expect(toggleWindowSideBar).toHaveBeenCalledTimes(1); @@ -79,7 +78,7 @@ describe('WindowTopBar', () => { it('passes correct callback to closeWindow button', async () => { const removeWindow = jest.fn(); render(); - const button = screen.getByRole('button', { name: 'closeWindow' }); + const button = screen.getByRole('button', { name: 'Close window' }); expect(button).toBeInTheDocument(); await user.click(button); expect(removeWindow).toHaveBeenCalledTimes(1); @@ -88,7 +87,7 @@ describe('WindowTopBar', () => { it('passes correct callback to maximizeWindow button', async () => { const maximizeWindow = jest.fn(); render(); - const button = screen.getByRole('button', { name: 'maximizeWindow' }); + const button = screen.getByRole('button', { name: 'Maximize window' }); expect(button).toBeInTheDocument(); await user.click(button); expect(maximizeWindow).toHaveBeenCalledTimes(1); @@ -96,13 +95,13 @@ describe('WindowTopBar', () => { it('close button is configurable', () => { render(); - const button = screen.queryByRole('button', { name: 'closeWindow' }); + const button = screen.queryByRole('button', { name: 'Close window' }); expect(button).not.toBeInTheDocument(); }); it('maximize button is configurable', () => { render(); - const button = screen.queryByRole('button', { name: 'maximizeWindow' }); + const button = screen.queryByRole('button', { name: 'Maximize window' }); expect(button).not.toBeInTheDocument(); }); }); diff --git a/__tests__/src/components/WindowTopBarPluginMenu.test.js b/__tests__/src/components/WindowTopBarPluginMenu.test.js index 2d887db324..ea752103f4 100644 --- a/__tests__/src/components/WindowTopBarPluginMenu.test.js +++ b/__tests__/src/components/WindowTopBarPluginMenu.test.js @@ -8,7 +8,6 @@ import { WindowTopBarPluginMenu } from '../../../src/components/WindowTopBarPlug function Subject({ ...props }) { return ( k} windowId="abc123" {...props} /> @@ -30,7 +29,7 @@ describe('WindowTopBarPluginMenu', () => { it('renders nothing (and no Button/Menu/PluginHook)', () => { render(); expect(screen.queryByTestId('testA')).not.toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'windowPluginMenu' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Window options' })).not.toBeInTheDocument(); }); }); @@ -42,7 +41,7 @@ describe('WindowTopBarPluginMenu', () => { }); it('renders the Button', async () => { - expect(screen.getByRole('button', { name: 'windowPluginMenu' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Window options' })).toBeInTheDocument(); }); it('the Menu is controlled by the Button clicks', async () => { @@ -50,7 +49,7 @@ describe('WindowTopBarPluginMenu', () => { expect(screen.queryByTestId('testA')).not.toBeInTheDocument(); // open - await user.click(screen.getByRole('button', { name: 'windowPluginMenu' })); + await user.click(screen.getByRole('button', { name: 'Window options' })); expect(screen.getByRole('menu')).toBeInTheDocument(); await user.keyboard('{Escape}'); diff --git a/__tests__/src/components/WindowTopMenu.test.js b/__tests__/src/components/WindowTopMenu.test.js index 0cfcfa345e..f36c1679a7 100644 --- a/__tests__/src/components/WindowTopMenu.test.js +++ b/__tests__/src/components/WindowTopMenu.test.js @@ -33,16 +33,16 @@ describe('WindowTopMenu', () => { const menuSections = within(screen.getByRole('menu')).getAllByRole('presentation'); expect(menuSections).toHaveLength(2); - expect(menuSections[0]).toHaveTextContent('view'); - expect(menuSections[1]).toHaveTextContent('thumbnail'); + expect(menuSections[0]).toHaveTextContent('View'); + expect(menuSections[1]).toHaveTextContent('Thumbnails'); const menuItems = screen.getAllByRole('menuitem'); expect(menuItems).toHaveLength(5); - expect(menuItems[0]).toHaveTextContent('single'); - expect(menuItems[1]).toHaveTextContent('gallery'); - expect(menuItems[2]).toHaveTextContent('off'); - expect(menuItems[3]).toHaveTextContent('bottom'); - expect(menuItems[4]).toHaveTextContent('right'); + expect(menuItems[0]).toHaveTextContent('Single'); + expect(menuItems[1]).toHaveTextContent('Gallery'); + expect(menuItems[2]).toHaveTextContent('Off'); + expect(menuItems[3]).toHaveTextContent('Bottom'); + expect(menuItems[4]).toHaveTextContent('Right'); }); it('does not display unless open', () => { diff --git a/__tests__/src/components/WindowTopMenuButton.test.js b/__tests__/src/components/WindowTopMenuButton.test.js index 15d4b65f42..c0d47d9c07 100644 --- a/__tests__/src/components/WindowTopMenuButton.test.js +++ b/__tests__/src/components/WindowTopMenuButton.test.js @@ -9,7 +9,6 @@ function Subject({ ...props }) { windowId="xyz" data-testid="test" classes={{ ctrlBtnSelected: 'ctrlBtnSelected' }} - t={str => str} {...props} /> ); @@ -23,14 +22,14 @@ describe('WindowTopMenuButton', () => { it('renders the button element', () => { render(); - expect(screen.getByLabelText('windowMenu')).toBeInTheDocument(); + expect(screen.getByLabelText('Window views & thumbnail display')).toBeInTheDocument(); }); it('toggles open/close of when clicked', async () => { render(); expect(screen.queryByRole('menu')).not.toBeInTheDocument(); - await user.click(screen.getByLabelText('windowMenu')); + await user.click(screen.getByLabelText('Window views & thumbnail display')); expect(screen.getByRole('menu')).toBeInTheDocument(); // click something else to close the menu (the windowMenu button is hidden at this point) @@ -41,13 +40,13 @@ describe('WindowTopMenuButton', () => { it('the open attribute of the button is null without being clicked', async () => { render(); // without a click, the button is not open and therefore doesn't have aria-owns attr - expect(screen.getByLabelText('windowMenu')).not.toHaveAttribute('aria-owns'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByLabelText('Window views & thumbnail display')).not.toHaveAttribute('aria-owns'); // eslint-disable-line testing-library/no-node-access }); it('the open attribute of the button is applied once it is clicked', async () => { render(); - await user.click(screen.getByLabelText('windowMenu')); + await user.click(screen.getByLabelText('Window views & thumbnail display')); // when 'open' is true, aria-owns is set to the id of the window - expect(screen.getByLabelText('windowMenu')).toHaveAttribute('aria-owns', 'window-menu_xyz'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByLabelText('Window views & thumbnail display')).toHaveAttribute('aria-owns', 'window-menu_xyz'); // eslint-disable-line testing-library/no-node-access }); }); diff --git a/__tests__/src/components/WindowViewSettings.test.js b/__tests__/src/components/WindowViewSettings.test.js index a46ae91d7d..2f97301678 100644 --- a/__tests__/src/components/WindowViewSettings.test.js +++ b/__tests__/src/components/WindowViewSettings.test.js @@ -22,30 +22,30 @@ describe('WindowViewSettings', () => { expect(screen.getByRole('presentation', { selector: 'li' })).toBeInTheDocument(); const menuItems = screen.queryAllByRole('menuitem'); expect(menuItems.length).toBe(4); - expect(menuItems[0]).toHaveTextContent(/single/i); - expect(menuItems[1]).toHaveTextContent(/book/i); - expect(menuItems[2]).toHaveTextContent(/scroll/i); - expect(menuItems[3]).toHaveTextContent(/gallery/i); + expect(menuItems[0]).toHaveTextContent(/Single/i); + expect(menuItems[1]).toHaveTextContent(/Book/i); + expect(menuItems[2]).toHaveTextContent(/Scroll/i); + expect(menuItems[3]).toHaveTextContent(/Gallery/i); }); it('single should set the correct label active (by setting the secondary color)', () => { createWrapper({ windowViewType: 'single' }); - expect(screen.getByRole('menuitem', { name: /single/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /book/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Single/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Book/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access }); it('book should set the correct label active (by setting the secondary color)', () => { createWrapper({ windowViewType: 'book' }); - expect(screen.getByRole('menuitem', { name: /book/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /single/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Book/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Single/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access }); it('scroll should set the correct label active (by setting the secondary color)', () => { createWrapper({ windowViewType: 'scroll' }); - expect(screen.getByRole('menuitem', { name: /scroll/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /single/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Scroll/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Single/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access }); it('gallery should set the correct label active (by setting the secondary color)', () => { createWrapper({ windowViewType: 'gallery' }); - expect(screen.getByRole('menuitem', { name: /gallery/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access - expect(screen.getByRole('menuitem', { name: /single/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Gallery/ }).querySelector('svg')).toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByRole('menuitem', { name: /Single/ }).querySelector('svg')).not.toHaveClass('MuiSvgIcon-colorSecondary'); // eslint-disable-line testing-library/no-node-access }); it('updates state when the view config selection changes', async () => { const setWindowViewType = jest.fn(); diff --git a/__tests__/src/components/Workspace.test.js b/__tests__/src/components/Workspace.test.js index 493598f751..9ae6b7a850 100644 --- a/__tests__/src/components/Workspace.test.js +++ b/__tests__/src/components/Workspace.test.js @@ -19,7 +19,6 @@ function createWrapper(props) { windowIds={['1', '2']} workspaceId="foo" workspaceType="mosaic" - t={k => k} {...props} /> , @@ -42,7 +41,7 @@ describe('Workspace', () => { it('should render properly', () => { const { container } = createWrapper({ workspaceType: 'elastic' }); - expect(screen.getByRole('heading', { name: 'miradorViewer' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Mirador viewer' })).toBeInTheDocument(); expect(container.querySelector('.mirador-workspace.react-draggable')).toBeInTheDocument(); }); @@ -51,7 +50,7 @@ describe('Workspace', () => { it('should render properly', () => { const { container } = createWrapper(); - expect(screen.getByRole('heading', { name: 'miradorViewer' })).toBeInTheDocument(); + expect(screen.getByRole('heading', { name: 'Mirador viewer' })).toBeInTheDocument(); expect(container.querySelector('.mirador-mosaic')).toBeInTheDocument(); expect(container.querySelector('.drop-target-container')).toBeInTheDocument(); @@ -61,16 +60,16 @@ describe('Workspace', () => { it('should render components as list', () => { createWrapper({ workspaceType: 'bubu' }); - expect(screen.getByRole('heading', { name: 'miradorViewer' })).toBeInTheDocument(); - expect(screen.getAllByLabelText('window')).toHaveLength(2); + expect(screen.getByRole('heading', { name: 'Mirador viewer' })).toBeInTheDocument(); + expect(screen.getAllByLabelText('Window:')).toHaveLength(2); }); }); describe('if any windows are maximized', () => { it('should render only maximized components', () => { createWrapper({ maximizedWindowIds: ['1'] }); - expect(screen.getByRole('heading', { name: 'miradorViewer' })).toBeInTheDocument(); - expect(screen.getByLabelText('window')).toHaveAttribute('id', '1'); + expect(screen.getByRole('heading', { name: 'Mirador viewer' })).toBeInTheDocument(); + expect(screen.getByLabelText('Window:')).toHaveAttribute('id', '1'); }); }); @@ -78,8 +77,8 @@ describe('Workspace', () => { it('should render placeholder content', () => { createWrapper({ windowIds: [] }); - expect(screen.getByRole('heading', { name: 'miradorViewer' })).toBeInTheDocument(); - expect(screen.getByText('welcome')).toHaveClass('MuiTypography-h1'); + expect(screen.getByRole('heading', { name: 'Mirador viewer' })).toBeInTheDocument(); + expect(screen.getByText('Welcome to Mirador')).toHaveClass('MuiTypography-h1'); }); }); diff --git a/__tests__/src/components/WorkspaceAdd.test.js b/__tests__/src/components/WorkspaceAdd.test.js index a9f44a31e6..73c107d398 100644 --- a/__tests__/src/components/WorkspaceAdd.test.js +++ b/__tests__/src/components/WorkspaceAdd.test.js @@ -20,7 +20,6 @@ function createWrapper(props) { { manifestId: 'foo' }, ]} classes={{}} - t={str => str} {...props} /> , @@ -45,7 +44,7 @@ describe('WorkspaceAdd', () => { createWrapper({ catalog: [] }); expect(screen.queryByRole('listitem')).not.toBeInTheDocument(); - expect(screen.getByText('emptyResourceList')).toBeInTheDocument(); + expect(screen.getByText('Your resource list is empty')).toBeInTheDocument(); }); it('toggles the workspace visibility', async () => { @@ -62,7 +61,7 @@ describe('WorkspaceAdd', () => { const user = userEvent.setup(); createWrapper(); - const fab = screen.getByRole('button', { name: 'addResource' }); + const fab = screen.getByRole('button', { name: 'Add resource' }); expect(fab).toBeInTheDocument(); await user.click(fab); @@ -70,7 +69,7 @@ describe('WorkspaceAdd', () => { expect(fab).toBeDisabled(); expect(screen.getByRole('textbox')).toBeInTheDocument(); - await user.click(screen.getByRole('button', { name: 'closeAddResourceForm' })); + await user.click(screen.getByRole('button', { name: 'Close form' })); expect(screen.queryByRole('textbox')).not.toBeInTheDocument(); }); @@ -79,10 +78,10 @@ describe('WorkspaceAdd', () => { const user = userEvent.setup(); createWrapper(); - await user.click(screen.getByRole('button', { name: 'addResource' })); + await user.click(screen.getByRole('button', { name: 'Add resource' })); await user.type(screen.getByRole('textbox'), 'abc'); - await user.click(screen.getByRole('button', { name: 'fetchManifest' })); + await user.click(screen.getByRole('button', { name: 'Add' })); expect(screen.queryByRole('textbox')).not.toBeInTheDocument(); }); @@ -95,10 +94,10 @@ describe('WorkspaceAdd', () => { jest.spyOn(container.querySelector('.mirador-workspace-add'), 'scrollTo').mockImplementation(scrollTo); // eslint-disable-line testing-library/no-node-access, testing-library/no-container - await user.click(screen.getByRole('button', { name: 'addResource' })); + await user.click(screen.getByRole('button', { name: 'Add resource' })); await user.type(screen.getByRole('textbox'), 'abc'); - await user.click(screen.getByRole('button', { name: 'fetchManifest' })); + await user.click(screen.getByRole('button', { name: 'Add' })); expect(scrollTo).toHaveBeenCalledWith({ behavior: 'smooth', left: 0, top: 0 }); }); @@ -107,10 +106,10 @@ describe('WorkspaceAdd', () => { const user = userEvent.setup(); createWrapper(); - await user.click(screen.getByRole('button', { name: 'addResource' })); + await user.click(screen.getByRole('button', { name: 'Add resource' })); await user.type(screen.getByRole('textbox'), 'abc'); - await user.click(screen.getByRole('button', { name: 'cancel' })); + await user.click(screen.getByRole('button', { name: 'Cancel' })); expect(screen.queryByRole('textbox')).not.toBeInTheDocument(); }); diff --git a/__tests__/src/components/WorkspaceAddButton.test.js b/__tests__/src/components/WorkspaceAddButton.test.js index b590b7a000..1d5cf18f2d 100644 --- a/__tests__/src/components/WorkspaceAddButton.test.js +++ b/__tests__/src/components/WorkspaceAddButton.test.js @@ -8,7 +8,6 @@ function createWrapper(props) { {}} - t={str => str} useExtendedFab {...props} />, @@ -23,7 +22,7 @@ describe('WorkspaceAddButton', () => { const setWorkspaceAddVisibility = jest.fn(); createWrapper({ isWorkspaceAddVisible: false, setWorkspaceAddVisibility }); - await user.click(screen.getByRole('button', { name: 'startHere' })); + await user.click(screen.getByRole('button', { name: 'Start Here' })); expect(setWorkspaceAddVisibility).toHaveBeenCalledWith(true); }); @@ -33,7 +32,7 @@ describe('WorkspaceAddButton', () => { const setWorkspaceAddVisibility = jest.fn(); createWrapper({ isWorkspaceAddVisible: true, setWorkspaceAddVisibility }); - await user.click(screen.getByRole('button', { name: 'closeAddResourceMenu' })); + await user.click(screen.getByRole('button', { name: 'Close resource list' })); expect(setWorkspaceAddVisibility).toHaveBeenCalledWith(false); }); @@ -41,7 +40,7 @@ describe('WorkspaceAddButton', () => { it('is styled using the extended variant', () => { createWrapper({ useExtendedFab: true }); - expect(screen.getByRole('button', { name: 'startHere' })).toHaveClass('MuiFab-extended'); + expect(screen.getByRole('button', { name: 'Start Here' })).toHaveClass('MuiFab-extended'); }); }); }); diff --git a/__tests__/src/components/WorkspaceArea.test.js b/__tests__/src/components/WorkspaceArea.test.js index 1648a31daf..9d20dbf16d 100644 --- a/__tests__/src/components/WorkspaceArea.test.js +++ b/__tests__/src/components/WorkspaceArea.test.js @@ -12,7 +12,6 @@ function createWrapper(props) { isWorkspaceControlPanelVisible classes={{}} lang="en" - t={k => k} {...props} /> , @@ -30,12 +29,12 @@ describe('WorkspaceArea', () => { it('should render all needed elements', () => { const { container } = createWrapper(); - expect(screen.getByRole('button', { name: 'listAllOpenWindows' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'workspaceMenu' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'workspaceOptions' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Jump to window' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Workspace settings' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Workspace options' })).toBeInTheDocument(); - expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('miradorViewer'); - expect(screen.getByRole('main')).toHaveTextContent('welcome'); + expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mirador viewer'); + expect(screen.getByRole('main')).toHaveTextContent('Welcome to Mirador'); expect(container.querySelector('.mirador-background-plugin-area')).toBeInTheDocument(); // eslint-disable-line testing-library/no-node-access, testing-library/no-container }); @@ -43,18 +42,18 @@ describe('WorkspaceArea', () => { it('should not render WorkspaceControlPanel when isWorkspaceControlPanelVisible is false', () => { createWrapper({ isWorkspaceControlPanelVisible: false }); - expect(screen.queryByRole('button', { name: 'listAllOpenWindows' })).not.toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'workspaceMenu' })).not.toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'workspaceOptions' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Jump to window' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Workspace settings' })).not.toBeInTheDocument(); + expect(screen.queryByRole('button', { name: 'Workspace options' })).not.toBeInTheDocument(); }); describe('with isWorkspaceAddVisible', () => { it('should render WorkspaceAdd when isWorkspaceAddVisible is true', () => { createWrapper({ isWorkspaceAddVisible: true }); - expect(screen.queryByRole('heading', { level: 1, name: 'miradorViewer' })).not.toBeInTheDocument(); - expect(screen.getByRole('main')).toHaveTextContent('emptyResourceList'); - expect(within(screen.getByRole('main')).getByRole('button', { name: 'addResource' })).toBeInTheDocument(); + expect(screen.queryByRole('heading', { level: 1, name: 'Mirador viewer' })).not.toBeInTheDocument(); + expect(screen.getByRole('main')).toHaveTextContent('Your resource list is empty'); + expect(within(screen.getByRole('main')).getByRole('button', { name: 'Add resource' })).toBeInTheDocument(); }); }); }); diff --git a/__tests__/src/components/WorkspaceControlPanel.test.js b/__tests__/src/components/WorkspaceControlPanel.test.js index d0480c56e6..631c225d75 100644 --- a/__tests__/src/components/WorkspaceControlPanel.test.js +++ b/__tests__/src/components/WorkspaceControlPanel.test.js @@ -5,18 +5,16 @@ import { WorkspaceControlPanel } from '../../../src/components/WorkspaceControlP describe('WorkspaceControlPanel', () => { beforeEach(() => { render( - key} - />, + , ); }); it('renders without an error', () => { - expect(screen.getByRole('navigation', { name: 'workspaceNavigation' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'addResource' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'listAllOpenWindows' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'workspaceMenu' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'workspaceOptions' })).toBeInTheDocument(); - expect(screen.getByRole('link', { name: 'aboutMirador' })).toHaveAttribute('href', 'https://projectmirador.org'); + expect(screen.getByRole('navigation', { name: 'Workspace navigation' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Add resource' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Jump to window' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Workspace settings' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Workspace options' })).toBeInTheDocument(); + expect(screen.getByRole('link', { name: 'About Project Mirador' })).toHaveAttribute('href', 'https://projectmirador.org'); }); }); diff --git a/__tests__/src/components/WorkspaceControlPanelButtons.test.js b/__tests__/src/components/WorkspaceControlPanelButtons.test.js index 1ac87e5899..77b3a5ec43 100644 --- a/__tests__/src/components/WorkspaceControlPanelButtons.test.js +++ b/__tests__/src/components/WorkspaceControlPanelButtons.test.js @@ -8,8 +8,8 @@ describe('WorkspaceControlPanelButtons', () => { }); it('render all needed elements', () => { - expect(screen.getByRole('button', { name: 'listAllOpenWindows' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'workspaceMenu' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'workspaceOptions' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Jump to window' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Workspace settings' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Workspace options' })).toBeInTheDocument(); }); }); diff --git a/__tests__/src/components/WorkspaceElastic.test.js b/__tests__/src/components/WorkspaceElastic.test.js index e88a99dfbc..c3c634b1eb 100644 --- a/__tests__/src/components/WorkspaceElastic.test.js +++ b/__tests__/src/components/WorkspaceElastic.test.js @@ -56,7 +56,7 @@ describe('WorkspaceElastic', () => { it('should render properly with an initialValue', () => { createWrapper({ elasticLayout }); - expect(screen.getAllByLabelText('window')).toHaveLength(2); + expect(screen.getAllByLabelText('Window:')).toHaveLength(2); }); describe('workspace behaviour', () => { it('when workspace itself is dragged', async () => { diff --git a/__tests__/src/components/WorkspaceExport.test.js b/__tests__/src/components/WorkspaceExport.test.js index b4d5aa8913..e26f6d9c6f 100644 --- a/__tests__/src/components/WorkspaceExport.test.js +++ b/__tests__/src/components/WorkspaceExport.test.js @@ -37,7 +37,7 @@ describe('WorkspaceExport', () => { }); it('is closable by clicking the cancel button', async () => { - await user.click(screen.getByRole('button', { name: 'cancel' })); + await user.click(screen.getByRole('button', { name: 'Cancel' })); expect(handleClose).toHaveBeenCalled(); }); @@ -46,15 +46,15 @@ describe('WorkspaceExport', () => { // so we mock the prompt at least to avoid a warning in the test output jest.spyOn(window, 'prompt').mockImplementation(() => true); - await user.click(screen.getByRole('button', { name: 'copy' })); - expect(screen.getByRole('alert')).toHaveTextContent('exportCopied'); + await user.click(screen.getByRole('button', { name: 'Copy' })); + expect(screen.getByRole('alert')).toHaveTextContent('The workspace configuration was copied to your clipboard'); - await user.click(screen.getByRole('button', { name: 'dismiss' })); + await user.click(screen.getByRole('button', { name: 'Dismiss' })); expect(handleClose).toHaveBeenCalled(); }); it('renders an exportable version of state', async () => { - await user.click(screen.getByRole('button', { name: 'viewWorkspaceConfiguration' })); + await user.click(screen.getByRole('button', { name: 'View workspace configuration' })); expect(screen.getByRole('region').querySelector('pre')).toHaveTextContent( // eslint-disable-line testing-library/no-node-access '{ "companionWindows": {}, "config": {}, "elasticLayout": {}, "viewers": {}, "windows": {}, "workspace": {} }', ); diff --git a/__tests__/src/components/WorkspaceMenu.test.js b/__tests__/src/components/WorkspaceMenu.test.js index e701aacfa3..4405229a9c 100644 --- a/__tests__/src/components/WorkspaceMenu.test.js +++ b/__tests__/src/components/WorkspaceMenu.test.js @@ -16,7 +16,7 @@ function createShallow(props) { ); } -describe('WorkspaceMenu', () => { +describe('Workspace settings', () => { let handleClose; const showZoomControls = false; let toggleZoomControls; @@ -35,7 +35,7 @@ describe('WorkspaceMenu', () => { const user = userEvent.setup(); createShallow({ handleClose, showZoomControls, toggleZoomControls }); - await user.click(screen.getByRole('menuitem', { name: 'showZoomControls' })); + await user.click(screen.getByRole('menuitem', { name: 'Show zoom controls' })); expect(handleClose).toBeCalled(); }); @@ -44,7 +44,7 @@ describe('WorkspaceMenu', () => { handleClose, isWorkspaceAddVisible: true, showZoomControls, toggleZoomControls, }); - expect(screen.getByRole('menuitem', { name: 'showZoomControls' })).toHaveAttribute('aria-disabled', 'true'); + expect(screen.getByRole('menuitem', { name: 'Show zoom controls' })).toHaveAttribute('aria-disabled', 'true'); }); describe('handleZoomToggleClick', () => { @@ -53,7 +53,7 @@ describe('WorkspaceMenu', () => { createShallow({ handleClose, showZoomControls, toggleZoomControls }); - await user.click(screen.getByRole('menuitem', { name: 'showZoomControls' })); + await user.click(screen.getByRole('menuitem', { name: 'Show zoom controls' })); expect(toggleZoomControls).toBeCalledWith(true); }); diff --git a/__tests__/src/components/WorkspaceMenuButton.test.js b/__tests__/src/components/WorkspaceMenuButton.test.js index aca4b3d8df..f8040ab1dd 100644 --- a/__tests__/src/components/WorkspaceMenuButton.test.js +++ b/__tests__/src/components/WorkspaceMenuButton.test.js @@ -13,7 +13,7 @@ describe('WorkspaceMenuButton', () => { }); it('renders the button', () => { - expect(screen.getByRole('button')).toHaveAccessibleName('workspaceMenu'); + expect(screen.getByRole('button')).toHaveAccessibleName('Workspace settings'); }); it('toggles open/close of when clicked', async () => { diff --git a/__tests__/src/components/WorkspaceMosaic.test.js b/__tests__/src/components/WorkspaceMosaic.test.js index 9c569dd2ba..554ceb0c57 100644 --- a/__tests__/src/components/WorkspaceMosaic.test.js +++ b/__tests__/src/components/WorkspaceMosaic.test.js @@ -105,8 +105,8 @@ describe('WorkspaceMosaic', () => { it('when window is available', () => { wrapper = createWrapper({ windowIds }); - expect(screen.getAllByLabelText('window', { container: 'section' })[0]).toHaveAttribute('id', '1'); - expect(screen.getAllByLabelText('window', { container: 'section' })[1]).toHaveAttribute('id', '2'); + expect(screen.getAllByLabelText('Window:', { container: 'section' })[0]).toHaveAttribute('id', '1'); + expect(screen.getAllByLabelText('Window:', { container: 'section' })[1]).toHaveAttribute('id', '2'); expect(wrapper.container.querySelector('.mosaic-window-title')).toBeEmptyDOMElement(); expect(wrapper.container.querySelector('.mosaic-window-controls')).toBeEmptyDOMElement(); @@ -141,7 +141,7 @@ describe('WorkspaceMosaic', () => { }, ); - const dragTarget = screen.getAllByLabelText('windowNavigation')[0]; + const dragTarget = screen.getAllByLabelText('Window navigation')[0]; const dropTarget = container.querySelector('.mirador-mosaic > .drop-target-container > .drop-target.top'); // eslint-disable-line testing-library/no-container fireEvent.dragStart(dragTarget); diff --git a/__tests__/src/components/WorkspaceOptionsButton.test.js b/__tests__/src/components/WorkspaceOptionsButton.test.js index c70f1a8d98..b97932c8c1 100644 --- a/__tests__/src/components/WorkspaceOptionsButton.test.js +++ b/__tests__/src/components/WorkspaceOptionsButton.test.js @@ -8,7 +8,6 @@ function Subject({ ...props }) {
k} {...props} /> , @@ -25,14 +24,14 @@ describe('WorkspaceOptionsButton', () => { it('renders the button', () => { render(); - expect(screen.getByLabelText('workspaceOptions')).toBeInTheDocument(); + expect(screen.getByLabelText('Workspace options')).toBeInTheDocument(); }); it('toggles open/close of when clicked', async () => { render(); expect(screen.queryByRole('menu')).not.toBeInTheDocument(); - await user.click(screen.getByLabelText('workspaceOptions')); + await user.click(screen.getByLabelText('Workspace options')); expect(screen.getByRole('menu')).toBeInTheDocument(); // click something else to close the menu (the windowMenu button is hidden at this point) diff --git a/__tests__/src/components/WorkspaceOptionsMenu.test.js b/__tests__/src/components/WorkspaceOptionsMenu.test.js index 308dc459c1..64ebd9fabc 100644 --- a/__tests__/src/components/WorkspaceOptionsMenu.test.js +++ b/__tests__/src/components/WorkspaceOptionsMenu.test.js @@ -8,7 +8,6 @@ function Subject({ ...props }) {
{}} - t={k => k} {...props} /> , @@ -38,8 +37,8 @@ describe('WorkspaceOptionsMenu', () => { const menuItems = screen.getAllByRole('menuitem'); expect(menuItems).toHaveLength(2); - expect(menuItems[0]).toHaveTextContent('downloadExportWorkspace'); - expect(menuItems[1]).toHaveTextContent('importWorkspace'); + expect(menuItems[0]).toHaveTextContent('Export workspace'); + expect(menuItems[1]).toHaveTextContent('Import workspace'); }); it('does not display unless open', () => { diff --git a/__tests__/src/components/WorkspaceSelectionDialog.test.js b/__tests__/src/components/WorkspaceSelectionDialog.test.js index 23d7a841c6..e9cb69e921 100644 --- a/__tests__/src/components/WorkspaceSelectionDialog.test.js +++ b/__tests__/src/components/WorkspaceSelectionDialog.test.js @@ -32,18 +32,18 @@ describe('WorkspaceSelectionDialog', () => { createWrapper(); expect(screen.getByRole('dialog')).toBeInTheDocument(); - expect(screen.getByRole('menuitem', { name: /elastic/ })).toBeInTheDocument(); - expect(screen.getByRole('menuitem', { name: /mosaic/ })).toBeInTheDocument(); + expect(screen.getByRole('menuitem', { name: /Elastic/ })).toBeInTheDocument(); + expect(screen.getByRole('menuitem', { name: /Mosaic/ })).toBeInTheDocument(); }); it('sends the updateConfig and handleClose props on workspace selection', async () => { const user = userEvent.setup(); createWrapper(); - user.click(screen.getByRole('menuitem', { name: /elastic/ })); + user.click(screen.getByRole('menuitem', { name: /Elastic/ })); await waitFor(() => expect(updateWorkspace).toHaveBeenLastCalledWith({ type: 'elastic' })); - user.click(screen.getByRole('menuitem', { name: /mosaic/ })); + user.click(screen.getByRole('menuitem', { name: /Mosaic/ })); await waitFor(() => expect(updateWorkspace).toHaveBeenLastCalledWith({ type: 'mosaic' })); await waitFor(() => expect(handleClose).toHaveBeenCalledTimes(2)); }); @@ -52,7 +52,7 @@ describe('WorkspaceSelectionDialog', () => { it('sets an onEntered prop on the Dialog that focuses the selected item', () => { createWrapper(); - const menuItem = screen.getByRole('menuitem', { name: /elastic/ }); + const menuItem = screen.getByRole('menuitem', { name: /Elastic/ }); expect(menuItem).toHaveFocus(); }); }); diff --git a/__tests__/src/components/ZoomControls.test.js b/__tests__/src/components/ZoomControls.test.js index 41a562513e..c5f135b0a8 100644 --- a/__tests__/src/components/ZoomControls.test.js +++ b/__tests__/src/components/ZoomControls.test.js @@ -28,24 +28,24 @@ describe('ZoomControls', () => { }); it('renders a couple buttons', () => { - expect(screen.getByRole('button', { name: 'zoomIn' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'zoomOut' })).toBeInTheDocument(); - expect(screen.getByRole('button', { name: 'zoomReset' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Zoom in' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Zoom out' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: 'Reset zoom' })).toBeInTheDocument(); }); it('has a zoom-in button', async () => { - await user.click(screen.getByRole('button', { name: 'zoomIn' })); + await user.click(screen.getByRole('button', { name: 'Zoom in' })); expect(updateViewport).toHaveBeenCalledWith('xyz', { zoom: 2 }); }); it('has a zoom-out button', async () => { - await user.click(screen.getByRole('button', { name: 'zoomOut' })); + await user.click(screen.getByRole('button', { name: 'Zoom out' })); expect(updateViewport).toHaveBeenCalledWith('xyz', { zoom: 0.5 }); }); it('has a zoom reset button', async () => { - await user.click(screen.getByRole('button', { name: 'zoomReset' })); + await user.click(screen.getByRole('button', { name: 'Reset zoom' })); expect(zoomToWorld).toHaveBeenCalledWith(false); }); diff --git a/__tests__/utils/test-utils.js b/__tests__/utils/test-utils.js index 2e30b405cb..3ac5b28f24 100644 --- a/__tests__/utils/test-utils.js +++ b/__tests__/utils/test-utils.js @@ -4,12 +4,16 @@ import PropTypes from 'prop-types'; import { createStore, applyMiddleware } from 'redux'; import { thunk } from 'redux-thunk'; import { createTheme, ThemeProvider } from '@mui/material/styles'; +import { I18nextProvider } from 'react-i18next'; import createRootReducer from '../../src/state/reducers/rootReducer'; import settings from '../../src/config/settings'; +import createI18nInstance from '../../src/i18n'; const rootReducer = createRootReducer(); const theme = createTheme(settings.theme); +const i18n = createI18nInstance(); + /** * Hook up our rendered object to redux */ @@ -24,7 +28,15 @@ function renderWithProviders( ) { /** :nodoc: */ function Wrapper({ children }) { - return {children}; + return ( + + + + {children} + + + + ); } Wrapper.propTypes = { diff --git a/setupJest.js b/setupJest.js index 2ab44ffa28..2b2173cb0d 100644 --- a/setupJest.js +++ b/setupJest.js @@ -36,23 +36,3 @@ i18next.init({ en, }, }); - -jest.mock('react-i18next', () => ({ - I18nextProvider: ({ children }) => children, - initReactI18next: { - init: jest.fn(), - type: '3rdParty', - }, - useTranslation: () => ({ - t: (key) => key, - }), - // this mock makes sure any components using the translate HoC receive the t function as a prop - withTranslation: () => (WrappedComponent) => { - /** - * - */ - const I18nAwareComponent = ({ t = (k => k), ...props }) => ; // eslint-disable-line react/prop-types - - return I18nAwareComponent; - }, -})); diff --git a/src/components/AnnotationSettings.js b/src/components/AnnotationSettings.js index 847acf724c..8604a2f17d 100644 --- a/src/components/AnnotationSettings.js +++ b/src/components/AnnotationSettings.js @@ -1,6 +1,7 @@ import PropTypes from 'prop-types'; import VisibilityIcon from '@mui/icons-material/VisibilitySharp'; import VisibilityOffIcon from '@mui/icons-material/VisibilityOffSharp'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; /** @@ -8,8 +9,9 @@ import MiradorMenuButton from '../containers/MiradorMenuButton'; * display settings in the Annotation companion window */ export function AnnotationSettings({ - displayAll, displayAllDisabled, t, toggleAnnotationDisplay, + displayAll, displayAllDisabled, toggleAnnotationDisplay, }) { + const { t } = useTranslation(); return ( k, }) { + const { t } = useTranslation(); + const pluginProps = arguments[0]; // eslint-disable-line prefer-rest-params return ( @@ -84,6 +86,5 @@ AttributionPanel.propTypes = { value: PropTypes.string, })), rights: PropTypes.arrayOf(PropTypes.string), - t: PropTypes.func, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/Branding.js b/src/components/Branding.js index e299f548aa..5fe5967344 100644 --- a/src/components/Branding.js +++ b/src/components/Branding.js @@ -2,12 +2,14 @@ import PropTypes from 'prop-types'; import IconButton from '@mui/material/IconButton'; import Typography from '@mui/material/Typography'; import Stack from '@mui/material/Stack'; +import { useTranslation } from 'react-i18next'; import MiradorIcon from './icons/MiradorIcon'; /** * Display a branding icon */ -export function Branding({ t = k => k, variant = 'default', ...ContainerProps }) { +export function Branding({ variant = 'default', ...ContainerProps }) { + const { t } = useTranslation(); return ( { variant === 'wide' && ( @@ -31,6 +33,5 @@ export function Branding({ t = k => k, variant = 'default', ...ContainerProps }) } Branding.propTypes = { - t: PropTypes.func, variant: PropTypes.oneOf(['default', 'wide']), }; diff --git a/src/components/CanvasAnnotations.js b/src/components/CanvasAnnotations.js index d08f152203..3009ba4ff9 100644 --- a/src/components/CanvasAnnotations.js +++ b/src/components/CanvasAnnotations.js @@ -5,6 +5,7 @@ import MenuList from '@mui/material/MenuList'; import MenuItem from '@mui/material/MenuItem'; import ListItemText from '@mui/material/ListItemText'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; import SanitizedHtml from '../containers/SanitizedHtml'; import { ScrollTo } from './ScrollTo'; @@ -12,10 +13,11 @@ import { ScrollTo } from './ScrollTo'; * CanvasAnnotations ~ */ export function CanvasAnnotations({ - annotations = [], index, label, selectedAnnotationId = undefined, t, totalSize, + annotations = [], index, label, selectedAnnotationId = undefined, totalSize, listContainerComponent = 'li', htmlSanitizationRuleSet = 'iiif', hoveredAnnotationIds = [], containerRef = undefined, deselectAnnotation, selectAnnotation, windowId, hoverAnnotation, }) { + const { t } = useTranslation(); const handleClick = useCallback((_event, annotation) => { if (selectedAnnotationId === annotation.id) { deselectAnnotation(windowId, annotation.id); @@ -105,7 +107,6 @@ CanvasAnnotations.propTypes = { listContainerComponent: PropTypes.elementType, selectAnnotation: PropTypes.func.isRequired, selectedAnnotationId: PropTypes.string, - t: PropTypes.func.isRequired, totalSize: PropTypes.number.isRequired, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/CanvasInfo.js b/src/components/CanvasInfo.js index 57f693dcf2..2cd699c9ce 100644 --- a/src/components/CanvasInfo.js +++ b/src/components/CanvasInfo.js @@ -1,5 +1,6 @@ import PropTypes from 'prop-types'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; import CollapsibleSection from '../containers/CollapsibleSection'; import SanitizedHtml from '../containers/SanitizedHtml'; import { LabelValueMetadata } from './LabelValueMetadata'; @@ -14,9 +15,9 @@ export function CanvasInfo({ canvasMetadata = [], id, index = 1, - t = k => k, totalSize = 1, }) { + const { t } = useTranslation(); const pluginProps = arguments[0]; // eslint-disable-line prefer-rest-params return ( @@ -57,6 +58,5 @@ CanvasInfo.propTypes = { canvasMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types id: PropTypes.string.isRequired, index: PropTypes.number, - t: PropTypes.func, totalSize: PropTypes.number, }; diff --git a/src/components/CanvasLayers.js b/src/components/CanvasLayers.js index af0f769430..ed1abd71e2 100644 --- a/src/components/CanvasLayers.js +++ b/src/components/CanvasLayers.js @@ -13,6 +13,7 @@ import VisibilityIcon from '@mui/icons-material/VisibilitySharp'; import VisibilityOffIcon from '@mui/icons-material/VisibilityOffSharp'; import OpacityIcon from '@mui/icons-material/OpacitySharp'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; import { DragDropContext, Droppable, Draggable } from '@hello-pangea/dnd'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import IIIFThumbnail from '../containers/IIIFThumbnail'; @@ -50,8 +51,9 @@ function getUseableLabel(resource, index) { /** @private */ function Layer({ - resource, layerMetadata = {}, index, t, handleOpacityChange, setLayerVisibility, moveToTop, + resource, layerMetadata = {}, index, handleOpacityChange, setLayerVisibility, moveToTop, }) { + const { t } = useTranslation(); const { width, height } = { height: undefined, width: 50 }; const layer = { @@ -142,13 +144,13 @@ Layer.propTypes = { moveToTop: PropTypes.func.isRequired, resource: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types setLayerVisibility: PropTypes.func.isRequired, - t: PropTypes.func.isRequired, }; /** @private */ function DraggableLayer({ - children, resource, index, t, + children, resource, index, }) { + const { t } = useTranslation(); return ( {(provided, snapshot) => ( @@ -194,13 +196,13 @@ DraggableLayer.propTypes = { children: PropTypes.node.isRequired, index: PropTypes.number.isRequired, resource: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types - t: PropTypes.func.isRequired, }; /** */ export function CanvasLayers({ - canvasId, index, label, layers, layerMetadata = {}, t, totalSize, updateLayers, windowId, + canvasId, index, label, layers, layerMetadata = {}, totalSize, updateLayers, windowId, }) { + const { t } = useTranslation(); const droppableId = useId(); const handleOpacityChange = useCallback((layerId, value) => { @@ -278,12 +280,11 @@ export function CanvasLayers({ > { layers && layers.map((r, i) => ( - + ({ @@ -20,8 +21,9 @@ const ThemeIcon = styled(PaletteIcon, { name: 'ThemeIcon', slot: 'icon' })(({ th * a simple dialog providing the possibility to switch the theme */ export function ChangeThemeDialog({ - handleClose, open = false, selectedTheme, setSelectedTheme, t, themeIds = [], + handleClose, open = false, selectedTheme, setSelectedTheme, themeIds = [], }) { + const { t } = useTranslation(); const handleThemeChange = useCallback((theme) => { setSelectedTheme(theme); handleClose(); @@ -59,6 +61,5 @@ ChangeThemeDialog.propTypes = { open: PropTypes.bool, selectedTheme: PropTypes.string.isRequired, setSelectedTheme: PropTypes.func.isRequired, - t: PropTypes.func.isRequired, themeIds: PropTypes.arrayOf(PropTypes.string), }; diff --git a/src/components/CollapsibleSection.js b/src/components/CollapsibleSection.js index 22faae11e8..e0ceb194b0 100644 --- a/src/components/CollapsibleSection.js +++ b/src/components/CollapsibleSection.js @@ -5,13 +5,15 @@ import Accordion from '@mui/material/Accordion'; import AccordionDetails from '@mui/material/AccordionDetails'; import AccordionSummary from '@mui/material/AccordionSummary'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; +import { useTranslation } from 'react-i18next'; /** * CollapsableSection ~ */ export function CollapsibleSection({ - children, id, label, t, + children, id, label, }) { + const { t } = useTranslation(); const [open, setOpen] = useState(true); const handleChange = useCallback((_event, isExpanded) => { @@ -37,5 +39,4 @@ CollapsibleSection.propTypes = { id: PropTypes.string.isRequired, label: PropTypes.string.isRequired, - t: PropTypes.func.isRequired, }; diff --git a/src/components/CollectionDialog.js b/src/components/CollectionDialog.js index d0391dbc70..4e2e0b48ef 100644 --- a/src/components/CollectionDialog.js +++ b/src/components/CollectionDialog.js @@ -14,6 +14,7 @@ import { import ArrowBackIcon from '@mui/icons-material/ArrowBackSharp'; import Skeleton from '@mui/material/Skeleton'; import { styled } from '@mui/material/styles'; +import { useTranslation } from 'react-i18next'; import asArray from '../lib/asArray'; import { LabelValueMetadata } from './LabelValueMetadata'; import CollapsibleSection from '../containers/CollapsibleSection'; @@ -75,9 +76,10 @@ Placeholder.propTypes = { export function CollectionDialog({ addWindow, collection = null, collectionPath = [], error = null, hideCollectionDialog, isMultipart = false, manifest, manifestId, ready = false, - setWorkspaceAddVisibility, showCollectionDialog, t, updateWindow, windowId = null, + setWorkspaceAddVisibility, showCollectionDialog, updateWindow, windowId = null, }) { const container = useContext(WorkspaceContext); + const { t } = useTranslation(); const [filter, setFilter] = useState(null); const [, forceUpdate] = useReducer(x => x + 1, 0); @@ -250,7 +252,6 @@ CollectionDialog.propTypes = { ready: PropTypes.bool, setWorkspaceAddVisibility: PropTypes.func.isRequired, showCollectionDialog: PropTypes.func.isRequired, - t: PropTypes.func.isRequired, updateWindow: PropTypes.func.isRequired, windowId: PropTypes.string, }; diff --git a/src/components/CollectionInfo.js b/src/components/CollectionInfo.js index f2bdc97d39..c4aa043e26 100644 --- a/src/components/CollectionInfo.js +++ b/src/components/CollectionInfo.js @@ -2,14 +2,17 @@ import PropTypes from 'prop-types'; import Button from '@mui/material/Button'; import Typography from '@mui/material/Typography'; import ViewListIcon from '@mui/icons-material/ViewListSharp'; +import { useTranslation } from 'react-i18next'; import CollapsibleSection from '../containers/CollapsibleSection'; /** * CollectionInfo */ export function CollectionInfo({ - collectionLabel = null, collectionPath = [], id, showCollectionDialog, t = k => k, windowId = null, + collectionLabel = null, collectionPath = [], id, showCollectionDialog, windowId = null, }) { + const { t } = useTranslation(); + /** * Show the containing collection. */ @@ -52,6 +55,5 @@ CollectionInfo.propTypes = { collectionPath: PropTypes.arrayOf(PropTypes.string), id: PropTypes.string.isRequired, showCollectionDialog: PropTypes.func.isRequired, - t: PropTypes.func, windowId: PropTypes.string, }; diff --git a/src/components/CompanionArea.js b/src/components/CompanionArea.js index c09e3c2d22..35e17b4d49 100644 --- a/src/components/CompanionArea.js +++ b/src/components/CompanionArea.js @@ -4,6 +4,7 @@ import Slide from '@mui/material/Slide'; import ArrowLeftIcon from '@mui/icons-material/ArrowLeftSharp'; import ArrowRightIcon from '@mui/icons-material/ArrowRightSharp'; import classNames from 'classnames'; +import { useTranslation } from 'react-i18next'; import CompanionWindowFactory from '../containers/CompanionWindowFactory'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import ns from '../config/css-ns'; @@ -51,8 +52,9 @@ const StyledToggle = styled('div', { name: 'CompanionArea', slot: 'toggle' })(({ export function CompanionArea({ classes = {}, className = undefined, direction, companionWindowIds, companionAreaOpen, setCompanionAreaOpen = () => {}, - position, sideBarOpen = false, t, windowId, + position, sideBarOpen = false, windowId, }) { + const { t } = useTranslation(); /** */ const areaLayoutClass = (position === 'bottom' || position === 'far-bottom') ? classes.horizontal : null; @@ -125,6 +127,5 @@ CompanionArea.propTypes = { position: PropTypes.string.isRequired, setCompanionAreaOpen: PropTypes.func, sideBarOpen: PropTypes.bool, - t: PropTypes.func.isRequired, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/CompanionWindow.js b/src/components/CompanionWindow.js index 26b9fd7498..6d3ec99b0b 100644 --- a/src/components/CompanionWindow.js +++ b/src/components/CompanionWindow.js @@ -7,6 +7,7 @@ import MoveIcon from '@mui/icons-material/DragIndicatorSharp'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import Toolbar from '@mui/material/Toolbar'; +import { useTranslation } from 'react-i18next'; import { Rnd } from 'react-rnd'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import ns from '../config/css-ns'; @@ -26,9 +27,10 @@ const StyledCloseButton = styled(MiradorMenuButton, { name: 'CompanionWindow', s export function CompanionWindow(props) { // eslint-disable-line react/require-default-props const { ariaLabel = undefined, classes = {}, direction, paperClassName = '', onCloseClick = () => {}, updateCompanionWindow = undefined, isDisplayed = false, - position = null, t = key => key, title = null, children = undefined, titleControls = null, size = {}, + position = null, title = null, children = undefined, titleControls = null, size = {}, defaultSidebarPanelWidth = 235, defaultSidebarPanelHeight = 201, innerRef = undefined, } = props; + const { t } = useTranslation(); /** */ const openInNewStyle = direction === 'rtl' ? { transform: 'scale(-1, 1)' } : {}; @@ -196,7 +198,6 @@ CompanionWindow.propTypes = { paperClassName: PropTypes.string, position: PropTypes.string, size: PropTypes.shape({ width: PropTypes.number }), - t: PropTypes.func, title: PropTypes.oneOfType([ PropTypes.string, PropTypes.node, diff --git a/src/components/CompanionWindowFactory.js b/src/components/CompanionWindowFactory.js index 90e43d3b96..b3511dabd9 100644 --- a/src/components/CompanionWindowFactory.js +++ b/src/components/CompanionWindowFactory.js @@ -1,6 +1,7 @@ import { useCallback } from 'react'; import PropTypes from 'prop-types'; import { ErrorBoundary } from 'react-error-boundary'; +import { useTranslation } from 'react-i18next'; import CompanionWindowRegistry from '../lib/CompanionWindowRegistry'; import CompanionWindow from '../containers/CompanionWindow'; import ErrorContent from '../containers/ErrorContent'; @@ -9,8 +10,9 @@ import ErrorContent from '../containers/ErrorContent'; * Render a companion window using the appropriate component for the content */ export function CompanionWindowFactory({ - content = null, id, t = key => key, windowId, + content = null, id, windowId, }) { + const { t } = useTranslation(); const ErroredCompanionWindow = useCallback(({ error }) => ( k, ...rest + error, metadata = null, showJsError = true, ...rest }) { + const { t } = useTranslation(); if (!showJsError) return null; const pluginProps = { @@ -58,5 +60,4 @@ ErrorContent.propTypes = { error: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types metadata: PropTypes.object, // eslint-disable-line react/forbid-prop-types showJsError: PropTypes.bool, - t: PropTypes.func, }; diff --git a/src/components/ErrorDialog.js b/src/components/ErrorDialog.js index d985a4312c..1c49e93bab 100644 --- a/src/components/ErrorDialog.js +++ b/src/components/ErrorDialog.js @@ -4,11 +4,13 @@ import DialogTitle from '@mui/material/DialogTitle'; import PropTypes from 'prop-types'; import { DialogActions, DialogContentText } from '@mui/material'; import Button from '@mui/material/Button'; +import { useTranslation } from 'react-i18next'; import { isUndefined } from 'lodash'; /** */ -export function ErrorDialog({ error = null, removeError = () => {}, t = k => k }) { +export function ErrorDialog({ error = null, removeError = () => {} }) { + const { t } = useTranslation(); const hasError = !isUndefined(error); if (!error) return null; @@ -43,5 +45,4 @@ ErrorDialog.propTypes = { message: PropTypes.string, }), removeError: PropTypes.func, - t: PropTypes.func, }; diff --git a/src/components/FullScreenButton.js b/src/components/FullScreenButton.js index 572f4eb755..e05477a932 100644 --- a/src/components/FullScreenButton.js +++ b/src/components/FullScreenButton.js @@ -2,12 +2,14 @@ import { useContext } from 'react'; import FullscreenIcon from '@mui/icons-material/FullscreenSharp'; import FullscreenExitIcon from '@mui/icons-material/FullscreenExitSharp'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import FullScreenContext from '../contexts/FullScreenContext'; /** */ -export function FullScreenButton({ className = undefined, t = k => k }) { +export function FullScreenButton({ className = undefined }) { + const { t } = useTranslation(); const handle = useContext(FullScreenContext); if (handle && handle.active) { @@ -23,5 +25,4 @@ export function FullScreenButton({ className = undefined, t = k => k }) { FullScreenButton.propTypes = { className: PropTypes.string, - t: PropTypes.func, }; diff --git a/src/components/IIIFAuthentication.js b/src/components/IIIFAuthentication.js index 2853d9aaee..b680592cb5 100644 --- a/src/components/IIIFAuthentication.js +++ b/src/components/IIIFAuthentication.js @@ -1,4 +1,5 @@ import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import { AccessTokenSender } from './AccessTokenSender'; import { NewBrowserWindow } from './NewBrowserWindow'; import WindowAuthenticationBar from '../containers/WindowAuthenticationBar'; @@ -12,8 +13,9 @@ export function IIIFAuthentication({ handleAuthInteraction, header = undefined, isInteractive = true, label = undefined, logoutConfirm = undefined, logoutServiceId = undefined, openWindow = window.open, resetAuthenticationState, resolveAccessTokenRequest, resolveAuthenticationRequest, - status = null, t = k => k, windowId, + status = null, windowId, }) { + const { t } = useTranslation(); /** */ const onReceiveAccessTokenMessage = (payload) => { resolveAccessTokenRequest(authServiceId, accessTokenServiceId, payload); @@ -123,6 +125,5 @@ IIIFAuthentication.propTypes = { resolveAccessTokenRequest: PropTypes.func.isRequired, resolveAuthenticationRequest: PropTypes.func.isRequired, status: PropTypes.oneOf(['logout', 'ok', 'token', 'cookie', 'failed', null]), - t: PropTypes.func, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/LayersPanel.js b/src/components/LayersPanel.js index 0801852128..f2638236a6 100644 --- a/src/components/LayersPanel.js +++ b/src/components/LayersPanel.js @@ -1,4 +1,5 @@ import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import CompanionWindow from '../containers/CompanionWindow'; import CanvasLayers from '../containers/CanvasLayers'; @@ -6,8 +7,9 @@ import CanvasLayers from '../containers/CanvasLayers'; * a panel showing the canvases for a given manifest */ export function LayersPanel({ - canvasIds = [], id, t, windowId, + canvasIds = [], id, windowId, }) { + const { t } = useTranslation(); return ( {}, onCancel = null, t = k => k, + addResourcesOpen, addResource, onSubmit = () => {}, onCancel = null, }) { + const { t } = useTranslation(); const [formValue, setFormValue] = useState(''); /** */ @@ -85,5 +87,4 @@ ManifestForm.propTypes = { addResourcesOpen: PropTypes.bool.isRequired, onCancel: PropTypes.func, onSubmit: PropTypes.func, - t: PropTypes.func, }; diff --git a/src/components/ManifestInfo.js b/src/components/ManifestInfo.js index 3572d2f162..89bea987ca 100644 --- a/src/components/ManifestInfo.js +++ b/src/components/ManifestInfo.js @@ -1,5 +1,6 @@ import PropTypes from 'prop-types'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; import CollapsibleSection from '../containers/CollapsibleSection'; import SanitizedHtml from '../containers/SanitizedHtml'; import { LabelValueMetadata } from './LabelValueMetadata'; @@ -9,8 +10,9 @@ import { PluginHook } from './PluginHook'; * ManifestInfo */ export function ManifestInfo({ - manifestDescription = null, manifestLabel = null, manifestMetadata = [], manifestSummary = null, id, t = k => k, + manifestDescription = null, manifestLabel = null, manifestMetadata = [], manifestSummary = null, id, }) { + const { t } = useTranslation(); const pluginProps = { id, manifestDescription, manifestLabel, manifestMetadata, manifestSummary, }; @@ -58,5 +60,4 @@ ManifestInfo.propTypes = { manifestLabel: PropTypes.string, manifestMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types manifestSummary: PropTypes.string, - t: PropTypes.func, }; diff --git a/src/components/ManifestListItem.js b/src/components/ManifestListItem.js index 6e4c700f7c..b1dccf274b 100644 --- a/src/components/ManifestListItem.js +++ b/src/components/ManifestListItem.js @@ -6,6 +6,7 @@ import ButtonBase from '@mui/material/ButtonBase'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import Skeleton from '@mui/material/Skeleton'; +import { useTranslation } from 'react-i18next'; import { Img } from 'react-image'; import ManifestListItemError from '../containers/ManifestListItemError'; import ns from '../config/css-ns'; @@ -75,11 +76,11 @@ export function ManifestListItem({ manifestLogo = null, size = 0, provider = null, - t = k => k, error = null, isCollection = false, isMultipart = false, }) { + const { t } = useTranslation(); useEffect(() => { if (!ready && !error && !isFetching && provider !== 'file') fetchManifest(manifestId); }, [manifestId, provider, fetchManifest, ready, error, isFetching]); @@ -213,7 +214,6 @@ ManifestListItem.propTypes = { provider: PropTypes.string, ready: PropTypes.bool, size: PropTypes.number, - t: PropTypes.func, thumbnail: PropTypes.string, title: PropTypes.string, }; diff --git a/src/components/ManifestListItemError.js b/src/components/ManifestListItemError.js index e648240c90..98bfd53e29 100644 --- a/src/components/ManifestListItemError.js +++ b/src/components/ManifestListItemError.js @@ -3,14 +3,16 @@ import Button from '@mui/material/Button'; import ErrorIcon from '@mui/icons-material/ErrorOutlineSharp'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; /** * ManifestListItemError renders a component displaying a * message to the user about a problem loading a manifest */ export function ManifestListItemError({ - manifestId, onDismissClick, onTryAgainClick, t, + manifestId, onDismissClick, onTryAgainClick, }) { + const { t } = useTranslation(); return ( @@ -52,5 +54,4 @@ ManifestListItemError.propTypes = { manifestId: PropTypes.string.isRequired, onDismissClick: PropTypes.func.isRequired, onTryAgainClick: PropTypes.func.isRequired, - t: PropTypes.func.isRequired, }; diff --git a/src/components/ManifestRelatedLinks.js b/src/components/ManifestRelatedLinks.js index e21c673a9f..2752317f64 100644 --- a/src/components/ManifestRelatedLinks.js +++ b/src/components/ManifestRelatedLinks.js @@ -3,6 +3,7 @@ import { styled } from '@mui/material/styles'; import Typography from '@mui/material/Typography'; import Link from '@mui/material/Link'; import classNames from 'classnames'; +import { useTranslation } from 'react-i18next'; import CollapsibleSection from '../containers/CollapsibleSection'; import ns from '../config/css-ns'; import { PluginHook } from './PluginHook'; @@ -24,8 +25,8 @@ export function ManifestRelatedLinks({ related = null, renderings = null, seeAlso = null, - t = k => k, }) { + const { t } = useTranslation(); const pluginProps = { homepage, id, manifestUrl, related, renderings, seeAlso, t, }; @@ -143,5 +144,4 @@ ManifestRelatedLinks.propTypes = { label: PropTypes.string, value: PropTypes.string, })), - t: PropTypes.func, }; diff --git a/src/components/MinimalWindow.js b/src/components/MinimalWindow.js index ec6fa62e96..f4a2742f82 100644 --- a/src/components/MinimalWindow.js +++ b/src/components/MinimalWindow.js @@ -7,6 +7,7 @@ import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import CloseIcon from '@mui/icons-material/CloseSharp'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import ns from '../config/css-ns'; @@ -22,9 +23,9 @@ export function MinimalWindow({ children = null, label = '', removeWindow = () => {}, - t = k => k, windowId, }) { + const { t } = useTranslation(); return ( k, title = '', windowId, }) { + const { t } = useTranslation(); return ( {}, selected = false, - showDetails = () => {}, t = k => k, total = undefined, windowId, windowSelected = false, + showDetails = () => {}, total = undefined, windowId, windowSelected = false, }) { + const { t } = useTranslation(); useEffect(() => { if (selected) { announceHit(); @@ -194,7 +196,6 @@ SearchHit.propTypes = { selectAnnotation: PropTypes.func, selected: PropTypes.bool, showDetails: PropTypes.func, - t: PropTypes.func, total: PropTypes.number, windowId: PropTypes.string.isRequired, // eslint-disable-line react/no-unused-prop-types windowSelected: PropTypes.bool, diff --git a/src/components/SearchPanel.js b/src/components/SearchPanel.js index d2af7f4d26..8ea3775f47 100644 --- a/src/components/SearchPanel.js +++ b/src/components/SearchPanel.js @@ -3,14 +3,16 @@ import PropTypes from 'prop-types'; import Button from '@mui/material/Button'; import Chip from '@mui/material/Chip'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; import CompanionWindow from '../containers/CompanionWindow'; import SearchPanelControls from '../containers/SearchPanelControls'; import SearchResults from '../containers/SearchResults'; /** */ export function SearchPanel({ - fetchSearch = undefined, id, query = '', removeSearch, searchService, suggestedSearches = [], t = k => k, windowId, + fetchSearch = undefined, id, query = '', removeSearch, searchService, suggestedSearches = [], windowId, }) { + const { t } = useTranslation(); const containerRef = useRef(null); return ( @@ -72,6 +74,5 @@ SearchPanel.propTypes = { id: PropTypes.string, }).isRequired, suggestedSearches: PropTypes.arrayOf(PropTypes.string), - t: PropTypes.func, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/SearchPanelControls.js b/src/components/SearchPanelControls.js index 7144292a5c..6c1e0d777c 100644 --- a/src/components/SearchPanelControls.js +++ b/src/components/SearchPanelControls.js @@ -9,6 +9,7 @@ import CircularProgress from '@mui/material/CircularProgress'; import TextField from '@mui/material/TextField'; import InputAdornment from '@mui/material/InputAdornment'; import SearchIcon from '@mui/icons-material/SearchSharp'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import SearchPanelNavigation from '../containers/SearchPanelNavigation'; @@ -25,8 +26,9 @@ const getMatch = (option) => (isObject(option) ? option.match : option); /** */ export function SearchPanelControls({ autocompleteService = undefined, companionWindowId, fetchSearch, query = '', - searchIsFetching, searchService, t = k => k, windowId, + searchIsFetching, searchService, windowId, }) { + const { t } = useTranslation(); const [input, setInput] = useState(query); const [search, setSearch] = useState(query); const [suggestions, setSuggestions] = useState([]); @@ -159,6 +161,5 @@ SearchPanelControls.propTypes = { searchService: PropTypes.shape({ id: PropTypes.string, }).isRequired, - t: PropTypes.func, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/SearchPanelNavigation.js b/src/components/SearchPanelNavigation.js index 120bd01648..dda62b236e 100644 --- a/src/components/SearchPanelNavigation.js +++ b/src/components/SearchPanelNavigation.js @@ -2,14 +2,16 @@ import PropTypes from 'prop-types'; import ChevronLeftIcon from '@mui/icons-material/ChevronLeftSharp'; import ChevronRightIcon from '@mui/icons-material/ChevronRightSharp'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; /** * SearchPanelNavigation ~ */ export function SearchPanelNavigation({ - numTotal = undefined, searchHits = [], selectedContentSearchAnnotation, t = k => k, direction, selectAnnotation, + numTotal = undefined, searchHits = [], selectedContentSearchAnnotation, direction, selectAnnotation, }) { + const { t } = useTranslation(); /** */ const nextSearchResult = (currentHitIndex) => { selectAnnotation(searchHits[currentHitIndex + 1].annotations[0]); @@ -77,6 +79,5 @@ SearchPanelNavigation.propTypes = { }).isRequired, selectAnnotation: PropTypes.func.isRequired, selectedContentSearchAnnotation: PropTypes.arrayOf(PropTypes.string).isRequired, - t: PropTypes.func, windowId: PropTypes.string.isRequired, // eslint-disable-line react/no-unused-prop-types }; diff --git a/src/components/SearchResults.js b/src/components/SearchResults.js index 5666acd5eb..ec2b903447 100644 --- a/src/components/SearchResults.js +++ b/src/components/SearchResults.js @@ -5,6 +5,7 @@ import List from '@mui/material/List'; import Typography from '@mui/material/Typography'; import BackIcon from '@mui/icons-material/ArrowBackSharp'; import { announce } from '@react-aria/live-announcer'; +import { useTranslation } from 'react-i18next'; import SearchHit from '../containers/SearchHit'; import { ScrollTo } from './ScrollTo'; @@ -65,9 +66,9 @@ export function SearchResults({ searchAnnotations = [], searchHits = [], searchNumTotal = undefined, - t = k => k, windowId, }) { + const { t } = useTranslation(); const [focused, setFocused] = useState(false); /** */ @@ -137,6 +138,5 @@ SearchResults.propTypes = { searchAnnotations: PropTypes.arrayOf(PropTypes.object), // eslint-disable-line react/forbid-prop-types searchHits: PropTypes.arrayOf(PropTypes.object), // eslint-disable-line react/forbid-prop-types searchNumTotal: PropTypes.number, - t: PropTypes.func, windowId: PropTypes.string.isRequired, // eslint-disable-line react/no-unused-prop-types }; diff --git a/src/components/SelectCollection.js b/src/components/SelectCollection.js index f8cbc92ce7..f320e62a43 100644 --- a/src/components/SelectCollection.js +++ b/src/components/SelectCollection.js @@ -4,13 +4,15 @@ import Button from '@mui/material/Button'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import ListSharpIcon from '@mui/icons-material/ListSharp'; +import { useTranslation } from 'react-i18next'; /** * */ export function SelectCollection({ - collectionPath = [], manifestId = null, showCollectionDialog, t = k => k, windowId = null, + collectionPath = [], manifestId = null, showCollectionDialog, windowId = null, }) { + const { t } = useTranslation(); const openCollectionDialog = useCallback(() => { showCollectionDialog(manifestId, collectionPath.slice(0, -1), windowId); }, [collectionPath, manifestId, showCollectionDialog, windowId]); @@ -41,6 +43,5 @@ SelectCollection.propTypes = { collectionPath: PropTypes.arrayOf(PropTypes.string), manifestId: PropTypes.string, showCollectionDialog: PropTypes.func.isRequired, - t: PropTypes.func, windowId: PropTypes.string, }; diff --git a/src/components/ThumbnailNavigation.js b/src/components/ThumbnailNavigation.js index 07a25c9a19..5da9a0d446 100644 --- a/src/components/ThumbnailNavigation.js +++ b/src/components/ThumbnailNavigation.js @@ -4,6 +4,7 @@ import Paper from '@mui/material/Paper'; import AutoSizer from 'react-virtualized-auto-sizer'; import { VariableSizeList as List } from 'react-window'; import classNames from 'classnames'; +import { useTranslation } from 'react-i18next'; import CanvasWorld from '../lib/CanvasWorld'; import ThumbnailCanvasGrouping from '../containers/ThumbnailCanvasGrouping'; import ns from '../config/css-ns'; @@ -11,8 +12,9 @@ import ns from '../config/css-ns'; */ export function ThumbnailNavigation({ canvasGroupings, canvasIndex, hasNextCanvas = false, hasPreviousCanvas = false, position, - setNextCanvas = () => {}, setPreviousCanvas = () => {}, t, thumbnailNavigation, view = undefined, viewingDirection = '', windowId, + setNextCanvas = () => {}, setPreviousCanvas = () => {}, thumbnailNavigation, view = undefined, viewingDirection = '', windowId, }) { + const { t } = useTranslation(); const scrollbarSize = 15; const spacing = 8; // 2 * (2px margin + 2px border + 2px padding + 2px padding) const gridRef = useRef(); @@ -197,7 +199,6 @@ ThumbnailNavigation.propTypes = { position: PropTypes.string.isRequired, setNextCanvas: PropTypes.func, setPreviousCanvas: PropTypes.func, - t: PropTypes.func.isRequired, thumbnailNavigation: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types view: PropTypes.string, viewingDirection: PropTypes.string, diff --git a/src/components/ViewerInfo.js b/src/components/ViewerInfo.js index 968ae9c7a8..33de8cc242 100644 --- a/src/components/ViewerInfo.js +++ b/src/components/ViewerInfo.js @@ -2,6 +2,7 @@ import Typography from '@mui/material/Typography'; import PropTypes from 'prop-types'; import { styled } from '@mui/material/styles'; import classNames from 'classnames'; +import { useTranslation } from 'react-i18next'; import ns from '../config/css-ns'; const StyledOsdInfo = styled('div')(() => ({ @@ -20,8 +21,8 @@ export function ViewerInfo({ canvasCount, canvasIndex, canvasLabel = undefined, - t = k => k, }) { + const { t } = useTranslation(); return ( @@ -38,5 +39,4 @@ ViewerInfo.propTypes = { canvasCount: PropTypes.number.isRequired, canvasIndex: PropTypes.number.isRequired, canvasLabel: PropTypes.string, - t: PropTypes.func, }; diff --git a/src/components/ViewerNavigation.js b/src/components/ViewerNavigation.js index f142dc8f0b..588a20506e 100644 --- a/src/components/ViewerNavigation.js +++ b/src/components/ViewerNavigation.js @@ -1,6 +1,7 @@ import NavigationIcon from '@mui/icons-material/PlayCircleOutlineSharp'; import PropTypes from 'prop-types'; import classNames from 'classnames'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import ns from '../config/css-ns'; @@ -8,9 +9,10 @@ import ns from '../config/css-ns'; */ export function ViewerNavigation({ hasNextCanvas = false, hasPreviousCanvas = false, - setNextCanvas = () => {}, setPreviousCanvas = () => {}, t, + setNextCanvas = () => {}, setPreviousCanvas = () => {}, viewingDirection = '', }) { + const { t } = useTranslation(); let htmlDir = 'ltr'; let previousIconStyle = {}; let nextIconStyle = {}; @@ -63,6 +65,5 @@ ViewerNavigation.propTypes = { hasPreviousCanvas: PropTypes.bool, setNextCanvas: PropTypes.func, setPreviousCanvas: PropTypes.func, - t: PropTypes.func.isRequired, viewingDirection: PropTypes.string, }; diff --git a/src/components/Window.js b/src/components/Window.js index 20eb4a1f72..be550d4427 100644 --- a/src/components/Window.js +++ b/src/components/Window.js @@ -4,6 +4,7 @@ import { styled } from '@mui/material/styles'; import Paper from '@mui/material/Paper'; import { MosaicWindowContext } from 'react-mosaic-component/lib/contextTypes'; import { ErrorBoundary } from 'react-error-boundary'; +import { useTranslation } from 'react-i18next'; import ns from '../config/css-ns'; import WindowTopBar from '../containers/WindowTopBar'; import PrimaryWindow from '../containers/PrimaryWindow'; @@ -81,9 +82,10 @@ const DraggableNavBar = ({ children, ...props }) => { */ export function Window({ focusWindow = () => {}, label = null, isFetching = false, sideBarOpen = false, - view = undefined, windowDraggable = null, windowId, workspaceType = null, t, + view = undefined, windowDraggable = null, windowId, workspaceType = null, manifestError = null, }) { + const { t } = useTranslation(); const ownerState = arguments[0]; // eslint-disable-line prefer-rest-params const ErrorWindow = useCallback(({ error }) => ( @@ -138,7 +140,6 @@ Window.propTypes = { manifestError: PropTypes.string, maximized: PropTypes.bool, sideBarOpen: PropTypes.bool, - t: PropTypes.func.isRequired, view: PropTypes.string, windowDraggable: PropTypes.bool, windowId: PropTypes.string.isRequired, diff --git a/src/components/WindowAuthenticationBar.js b/src/components/WindowAuthenticationBar.js index 83881ee6a7..4b952f501d 100644 --- a/src/components/WindowAuthenticationBar.js +++ b/src/components/WindowAuthenticationBar.js @@ -7,6 +7,7 @@ import Collapse from '@mui/material/Collapse'; import DialogActions from '@mui/material/DialogActions'; import Typography from '@mui/material/Typography'; import LockIcon from '@mui/icons-material/LockSharp'; +import { useTranslation } from 'react-i18next'; import SanitizedHtml from '../containers/SanitizedHtml'; import { PluginHook } from './PluginHook'; @@ -25,9 +26,10 @@ const StyledFauxButton = styled('span')(({ theme }) => ({ /** */ export function WindowAuthenticationBar({ confirmButton = undefined, continueLabel = undefined, - header = undefined, description = undefined, icon = undefined, label, t = k => k, + header = undefined, description = undefined, icon = undefined, label, ruleSet = 'iiif', hasLogoutService = true, status = undefined, ConfirmProps = {}, onConfirm, }) { + const { t } = useTranslation(); const pluginProps = arguments[0]; // eslint-disable-line prefer-rest-params const [open, setOpen] = useState(false); @@ -152,5 +154,4 @@ WindowAuthenticationBar.propTypes = { onConfirm: PropTypes.func.isRequired, ruleSet: PropTypes.string, status: PropTypes.string, - t: PropTypes.func, }; diff --git a/src/components/WindowList.js b/src/components/WindowList.js index e89ad1a4d4..59e749eec1 100644 --- a/src/components/WindowList.js +++ b/src/components/WindowList.js @@ -4,14 +4,16 @@ import MenuItem from '@mui/material/MenuItem'; import ListItemText from '@mui/material/ListItemText'; import ListSubheader from '@mui/material/ListSubheader'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import WorkspaceContext from '../contexts/WorkspaceContext'; /** */ export function WindowList({ handleClose, windowIds, focusWindow, focusedWindowId = null, - t = key => key, titles = {}, tReady = false, ...menuProps + titles = {}, tReady = false, ...menuProps }) { + const { t } = useTranslation(); const container = useContext(WorkspaceContext); return ( ({ @@ -18,8 +19,9 @@ const Nav = styled('nav', { name: 'WindowSideBar', slot: 'nav' })({ * WindowSideBar */ export function WindowSideBar({ - classes = {}, direction, t, windowId, sideBarOpen = false, + classes = {}, direction, windowId, sideBarOpen = false, }) { + const { t } = useTranslation(); return ( k, windowId, id, + annotationCount, canvasIds = [], windowId, id, }) { + const { t } = useTranslation(); const containerRef = createRef(); return ( k, }) { + const { t } = useTranslation(); /** */ const handleChange = (event, value) => { addCompanionWindow(value); }; @@ -105,28 +106,24 @@ export function WindowSideBarButtons({ { panels.info && ( )} /> )} { panels.attribution && ( )} /> )} { panels.canvas && ( )} /> )} {panels.annotations && (hasAnnotations || hasAnyAnnotations) && ( @@ -137,7 +134,6 @@ export function WindowSideBarButtons({ {panels.search && hasSearchService && ( @@ -148,7 +144,6 @@ export function WindowSideBarButtons({ { panels.layers && hasAnyLayers && ( @@ -159,7 +154,6 @@ export function WindowSideBarButtons({ { PluginComponents && PluginComponents.map(PluginComponent => ( } @@ -180,5 +174,4 @@ WindowSideBarButtons.propTypes = { panels: PropTypes.arrayOf(PropTypes.bool), PluginComponents: PropTypes.array, // eslint-disable-line react/forbid-prop-types sideBarPanel: PropTypes.string, - t: PropTypes.func, }; diff --git a/src/components/WindowSideBarCanvasPanel.js b/src/components/WindowSideBarCanvasPanel.js index 7c30c5a8a9..59953f2275 100644 --- a/src/components/WindowSideBarCanvasPanel.js +++ b/src/components/WindowSideBarCanvasPanel.js @@ -13,6 +13,7 @@ import ArrowForwardIcon from '@mui/icons-material/ArrowForwardSharp'; import FormControl from '@mui/material/FormControl'; import Select from '@mui/material/Select'; import MenuItem from '@mui/material/MenuItem'; +import { useTranslation } from 'react-i18next'; import CompanionWindow from '../containers/CompanionWindow'; import SidebarIndexList from '../containers/SidebarIndexList'; import SidebarIndexTableOfContents from '../containers/SidebarIndexTableOfContents'; @@ -40,13 +41,13 @@ export function WindowSideBarCanvasPanel({ showMultipart, sequenceId = null, sequences = [], - t, variant, showToc = false, updateSequence, updateVariant, windowId, }) { + const { t } = useTranslation(); const containerRef = useRef(); /** */ @@ -158,7 +159,6 @@ WindowSideBarCanvasPanel.propTypes = { sequences: PropTypes.arrayOf(PropTypes.object), // eslint-disable-line react/forbid-prop-types showMultipart: PropTypes.func.isRequired, showToc: PropTypes.bool, - t: PropTypes.func.isRequired, updateSequence: PropTypes.func.isRequired, updateVariant: PropTypes.func.isRequired, variant: PropTypes.oneOf(['item', 'thumbnail', 'tableOfContents']).isRequired, diff --git a/src/components/WindowSideBarCollectionPanel.js b/src/components/WindowSideBarCollectionPanel.js index b0ee4ba8c9..6f71e38ab5 100644 --- a/src/components/WindowSideBarCollectionPanel.js +++ b/src/components/WindowSideBarCollectionPanel.js @@ -8,6 +8,7 @@ import MenuItem from '@mui/material/MenuItem'; import Typography from '@mui/material/Typography'; import Skeleton from '@mui/material/Skeleton'; import ArrowUpwardIcon from '@mui/icons-material/ArrowUpwardSharp'; +import { useTranslation } from 'react-i18next'; import CompanionWindow from '../containers/CompanionWindow'; import IIIFThumbnail from '../containers/IIIFThumbnail'; @@ -70,10 +71,10 @@ export function WindowSideBarCollectionPanel({ parentCollection = null, updateCompanionWindow, updateWindow, - t = k => k, variant = null, windowId, }) { + const { t } = useTranslation(); /** */ const isMultipart = (() => { if (!collection) return false; @@ -184,7 +185,6 @@ WindowSideBarCollectionPanel.propTypes = { isFetching: PropTypes.bool, manifestId: PropTypes.string.isRequired, parentCollection: PropTypes.object, // eslint-disable-line react/forbid-prop-types - t: PropTypes.func, updateCompanionWindow: PropTypes.func.isRequired, updateWindow: PropTypes.func.isRequired, variant: PropTypes.string, diff --git a/src/components/WindowSideBarInfoPanel.js b/src/components/WindowSideBarInfoPanel.js index efb951a207..fc367a7c7f 100644 --- a/src/components/WindowSideBarInfoPanel.js +++ b/src/components/WindowSideBarInfoPanel.js @@ -1,4 +1,5 @@ import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import CompanionWindow from '../containers/CompanionWindow'; import { CompanionWindowSection } from './CompanionWindowSection'; import CanvasInfo from '../containers/CanvasInfo'; @@ -16,12 +17,12 @@ export function WindowSideBarInfoPanel({ id, canvasIds = [], collectionPath = [], - t = k => k, locale = '', setLocale = undefined, availableLocales = [], showLocalePicker = false, }) { + const { t } = useTranslation(); return ( {}, t = k => k, thumbnailNavigationPosition, direction, windowId, setWindowThumbnailPosition, + handleClose = () => {}, thumbnailNavigationPosition, direction, windowId, setWindowThumbnailPosition, }) { + const { t } = useTranslation(); /** */ const handleChange = (value) => { setWindowThumbnailPosition(windowId, value); handleClose(); }; @@ -82,7 +84,6 @@ WindowThumbnailSettings.propTypes = { direction: PropTypes.string.isRequired, handleClose: PropTypes.func, setWindowThumbnailPosition: PropTypes.func.isRequired, - t: PropTypes.func, thumbnailNavigationPosition: PropTypes.string.isRequired, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/WindowTopBar.js b/src/components/WindowTopBar.js index 694a0e8ff4..fe3d7bf978 100644 --- a/src/components/WindowTopBar.js +++ b/src/components/WindowTopBar.js @@ -4,6 +4,7 @@ import MenuIcon from '@mui/icons-material/MenuSharp'; import CloseIcon from '@mui/icons-material/CloseSharp'; import Toolbar from '@mui/material/Toolbar'; import AppBar from '@mui/material/AppBar'; +import { useTranslation } from 'react-i18next'; import classNames from 'classnames'; import WindowTopMenuButton from '../containers/WindowTopMenuButton'; import WindowTopBarPluginArea from '../containers/WindowTopBarPluginArea'; @@ -35,11 +36,12 @@ const StyledToolbar = styled(Toolbar, { name: 'WindowTopBar', slot: 'toolbar' }) * WindowTopBar */ export function WindowTopBar({ - removeWindow, windowId, toggleWindowSideBar, t = k => k, + removeWindow, windowId, toggleWindowSideBar, maximizeWindow = () => {}, maximized = false, minimizeWindow = () => {}, allowClose = true, allowMaximize = true, focusWindow = () => {}, allowFullscreen = false, allowTopMenuButton = true, allowWindowSideBar = true, component = 'nav', }) { + const { t } = useTranslation(); const ownerState = arguments[0]; // eslint-disable-line prefer-rest-params return ( @@ -107,7 +109,6 @@ WindowTopBar.propTypes = { maximizeWindow: PropTypes.func, minimizeWindow: PropTypes.func, removeWindow: PropTypes.func.isRequired, - t: PropTypes.func, toggleWindowSideBar: PropTypes.func.isRequired, windowDraggable: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types windowId: PropTypes.string.isRequired, diff --git a/src/components/WindowTopBarPluginMenu.js b/src/components/WindowTopBarPluginMenu.js index c1b8c98738..421292f2a4 100644 --- a/src/components/WindowTopBarPluginMenu.js +++ b/src/components/WindowTopBarPluginMenu.js @@ -2,6 +2,7 @@ import { useContext, useState } from 'react'; import PropTypes from 'prop-types'; import MoreVertIcon from '@mui/icons-material/MoreVertSharp'; import Menu from '@mui/material/Menu'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import { PluginHook } from './PluginHook'; import WorkspaceContext from '../contexts/WorkspaceContext'; @@ -10,8 +11,9 @@ import WorkspaceContext from '../contexts/WorkspaceContext'; * */ export function WindowTopBarPluginMenu({ - PluginComponents = [], t, windowId, menuIcon = , + PluginComponents = [], windowId, menuIcon = , }) { + const { t } = useTranslation(); const container = useContext(WorkspaceContext); const pluginProps = arguments[0]; // eslint-disable-line prefer-rest-params const [anchorEl, setAnchorEl] = useState(null); @@ -73,6 +75,5 @@ WindowTopBarPluginMenu.propTypes = { PluginComponents: PropTypes.arrayOf( PropTypes.node, ), - t: PropTypes.func.isRequired, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/WindowTopMenuButton.js b/src/components/WindowTopMenuButton.js index f4234e7f91..75a70a5f39 100644 --- a/src/components/WindowTopMenuButton.js +++ b/src/components/WindowTopMenuButton.js @@ -1,12 +1,14 @@ import { useState } from 'react'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import WindowTopMenu from '../containers/WindowTopMenu'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import WindowOptionsIcon from './icons/WindowOptionsIcon'; /** */ -export function WindowTopMenuButton({ classes = {}, t = k => k, windowId }) { +export function WindowTopMenuButton({ classes = {}, windowId }) { + const { t } = useTranslation(); const [anchorEl, setAnchorEl] = useState(null); const [open, setOpen] = useState(false); @@ -48,6 +50,5 @@ export function WindowTopMenuButton({ classes = {}, t = k => k, windowId }) { WindowTopMenuButton.propTypes = { classes: PropTypes.objectOf(PropTypes.string), - t: PropTypes.func, windowId: PropTypes.string.isRequired, }; diff --git a/src/components/WindowViewSettings.js b/src/components/WindowViewSettings.js index 10663f064c..76a0f480c4 100644 --- a/src/components/WindowViewSettings.js +++ b/src/components/WindowViewSettings.js @@ -5,6 +5,7 @@ import ListSubheader from '@mui/material/ListSubheader'; import SingleIcon from '@mui/icons-material/CropOriginalSharp'; import ScrollViewIcon from '@mui/icons-material/ViewColumn'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import BookViewIcon from './icons/BookViewIcon'; import GalleryViewIcon from './icons/GalleryViewIcon'; @@ -32,8 +33,9 @@ const ViewOption = styled(MenuItem, { name: 'WindowViewSettings', slot: 'option' * */ export function WindowViewSettings({ - handleClose = () => {}, t = k => k, windowViewType, viewTypes = [], setWindowViewType, windowId, + handleClose = () => {}, windowViewType, viewTypes = [], setWindowViewType, windowId, }) { + const { t } = useTranslation(); /** */ const handleChange = (value) => { setWindowViewType(windowId, value); @@ -76,7 +78,6 @@ export function WindowViewSettings({ WindowViewSettings.propTypes = { handleClose: PropTypes.func, setWindowViewType: PropTypes.func.isRequired, - t: PropTypes.func, viewTypes: PropTypes.arrayOf(PropTypes.string), windowId: PropTypes.string.isRequired, windowViewType: PropTypes.string.isRequired, diff --git a/src/components/Workspace.js b/src/components/Workspace.js index ba690e20ce..aac5a4f3ef 100644 --- a/src/components/Workspace.js +++ b/src/components/Workspace.js @@ -4,6 +4,7 @@ import classNames from 'classnames'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import { visuallyHidden } from '@mui/utils'; +import { useTranslation } from 'react-i18next'; import Window from '../containers/Window'; import WorkspaceMosaic from '../containers/WorkspaceMosaic'; import WorkspaceElastic from '../containers/WorkspaceElastic'; @@ -17,33 +18,36 @@ const Root = styled('div', { name: 'Workspace', slot: 'root' })(() => ({ })); /** */ -const ZeroWindows = ({ t }) => ( - - +const ZeroWindows = () => { + const { t } = useTranslation(); + + return ( + - - {t('welcome')} - + + {t('welcome')} + + - - -); + + ); +}; ZeroWindows.propTypes = { - t: PropTypes.func.isRequired, }; /** @@ -52,8 +56,9 @@ ZeroWindows.propTypes = { * @private */ export function Workspace({ - addWindow = () => {}, allowNewWindows = true, maximizedWindowIds = [], t, windowIds = [], workspaceId, workspaceType, + addWindow = () => {}, allowNewWindows = true, maximizedWindowIds = [], windowIds = [], workspaceId, workspaceType, }) { + const { t } = useTranslation(); /** */ const handleDrop = ({ canvasId, manifestId, manifestJson }, _props, _monitor) => { if (!allowNewWindows) return; @@ -77,7 +82,7 @@ export function Workspace({ } } - if (windowIds.length === 0) return ; + if (windowIds.length === 0) return ; switch (workspaceType) { case 'elastic': @@ -119,7 +124,6 @@ Workspace.propTypes = { addWindow: PropTypes.func, allowNewWindows: PropTypes.bool, maximizedWindowIds: PropTypes.arrayOf(PropTypes.string), - t: PropTypes.func.isRequired, windowIds: PropTypes.arrayOf(PropTypes.string), workspaceId: PropTypes.string.isRequired, workspaceType: PropTypes.string.isRequired, diff --git a/src/components/WorkspaceAdd.js b/src/components/WorkspaceAdd.js index 6e3881607c..ec1085b641 100644 --- a/src/components/WorkspaceAdd.js +++ b/src/components/WorkspaceAdd.js @@ -13,6 +13,7 @@ import Paper from '@mui/material/Paper'; import Toolbar from '@mui/material/Toolbar'; import Typography from '@mui/material/Typography'; import { visuallyHidden } from '@mui/utils'; +import { useTranslation } from 'react-i18next'; import ns from '../config/css-ns'; import ManifestForm from '../containers/ManifestForm'; import ManifestListItem from '../containers/ManifestListItem'; @@ -38,8 +39,9 @@ const StyledMiradorMenuButton = styled(MiradorMenuButton)(() => ({ * @private */ export function WorkspaceAdd({ - addResource = () => {}, catalog = [], setWorkspaceAddVisibility, t = k => k, + addResource = () => {}, catalog = [], setWorkspaceAddVisibility, }) { + const { t } = useTranslation(); const [addResourcesOpen, setAddResourcesVisibility] = useState(false); const ref = useRef(); @@ -196,5 +198,4 @@ WorkspaceAdd.propTypes = { provider: PropTypes.string, })), setWorkspaceAddVisibility: PropTypes.func.isRequired, - t: PropTypes.func, }; diff --git a/src/components/WorkspaceAddButton.js b/src/components/WorkspaceAddButton.js index ca21719e66..a631d5d0da 100644 --- a/src/components/WorkspaceAddButton.js +++ b/src/components/WorkspaceAddButton.js @@ -5,6 +5,7 @@ import AddIcon from '@mui/icons-material/AddSharp'; import CloseIcon from '@mui/icons-material/CloseSharp'; import { styled, useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; +import { useTranslation } from 'react-i18next'; /** * Be careful using this hook. It only works because the number of @@ -30,9 +31,10 @@ const Root = styled(Fab, { name: 'WorkspaceAddButton', slot: 'root' })(({ theme /** */ export function WorkspaceAddButton({ - t = k => k, setWorkspaceAddVisibility, isWorkspaceAddVisible = false, useExtendedFab, + setWorkspaceAddVisibility, isWorkspaceAddVisible = false, useExtendedFab, }) { const width = useWidth(); + const { t } = useTranslation(); return ( @@ -62,6 +64,5 @@ export function WorkspaceAddButton({ WorkspaceAddButton.propTypes = { isWorkspaceAddVisible: PropTypes.bool, setWorkspaceAddVisibility: PropTypes.func.isRequired, - t: PropTypes.func, useExtendedFab: PropTypes.bool.isRequired, }; diff --git a/src/components/WorkspaceArea.js b/src/components/WorkspaceArea.js index 81a499b132..56beee959f 100644 --- a/src/components/WorkspaceArea.js +++ b/src/components/WorkspaceArea.js @@ -1,5 +1,6 @@ import PropTypes from 'prop-types'; import { styled, lighten, darken } from '@mui/material/styles'; +import { useTranslation } from 'react-i18next'; import ErrorDialog from '../containers/ErrorDialog'; import WorkspaceControlPanel from '../containers/WorkspaceControlPanel'; import Workspace from '../containers/Workspace'; @@ -40,8 +41,8 @@ export function WorkspaceArea({ isWorkspaceAddVisible = false, isWorkspaceControlPanelVisible, lang = undefined, - t, }) { + const { t } = useTranslation(); const ownerState = arguments[0]; // eslint-disable-line prefer-rest-params return ( @@ -74,5 +75,4 @@ WorkspaceArea.propTypes = { isWorkspaceAddVisible: PropTypes.bool, isWorkspaceControlPanelVisible: PropTypes.bool.isRequired, lang: PropTypes.string, - t: PropTypes.func.isRequired, }; diff --git a/src/components/WorkspaceControlPanel.js b/src/components/WorkspaceControlPanel.js index cd6d76225f..05571707d1 100644 --- a/src/components/WorkspaceControlPanel.js +++ b/src/components/WorkspaceControlPanel.js @@ -3,6 +3,7 @@ import { styled } from '@mui/material/styles'; import classNames from 'classnames'; import AppBar from '@mui/material/AppBar'; import Toolbar from '@mui/material/Toolbar'; +import { useTranslation } from 'react-i18next'; import WorkspaceAddButton from '../containers/WorkspaceAddButton'; import WorkspaceControlPanelButtons from '../containers/WorkspaceControlPanelButtons'; import Branding from '../containers/Branding'; @@ -56,7 +57,8 @@ const StyledBranding = styled(Branding, { name: 'WorkspaceControlPanel', slot: ' /** * Provides the panel responsible for controlling the entire workspace */ -export function WorkspaceControlPanel({ t, variant = 'default', ...rest }) { +export function WorkspaceControlPanel({ variant = 'default', ...rest }) { + const { t } = useTranslation(); return ( - + ); } WorkspaceControlPanel.propTypes = { - t: PropTypes.func.isRequired, variant: PropTypes.oneOf(['default', 'wide']), }; diff --git a/src/components/WorkspaceExport.js b/src/components/WorkspaceExport.js index 339b0d98a5..6edf7bc391 100644 --- a/src/components/WorkspaceExport.js +++ b/src/components/WorkspaceExport.js @@ -12,14 +12,16 @@ import Accordion from '@mui/material/Accordion'; import AccordionSummary from '@mui/material/AccordionSummary'; import AccordionDetails from '@mui/material/AccordionDetails'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import { CopyToClipboard } from 'react-copy-to-clipboard'; import { WorkspaceDialog } from './WorkspaceDialog'; /** */ export function WorkspaceExport({ - children = null, container = null, open = false, t = k => k, handleClose, exportableState, + children = null, container = null, open = false, handleClose, exportableState, }) { + const { t } = useTranslation(); const [copied, setCopied] = useState(false); const exportedState = JSON.stringify(exportableState, null, 2); @@ -92,5 +94,4 @@ WorkspaceExport.propTypes = { exportableState: PropTypes.object.isRequired, // eslint-disable-line react/forbid-prop-types handleClose: PropTypes.func.isRequired, open: PropTypes.bool, - t: PropTypes.func, }; diff --git a/src/components/WorkspaceImport.js b/src/components/WorkspaceImport.js index ac0d91b044..a553445e9e 100644 --- a/src/components/WorkspaceImport.js +++ b/src/components/WorkspaceImport.js @@ -6,14 +6,16 @@ import { TextField, } from '@mui/material'; import Button from '@mui/material/Button'; +import { useTranslation } from 'react-i18next'; import { WorkspaceDialog } from './WorkspaceDialog'; import ScrollIndicatedDialogContent from '../containers/ScrollIndicatedDialogContent'; /** */ export function WorkspaceImport({ - addError, importConfig, classes = {}, handleClose, open = false, t = k => k, + addError, importConfig, classes = {}, handleClose, open = false, }) { + const { t } = useTranslation(); const [configImportValue, setConfigImportValue] = useState(''); /** */ @@ -79,5 +81,4 @@ WorkspaceImport.propTypes = { handleClose: PropTypes.func.isRequired, importConfig: PropTypes.func.isRequired, open: PropTypes.bool, - t: PropTypes.func, }; diff --git a/src/components/WorkspaceMenu.js b/src/components/WorkspaceMenu.js index 1b3c021ac7..971295d3ef 100644 --- a/src/components/WorkspaceMenu.js +++ b/src/components/WorkspaceMenu.js @@ -3,6 +3,7 @@ import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import Typography from '@mui/material/Typography'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import LanguageSettings from '../containers/LanguageSettings'; import { NestedMenu } from './NestedMenu'; import WorkspaceSelectionDialog from '../containers/WorkspaceSelectionDialog'; @@ -14,8 +15,9 @@ import WorkspaceContext from '../contexts/WorkspaceContext'; */ export function WorkspaceMenu({ handleClose, showThemePicker = false, isWorkspaceAddVisible = false, - t = k => k, tReady = false, toggleZoomControls = () => {}, showZoomControls = false, ...menuProps + tReady = false, toggleZoomControls = () => {}, showZoomControls = false, ...menuProps }) { + const { t } = useTranslation(); const container = useContext(WorkspaceContext); const [selectedOption, setSelectedOption] = useState(null); @@ -108,7 +110,6 @@ WorkspaceMenu.propTypes = { isWorkspaceAddVisible: PropTypes.bool, showThemePicker: PropTypes.bool, showZoomControls: PropTypes.bool, - t: PropTypes.func, toggleZoomControls: PropTypes.func, tReady: PropTypes.bool, }; diff --git a/src/components/WorkspaceMenuButton.js b/src/components/WorkspaceMenuButton.js index 951938e1a4..c26309999e 100644 --- a/src/components/WorkspaceMenuButton.js +++ b/src/components/WorkspaceMenuButton.js @@ -1,12 +1,13 @@ import { useState } from 'react'; import SettingsIcon from '@mui/icons-material/SettingsSharp'; -import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import WorkspaceMenu from '../containers/WorkspaceMenu'; import MiradorMenuButton from '../containers/MiradorMenuButton'; /** */ -export function WorkspaceMenuButton({ t = k => k }) { +export function WorkspaceMenuButton() { + const { t } = useTranslation(); const [anchorEl, setAnchorEl] = useState(null); const [open, setOpen] = useState(false); @@ -43,7 +44,3 @@ export function WorkspaceMenuButton({ t = k => k }) { ); } - -WorkspaceMenuButton.propTypes = { - t: PropTypes.func, -}; diff --git a/src/components/WorkspaceOptionsButton.js b/src/components/WorkspaceOptionsButton.js index 3e9a6f87e4..9d2cf9cc59 100644 --- a/src/components/WorkspaceOptionsButton.js +++ b/src/components/WorkspaceOptionsButton.js @@ -1,13 +1,14 @@ import { useState } from 'react'; -import PropTypes from 'prop-types'; import MoreHorizontalIcon from '@mui/icons-material/MoreHorizSharp'; +import { useTranslation } from 'react-i18next'; import MiradorMenuButton from '../containers/MiradorMenuButton'; import WorkspaceOptionsMenu from '../containers/WorkspaceOptionsMenu'; /** * WorkspaceOptionsButton ~ */ -export function WorkspaceOptionsButton({ t }) { +export function WorkspaceOptionsButton() { + const { t } = useTranslation(); const [anchorEl, setAnchorEl] = useState(null); const [open, setOpen] = useState(false); @@ -40,7 +41,3 @@ export function WorkspaceOptionsButton({ t }) { ); } - -WorkspaceOptionsButton.propTypes = { - t: PropTypes.func.isRequired, -}; diff --git a/src/components/WorkspaceOptionsMenu.js b/src/components/WorkspaceOptionsMenu.js index 974635851f..847da3c791 100644 --- a/src/components/WorkspaceOptionsMenu.js +++ b/src/components/WorkspaceOptionsMenu.js @@ -6,6 +6,7 @@ import ListItemIcon from '@mui/material/ListItemIcon'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; import Typography from '@mui/material/Typography'; +import { useTranslation } from 'react-i18next'; import WorkspaceExport from '../containers/WorkspaceExport'; import WorkspaceImport from '../containers/WorkspaceImport'; import WorkspaceContext from '../contexts/WorkspaceContext'; @@ -15,8 +16,9 @@ import { PluginHook } from './PluginHook'; * WorkspaceOptionsMenu ~ the menu for workspace options such as import/export */ export function WorkspaceOptionsMenu({ - anchorEl = null, handleClose, open = false, t, + anchorEl = null, handleClose, open = false, }) { + const { t } = useTranslation(); const container = useContext(WorkspaceContext); const [selectedOption, setSelectedOption] = useState(null); @@ -97,5 +99,4 @@ WorkspaceOptionsMenu.propTypes = { anchorEl: PropTypes.object, // eslint-disable-line react/forbid-prop-types handleClose: PropTypes.func.isRequired, open: PropTypes.bool, - t: PropTypes.func.isRequired, }; diff --git a/src/components/WorkspaceSelectionDialog.js b/src/components/WorkspaceSelectionDialog.js index 416debd71b..5a163cb19f 100644 --- a/src/components/WorkspaceSelectionDialog.js +++ b/src/components/WorkspaceSelectionDialog.js @@ -8,6 +8,7 @@ import { } from '@mui/material'; import PropTypes from 'prop-types'; import { styled } from '@mui/material/styles'; +import { useTranslation } from 'react-i18next'; import { WorkspaceDialog } from './WorkspaceDialog'; import WorkspaceTypeElasticIcon from './icons/WorkspaceTypeElasticIcon'; import WorkspaceTypeMosaicIcon from './icons/WorkspaceTypeMosaicIcon'; @@ -21,8 +22,9 @@ const StyledDetails = styled('div')(() => ({ /** */ export function WorkspaceSelectionDialog({ - container = null, handleClose, open = false, children = null, t = k => k, updateWorkspace, workspaceType, + container = null, handleClose, open = false, children = null, updateWorkspace, workspaceType, }) { + const { t } = useTranslation(); /** */ const handleWorkspaceTypeChange = (newWorkspaceType) => { updateWorkspace({ @@ -158,7 +160,6 @@ WorkspaceSelectionDialog.propTypes = { container: PropTypes.object, // eslint-disable-line react/forbid-prop-types handleClose: PropTypes.func.isRequired, open: PropTypes.bool, - t: PropTypes.func, updateWorkspace: PropTypes.func.isRequired, workspaceType: PropTypes.string.isRequired, }; diff --git a/src/components/ZoomControls.js b/src/components/ZoomControls.js index e2a667a04c..2647315ae9 100644 --- a/src/components/ZoomControls.js +++ b/src/components/ZoomControls.js @@ -2,6 +2,7 @@ import AddCircleIcon from '@mui/icons-material/AddCircleOutlineSharp'; import RemoveCircleIcon from '@mui/icons-material/RemoveCircleOutlineSharp'; import { styled } from '@mui/material/styles'; import PropTypes from 'prop-types'; +import { useTranslation } from 'react-i18next'; import RestoreZoomIcon from './icons/RestoreZoomIcon'; import MiradorMenuButton from '../containers/MiradorMenuButton'; @@ -14,8 +15,9 @@ const StyledZoomControlsWrapper = styled('div')({ /** */ export function ZoomControls({ - windowId = '', updateViewport = () => {}, viewer = {}, t = k => k, zoomToWorld, + windowId = '', updateViewport = () => {}, viewer = {}, zoomToWorld, }) { + const { t } = useTranslation(); /** */ const handleZoomInClick = () => { updateViewport(windowId, { @@ -46,7 +48,6 @@ export function ZoomControls({ } ZoomControls.propTypes = { - t: PropTypes.func, updateViewport: PropTypes.func, viewer: PropTypes.shape({ x: PropTypes.number, diff --git a/src/containers/AnnotationSettings.js b/src/containers/AnnotationSettings.js index 1c1dd8d0c6..6388b680bf 100644 --- a/src/containers/AnnotationSettings.js +++ b/src/containers/AnnotationSettings.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import * as actions from '../state/actions'; import { withPlugins } from '../extend/withPlugins'; import { @@ -30,7 +29,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('AnnotationSettings'), ); diff --git a/src/containers/AnnotationsOverlay.js b/src/containers/AnnotationsOverlay.js index 8619925686..1199674946 100644 --- a/src/containers/AnnotationsOverlay.js +++ b/src/containers/AnnotationsOverlay.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { AnnotationsOverlay } from '../components/AnnotationsOverlay'; import * as actions from '../state/actions'; @@ -47,7 +46,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('AnnotationsOverlay'), ); diff --git a/src/containers/AttributionPanel.js b/src/containers/AttributionPanel.js index 94ae930e0f..4942c8da64 100644 --- a/src/containers/AttributionPanel.js +++ b/src/containers/AttributionPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { getManifestLogo, getRequiredStatement, @@ -21,7 +20,6 @@ const mapStateToProps = (state, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('AttributionPanel'), ); diff --git a/src/containers/AudioViewer.js b/src/containers/AudioViewer.js index 2bcd274096..ecff307c8e 100644 --- a/src/containers/AudioViewer.js +++ b/src/containers/AudioViewer.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { AudioViewer } from '../components/AudioViewer'; import { getConfig, getVisibleCanvasAudioResources, getVisibleCanvasCaptions } from '../state/selectors'; @@ -15,7 +14,6 @@ const mapStateToProps = (state, { windowId }) => ( ); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('AudioViewer'), ); diff --git a/src/containers/CanvasAnnotations.js b/src/containers/CanvasAnnotations.js index 5d420e745d..697f961949 100644 --- a/src/containers/CanvasAnnotations.js +++ b/src/containers/CanvasAnnotations.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { @@ -49,7 +48,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('CanvasAnnotations'), ); diff --git a/src/containers/CanvasInfo.js b/src/containers/CanvasInfo.js index 8f3c14376f..554af62eb4 100644 --- a/src/containers/CanvasInfo.js +++ b/src/containers/CanvasInfo.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getDestructuredMetadata, @@ -24,7 +23,6 @@ const mapStateToProps = (state, { canvasId, id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('CanvasInfo'), ); diff --git a/src/containers/CanvasLayers.js b/src/containers/CanvasLayers.js index 1b5baf2ffb..eb830966de 100644 --- a/src/containers/CanvasLayers.js +++ b/src/containers/CanvasLayers.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import * as actions from '../state/actions'; import { getCanvasLabel, @@ -26,7 +25,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), ); diff --git a/src/containers/ChangeThemeDialog.js b/src/containers/ChangeThemeDialog.js index a473f22f1b..e89bd48733 100644 --- a/src/containers/ChangeThemeDialog.js +++ b/src/containers/ChangeThemeDialog.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getThemeIds, getConfig } from '../state/selectors'; @@ -26,7 +25,6 @@ const mapStateToProps = state => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('ChangeThemeDialog'), ); diff --git a/src/containers/CollapsibleSection.js b/src/containers/CollapsibleSection.js index 9e32b49c24..aaf4461609 100644 --- a/src/containers/CollapsibleSection.js +++ b/src/containers/CollapsibleSection.js @@ -1,9 +1,3 @@ -import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { CollapsibleSection } from '../components/CollapsibleSection'; -const enhance = compose( - withTranslation(), -); - -export default enhance(CollapsibleSection); +export default CollapsibleSection; diff --git a/src/containers/CollectionDialog.js b/src/containers/CollectionDialog.js index 4da8992d24..abf7693dca 100644 --- a/src/containers/CollectionDialog.js +++ b/src/containers/CollectionDialog.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { @@ -47,7 +46,6 @@ const mapStateToProps = (state, { windowId }) => { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('CollectionDialog'), ); diff --git a/src/containers/CollectionInfo.js b/src/containers/CollectionInfo.js index ca686c0a59..0c17a32323 100644 --- a/src/containers/CollectionInfo.js +++ b/src/containers/CollectionInfo.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getManifestTitle, @@ -29,7 +28,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('CollectionInfo'), ); diff --git a/src/containers/CompanionArea.js b/src/containers/CompanionArea.js index f403a90849..9830c77c3b 100644 --- a/src/containers/CompanionArea.js +++ b/src/containers/CompanionArea.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getCompanionWindowIdsForPosition, getCompanionAreaVisibility, getThemeDirection, getWindow, @@ -21,7 +20,6 @@ const mapDispatchToProps = ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('CompanionArea'), ); diff --git a/src/containers/CompanionWindow.js b/src/containers/CompanionWindow.js index d4a59bd12a..6f04e40bef 100644 --- a/src/containers/CompanionWindow.js +++ b/src/containers/CompanionWindow.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withSize } from '../extend/withSize'; import { withPlugins } from '../extend/withPlugins'; import { withRef } from '../extend/withRef'; @@ -47,7 +46,6 @@ const mapDispatchToProps = (dispatch, { windowId, id }) => ({ const enhance = compose( withSize(), withRef(), - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('CompanionWindow'), ); diff --git a/src/containers/CompanionWindowFactory.js b/src/containers/CompanionWindowFactory.js index c579d3fce3..e67e0f7907 100644 --- a/src/containers/CompanionWindowFactory.js +++ b/src/containers/CompanionWindowFactory.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getCompanionWindow } from '../state/selectors'; import { CompanionWindowFactory } from '../components/CompanionWindowFactory'; @@ -20,7 +19,6 @@ const mapStateToProps = (state, { id }) => { }; const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('CompanionWindowFactory'), ); diff --git a/src/containers/CustomPanel.js b/src/containers/CustomPanel.js index 3f83547018..5ce78ce41b 100644 --- a/src/containers/CustomPanel.js +++ b/src/containers/CustomPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { CustomPanel } from '../components/CustomPanel'; @@ -11,7 +10,6 @@ const mapStateToProps = (state, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('CustomPanel'), ); diff --git a/src/containers/ErrorContent.js b/src/containers/ErrorContent.js index 8544356209..4f4fa76401 100644 --- a/src/containers/ErrorContent.js +++ b/src/containers/ErrorContent.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { ErrorContent } from '../components/ErrorContent'; import { @@ -23,7 +22,6 @@ const mapStateToProps = (state, { companionWindowId, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('ErrorContent'), ); diff --git a/src/containers/ErrorDialog.js b/src/containers/ErrorDialog.js index 9aeaaa578f..ce4e5a2215 100644 --- a/src/containers/ErrorDialog.js +++ b/src/containers/ErrorDialog.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { ErrorDialog } from '../components/ErrorDialog'; import * as actions from '../state/actions'; @@ -25,7 +24,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('ErrorDialog'), ); diff --git a/src/containers/FullScreenButton.js b/src/containers/FullScreenButton.js index 529579d684..956e343296 100644 --- a/src/containers/FullScreenButton.js +++ b/src/containers/FullScreenButton.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { FullScreenButton } from '../components/FullScreenButton'; @@ -19,7 +18,6 @@ const mapStateToProps = _state => ({}); const mapDispatchToProps = {}; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('FullScreenButton'), ); diff --git a/src/containers/IIIFAuthentication.js b/src/containers/IIIFAuthentication.js index 7d51087168..caff30f20c 100644 --- a/src/containers/IIIFAuthentication.js +++ b/src/containers/IIIFAuthentication.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { Utils } from 'manifesto.js'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; @@ -91,7 +90,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('IIIFAuthentication'), ); diff --git a/src/containers/IIIFThumbnail.js b/src/containers/IIIFThumbnail.js index 6631a8deb3..a48f358e5b 100644 --- a/src/containers/IIIFThumbnail.js +++ b/src/containers/IIIFThumbnail.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getConfig, @@ -16,7 +15,6 @@ const mapStateToProps = (state) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('IIIFThumbnail'), ); diff --git a/src/containers/LayersPanel.js b/src/containers/LayersPanel.js index 2d7352f4eb..3f8900be7b 100644 --- a/src/containers/LayersPanel.js +++ b/src/containers/LayersPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { LayersPanel } from '../components/LayersPanel'; import { @@ -15,7 +14,6 @@ const mapStateToProps = (state, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('LayersPanel'), ); diff --git a/src/containers/LocalePicker.js b/src/containers/LocalePicker.js index 2edb53b784..c4b2434361 100644 --- a/src/containers/LocalePicker.js +++ b/src/containers/LocalePicker.js @@ -1,9 +1,3 @@ -import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { LocalePicker } from '../components/LocalePicker'; -const enhance = compose( - withTranslation(), -); - -export default enhance(LocalePicker); +export default LocalePicker; diff --git a/src/containers/ManifestForm.js b/src/containers/ManifestForm.js index 02a3262144..ec28a1a381 100644 --- a/src/containers/ManifestForm.js +++ b/src/containers/ManifestForm.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { ManifestForm } from '../components/ManifestForm'; @@ -13,7 +12,6 @@ import { ManifestForm } from '../components/ManifestForm'; const mapDispatchToProps = { addResource: actions.addResource }; const enhance = compose( - withTranslation(), connect(null, mapDispatchToProps), withPlugins('ManifestForm'), ); diff --git a/src/containers/ManifestInfo.js b/src/containers/ManifestInfo.js index d3a129b08d..89e202bb70 100644 --- a/src/containers/ManifestInfo.js +++ b/src/containers/ManifestInfo.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getManifestDescription, @@ -27,7 +26,6 @@ const mapStateToProps = (state, { id, manifestId, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('ManifestInfo'), ); diff --git a/src/containers/ManifestListItem.js b/src/containers/ManifestListItem.js index 55f5c43e90..2c030ab7b6 100644 --- a/src/containers/ManifestListItem.js +++ b/src/containers/ManifestListItem.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getManifest, @@ -50,7 +49,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('ManifestListItem'), ); diff --git a/src/containers/ManifestListItemError.js b/src/containers/ManifestListItemError.js index 40d9f5f14d..8e61023b67 100644 --- a/src/containers/ManifestListItemError.js +++ b/src/containers/ManifestListItemError.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { fetchManifest, removeResource } from '../state/actions'; import { ManifestListItemError } from '../components/ManifestListItemError'; @@ -12,7 +11,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(null, mapDispatchToProps), withPlugins('ManifestListItemError'), ); diff --git a/src/containers/ManifestRelatedLinks.js b/src/containers/ManifestRelatedLinks.js index a3f1edf9e0..d4e1da7081 100644 --- a/src/containers/ManifestRelatedLinks.js +++ b/src/containers/ManifestRelatedLinks.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getManifestHomepage, @@ -25,7 +24,6 @@ const mapStateToProps = (state, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('ManifestRelatedLinks'), ); diff --git a/src/containers/MinimalWindow.js b/src/containers/MinimalWindow.js index d4e57cb75b..08218d5666 100644 --- a/src/containers/MinimalWindow.js +++ b/src/containers/MinimalWindow.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { MinimalWindow } from '../components/MinimalWindow'; @@ -22,7 +21,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('MinimalWindow'), ); diff --git a/src/containers/MosaicRenderPreview.js b/src/containers/MosaicRenderPreview.js index 149861f89f..9c3e9b8759 100644 --- a/src/containers/MosaicRenderPreview.js +++ b/src/containers/MosaicRenderPreview.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getManifestTitle } from '../state/selectors'; import { MosaicRenderPreview } from '../components/MosaicRenderPreview'; @@ -13,7 +12,6 @@ const mapStateToProps = (state, { windowId }) => ( ); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('MosaicRenderPreview'), ); diff --git a/src/containers/OpenSeadragonViewer.js b/src/containers/OpenSeadragonViewer.js index adc01cf90c..e03bc8bef4 100644 --- a/src/containers/OpenSeadragonViewer.js +++ b/src/containers/OpenSeadragonViewer.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import flatten from 'lodash/flatten'; import { withPlugins } from '../extend/withPlugins'; import { OpenSeadragonViewer } from '../components/OpenSeadragonViewer'; @@ -55,7 +54,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('OpenSeadragonViewer'), ); diff --git a/src/containers/SearchHit.js b/src/containers/SearchHit.js index 7e67df152f..66f31bb863 100644 --- a/src/containers/SearchHit.js +++ b/src/containers/SearchHit.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { SearchHit } from '../components/SearchHit'; import * as actions from '../state/actions'; @@ -71,7 +70,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ const enhance = compose( connect(mapStateToProps, mapDispatchToProps), - withTranslation(), withPlugins('SearchHit'), ); diff --git a/src/containers/SearchPanel.js b/src/containers/SearchPanel.js index 5a5f4aa408..b92fe4d0ad 100644 --- a/src/containers/SearchPanel.js +++ b/src/containers/SearchPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import * as actions from '../state/actions'; import { withPlugins } from '../extend/withPlugins'; import { SearchPanel } from '../components/SearchPanel'; @@ -23,7 +22,6 @@ const mapDispatchToProps = (dispatch, props) => ({ const enhance = compose( connect(mapStateToProps, mapDispatchToProps), - withTranslation(), withPlugins('SearchPanel'), ); diff --git a/src/containers/SearchPanelControls.js b/src/containers/SearchPanelControls.js index e2f718ae07..ab71f26107 100644 --- a/src/containers/SearchPanelControls.js +++ b/src/containers/SearchPanelControls.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { SearchPanelControls } from '../components/SearchPanelControls'; import * as actions from '../state/actions'; @@ -34,7 +33,6 @@ const mapDispatchToProps = { const enhance = compose( connect(mapStateToProps, mapDispatchToProps), - withTranslation(), withPlugins('SearchPanelControls'), ); diff --git a/src/containers/SearchPanelNavigation.js b/src/containers/SearchPanelNavigation.js index 83b421ac3b..8a77cf28cd 100644 --- a/src/containers/SearchPanelNavigation.js +++ b/src/containers/SearchPanelNavigation.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { SearchPanelNavigation } from '../components/SearchPanelNavigation'; import * as actions from '../state/actions'; @@ -38,7 +37,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ const enhance = compose( connect(mapStateToProps, mapDispatchToProps), - withTranslation(), withPlugins('SearchPanelNavigation'), ); diff --git a/src/containers/SearchResults.js b/src/containers/SearchResults.js index 0684e36b8e..9fd30f1d56 100644 --- a/src/containers/SearchResults.js +++ b/src/containers/SearchResults.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { SearchResults } from '../components/SearchResults'; import * as actions from '../state/actions'; @@ -34,7 +33,6 @@ const mapDispatchToProps = { const enhance = compose( connect(mapStateToProps, mapDispatchToProps), - withTranslation(), withPlugins('SearchResults'), ); diff --git a/src/containers/SelectCollection.js b/src/containers/SelectCollection.js index e711f53708..39fcc3d80a 100644 --- a/src/containers/SelectCollection.js +++ b/src/containers/SelectCollection.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import * as actions from '../state/actions'; import { withPlugins } from '../extend/withPlugins'; import { @@ -23,7 +22,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('SelectCollection'), ); diff --git a/src/containers/SidebarIndexItem.js b/src/containers/SidebarIndexItem.js index bc8a19001e..4005fa3c12 100644 --- a/src/containers/SidebarIndexItem.js +++ b/src/containers/SidebarIndexItem.js @@ -1,11 +1,9 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { SidebarIndexItem } from '../components/SidebarIndexItem'; const enhance = compose( - withTranslation(), connect(null, null), withPlugins('SidebarIndexItem'), ); diff --git a/src/containers/SidebarIndexList.js b/src/containers/SidebarIndexList.js index de46a88939..21b69418f1 100644 --- a/src/containers/SidebarIndexList.js +++ b/src/containers/SidebarIndexList.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { @@ -29,7 +28,6 @@ const mapDispatchToProps = (dispatch, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('SidebarIndexList'), ); diff --git a/src/containers/SidebarIndexTableOfContents.js b/src/containers/SidebarIndexTableOfContents.js index 870f0c4087..be46b4037a 100644 --- a/src/containers/SidebarIndexTableOfContents.js +++ b/src/containers/SidebarIndexTableOfContents.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { SidebarIndexTableOfContents } from '../components/SidebarIndexTableOfContents'; import { @@ -33,7 +32,6 @@ const mapDispatchToProps = (dispatch, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('SidebarIndexTableOfContents'), ); diff --git a/src/containers/SidebarIndexThumbnail.js b/src/containers/SidebarIndexThumbnail.js index 74c831814f..2f6c6340b4 100644 --- a/src/containers/SidebarIndexThumbnail.js +++ b/src/containers/SidebarIndexThumbnail.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { SidebarIndexThumbnail } from '../components/SidebarIndexThumbnail'; import { getConfig } from '../state/selectors'; @@ -15,7 +14,6 @@ const mapStateToProps = (state, { data }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('SidebarIndexThumbnail'), ); diff --git a/src/containers/ThumbnailCanvasGrouping.js b/src/containers/ThumbnailCanvasGrouping.js index 548c941ba9..a8e7c595da 100644 --- a/src/containers/ThumbnailCanvasGrouping.js +++ b/src/containers/ThumbnailCanvasGrouping.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getCurrentCanvas } from '../state/selectors'; @@ -25,7 +24,6 @@ const mapStateToProps = (state, { data }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('ThumbnailCanvasGrouping'), ); diff --git a/src/containers/ThumbnailNavigation.js b/src/containers/ThumbnailNavigation.js index bf7c3490aa..3b23c2ae98 100644 --- a/src/containers/ThumbnailNavigation.js +++ b/src/containers/ThumbnailNavigation.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { ThumbnailNavigation } from '../components/ThumbnailNavigation'; @@ -40,7 +39,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('ThumbnailNavigation'), ); diff --git a/src/containers/VideoViewer.js b/src/containers/VideoViewer.js index 3c868940a2..eeb49e0a76 100644 --- a/src/containers/VideoViewer.js +++ b/src/containers/VideoViewer.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { VideoViewer } from '../components/VideoViewer'; import { getConfig, getVisibleCanvasCaptions, getVisibleCanvasVideoResources } from '../state/selectors'; @@ -15,7 +14,6 @@ const mapStateToProps = (state, { windowId }) => ( ); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('VideoViewer'), ); diff --git a/src/containers/ViewerInfo.js b/src/containers/ViewerInfo.js index 6757102f98..aace450c9d 100644 --- a/src/containers/ViewerInfo.js +++ b/src/containers/ViewerInfo.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { ViewerInfo } from '../components/ViewerInfo'; import { @@ -29,7 +28,6 @@ const mapStateToProps = (state, props) => { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('ViewerInfo'), ); diff --git a/src/containers/ViewerNavigation.js b/src/containers/ViewerNavigation.js index 3f142de431..66b2145e24 100644 --- a/src/containers/ViewerNavigation.js +++ b/src/containers/ViewerNavigation.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { @@ -28,7 +27,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('ViewerNavigation'), // further HOC go here diff --git a/src/containers/Window.js b/src/containers/Window.js index 36cd4e14e1..b82727d58f 100644 --- a/src/containers/Window.js +++ b/src/containers/Window.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { Window } from '../components/Window'; @@ -36,7 +35,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('Window'), ); diff --git a/src/containers/WindowAuthenticationBar.js b/src/containers/WindowAuthenticationBar.js index b38a244aa8..db3240da47 100644 --- a/src/containers/WindowAuthenticationBar.js +++ b/src/containers/WindowAuthenticationBar.js @@ -1,10 +1,8 @@ import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WindowAuthenticationBar } from '../components/WindowAuthenticationBar'; const enhance = compose( - withTranslation(), withPlugins('WindowAuthenticationBar'), ); diff --git a/src/containers/WindowList.js b/src/containers/WindowList.js index fb482b8d0c..01ad8f3902 100644 --- a/src/containers/WindowList.js +++ b/src/containers/WindowList.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getFocusedWindowId, getWindowIds, getWindowTitles } from '../state/selectors'; @@ -29,7 +28,6 @@ const mapStateToProps = state => ( ); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WindowList'), ); diff --git a/src/containers/WindowListButton.js b/src/containers/WindowListButton.js index 68e984e497..2411861d17 100644 --- a/src/containers/WindowListButton.js +++ b/src/containers/WindowListButton.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getWindowIds, getWorkspace } from '../state/selectors'; import { WindowListButton } from '../components/WindowListButton'; @@ -12,7 +11,6 @@ const mapStateToProps = (state) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('WindowListButton'), ); diff --git a/src/containers/WindowSideBar.js b/src/containers/WindowSideBar.js index 022e34f310..26b3ee2169 100644 --- a/src/containers/WindowSideBar.js +++ b/src/containers/WindowSideBar.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WindowSideBar } from '../components/WindowSideBar'; import { getThemeDirection, getWindow } from '../state/selectors'; @@ -19,7 +18,6 @@ const mapStateToProps = (state, { windowId }) => ( ); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('WindowSideBar'), ); diff --git a/src/containers/WindowSideBarAnnotationsPanel.js b/src/containers/WindowSideBarAnnotationsPanel.js index 8370a0c375..71c73ca1ec 100644 --- a/src/containers/WindowSideBarAnnotationsPanel.js +++ b/src/containers/WindowSideBarAnnotationsPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getVisibleCanvasIds, @@ -22,7 +21,6 @@ const mapStateToProps = (state, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('WindowSideBarAnnotationsPanel'), // further HOC diff --git a/src/containers/WindowSideBarButtons.js b/src/containers/WindowSideBarButtons.js index 3b0511ae0f..5bb2e69efb 100644 --- a/src/containers/WindowSideBarButtons.js +++ b/src/containers/WindowSideBarButtons.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import MiradorCanvas from '../lib/MiradorCanvas'; @@ -65,7 +64,6 @@ const mapStateToProps = (state, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WindowSideBarButtons'), ); diff --git a/src/containers/WindowSideBarCanvasPanel.js b/src/containers/WindowSideBarCanvasPanel.js index e6b4befc73..902cac8c65 100644 --- a/src/containers/WindowSideBarCanvasPanel.js +++ b/src/containers/WindowSideBarCanvasPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { WindowSideBarCanvasPanel } from '../components/WindowSideBarCanvasPanel'; @@ -53,7 +52,6 @@ const mapDispatchToProps = (dispatch, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WindowSideBarCanvasPanel'), ); diff --git a/src/containers/WindowSideBarCollectionPanel.js b/src/containers/WindowSideBarCollectionPanel.js index 738c11125a..050509165f 100644 --- a/src/containers/WindowSideBarCollectionPanel.js +++ b/src/containers/WindowSideBarCollectionPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { @@ -56,7 +55,6 @@ const mapDispatchToProps = (dispatch, { id, windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WindowSideBarCollectionPanel'), ); diff --git a/src/containers/WindowSideBarInfoPanel.js b/src/containers/WindowSideBarInfoPanel.js index 19de86776b..c8bee5c5b0 100644 --- a/src/containers/WindowSideBarInfoPanel.js +++ b/src/containers/WindowSideBarInfoPanel.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { @@ -33,7 +32,6 @@ const mapDispatchToProps = (dispatch, { windowId, id }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WindowSideBarInfoPanel'), ); diff --git a/src/containers/WindowThumbnailSettings.js b/src/containers/WindowThumbnailSettings.js index d773247fee..3217d6812e 100644 --- a/src/containers/WindowThumbnailSettings.js +++ b/src/containers/WindowThumbnailSettings.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getThumbnailNavigationPosition, getThemeDirection } from '../state/selectors'; @@ -26,7 +25,6 @@ const mapStateToProps = (state, { windowId }) => ( ); const enhance = compose( - withTranslation(null, { withRef: true }), connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true }), withPlugins('WindowThumbnailSettings'), // further HOC go here diff --git a/src/containers/WindowTopBar.js b/src/containers/WindowTopBar.js index ae9fc34b90..990007620d 100644 --- a/src/containers/WindowTopBar.js +++ b/src/containers/WindowTopBar.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getWindowConfig, isFocused } from '../state/selectors'; @@ -35,7 +34,6 @@ const mapDispatchToProps = (dispatch, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WindowTopBar'), ); diff --git a/src/containers/WindowTopBarPluginArea.js b/src/containers/WindowTopBarPluginArea.js index cf05b64af3..fd54047cbe 100644 --- a/src/containers/WindowTopBarPluginArea.js +++ b/src/containers/WindowTopBarPluginArea.js @@ -1,11 +1,9 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WindowTopBarPluginArea } from '../components/WindowTopBarPluginArea'; const enhance = compose( - withTranslation(), connect(null, null), withPlugins('WindowTopBarPluginArea'), ); diff --git a/src/containers/WindowTopBarPluginMenu.js b/src/containers/WindowTopBarPluginMenu.js index 27afc8ba81..ed52de094c 100644 --- a/src/containers/WindowTopBarPluginMenu.js +++ b/src/containers/WindowTopBarPluginMenu.js @@ -1,10 +1,8 @@ import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WindowTopBarPluginMenu } from '../components/WindowTopBarPluginMenu'; const enhance = compose( - withTranslation(), withPlugins('WindowTopBarPluginMenu'), ); diff --git a/src/containers/WindowTopBarTitle.js b/src/containers/WindowTopBarTitle.js index fbdf31288b..88adb8be39 100644 --- a/src/containers/WindowTopBarTitle.js +++ b/src/containers/WindowTopBarTitle.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { getManifestStatus, getManifestTitle, getWindowConfig } from '../state/selectors'; import { WindowTopBarTitle } from '../components/WindowTopBarTitle'; @@ -14,7 +13,6 @@ const mapStateToProps = (state, { windowId }) => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, null), withPlugins('WindowTopBarTitle'), ); diff --git a/src/containers/WindowTopMenu.js b/src/containers/WindowTopMenu.js index 2f4bfdb736..f4916086bc 100644 --- a/src/containers/WindowTopMenu.js +++ b/src/containers/WindowTopMenu.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { WindowTopMenu } from '../components/WindowTopMenu'; @@ -25,7 +24,6 @@ const mapDispatchToProps = dispatch => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WindowTopMenu'), ); diff --git a/src/containers/WindowTopMenuButton.js b/src/containers/WindowTopMenuButton.js index 8a114a8dea..7aba4484c4 100644 --- a/src/containers/WindowTopMenuButton.js +++ b/src/containers/WindowTopMenuButton.js @@ -1,10 +1,8 @@ import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WindowTopMenuButton } from '../components/WindowTopMenuButton'; const enhance = compose( - withTranslation(), withPlugins('WindowTopMenuButton'), ); diff --git a/src/containers/WindowViewSettings.js b/src/containers/WindowViewSettings.js index 3e34e5949b..98ba9c9347 100644 --- a/src/containers/WindowViewSettings.js +++ b/src/containers/WindowViewSettings.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getAllowedWindowViewTypes, getWindowViewType } from '../state/selectors'; @@ -26,7 +25,6 @@ const mapStateToProps = (state, { windowId }) => ( ); const enhance = compose( - withTranslation(null, { withRef: true }), connect(mapStateToProps, mapDispatchToProps, null, { forwardRef: true }), withPlugins('WindowViewSettings'), ); diff --git a/src/containers/Workspace.js b/src/containers/Workspace.js index f9288e8d94..d692a58d7c 100644 --- a/src/containers/Workspace.js +++ b/src/containers/Workspace.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { Workspace } from '../components/Workspace'; import { @@ -34,7 +33,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('Workspace'), // further HOC go here diff --git a/src/containers/WorkspaceAdd.js b/src/containers/WorkspaceAdd.js index 0c0883945d..7d36a922d7 100644 --- a/src/containers/WorkspaceAdd.js +++ b/src/containers/WorkspaceAdd.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { WorkspaceAdd } from '../components/WorkspaceAdd'; @@ -24,7 +23,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WorkspaceAdd'), ); diff --git a/src/containers/WorkspaceAddButton.js b/src/containers/WorkspaceAddButton.js index 1e52146bb4..c4f1751cd6 100644 --- a/src/containers/WorkspaceAddButton.js +++ b/src/containers/WorkspaceAddButton.js @@ -1,6 +1,5 @@ import { connect } from 'react-redux'; import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getWindowIds, getWorkspace } from '../state/selectors'; @@ -30,7 +29,6 @@ const mapStateToProps = (state, { width }) => { const mapDispatchToProps = { setWorkspaceAddVisibility: actions.setWorkspaceAddVisibility }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WorkspaceAddButton'), ); diff --git a/src/containers/WorkspaceArea.js b/src/containers/WorkspaceArea.js index f58fa21317..62ccc2b765 100644 --- a/src/containers/WorkspaceArea.js +++ b/src/containers/WorkspaceArea.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WorkspaceArea } from '../components/WorkspaceArea'; import { getConfig, getWindowIds, getWorkspace } from '../state/selectors'; @@ -20,7 +19,6 @@ const mapStateToProps = state => ( ); const enhance = compose( - withTranslation(), connect(mapStateToProps), withPlugins('WorkspaceArea'), ); diff --git a/src/containers/WorkspaceControlPanel.js b/src/containers/WorkspaceControlPanel.js index e23bb417a9..67b12abb3b 100644 --- a/src/containers/WorkspaceControlPanel.js +++ b/src/containers/WorkspaceControlPanel.js @@ -1,10 +1,8 @@ import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WorkspaceControlPanel } from '../components/WorkspaceControlPanel'; const enhance = compose( - withTranslation(), withPlugins('WorkspaceControlPanel'), // further HOC go here ); diff --git a/src/containers/WorkspaceExport.js b/src/containers/WorkspaceExport.js index 069a525428..611123b867 100644 --- a/src/containers/WorkspaceExport.js +++ b/src/containers/WorkspaceExport.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WorkspaceExport } from '../components/WorkspaceExport'; import { @@ -17,7 +16,6 @@ const mapStateToProps = state => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, {}), withPlugins('WorkspaceExport'), ); diff --git a/src/containers/WorkspaceImport.js b/src/containers/WorkspaceImport.js index c529bca89a..4f8be82e18 100644 --- a/src/containers/WorkspaceImport.js +++ b/src/containers/WorkspaceImport.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WorkspaceImport } from '../components/WorkspaceImport'; import * as actions from '../state/actions'; @@ -16,7 +15,6 @@ const mapDispatchToProps = { }; const enhance = compose( - withTranslation(), connect(null, mapDispatchToProps), withPlugins('WorkspaceImport'), ); diff --git a/src/containers/WorkspaceMenu.js b/src/containers/WorkspaceMenu.js index fb7dca774d..7801b5f425 100644 --- a/src/containers/WorkspaceMenu.js +++ b/src/containers/WorkspaceMenu.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { @@ -30,7 +29,6 @@ const mapStateToProps = state => ({ }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WorkspaceMenu'), ); diff --git a/src/containers/WorkspaceMenuButton.js b/src/containers/WorkspaceMenuButton.js index b5f2518eb2..8713b3be6b 100644 --- a/src/containers/WorkspaceMenuButton.js +++ b/src/containers/WorkspaceMenuButton.js @@ -1,10 +1,8 @@ import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WorkspaceMenuButton } from '../components/WorkspaceMenuButton'; const enhance = compose( - withTranslation(), withPlugins('WorkspaceMenuButton'), // further HOC ); diff --git a/src/containers/WorkspaceOptionsButton.js b/src/containers/WorkspaceOptionsButton.js index 5768c4cd2a..4fdf8ae626 100644 --- a/src/containers/WorkspaceOptionsButton.js +++ b/src/containers/WorkspaceOptionsButton.js @@ -1,10 +1,8 @@ import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WorkspaceOptionsButton } from '../components/WorkspaceOptionsButton'; const enhance = compose( - withTranslation(), withPlugins('WorkspaceOptionsButton'), ); diff --git a/src/containers/WorkspaceOptionsMenu.js b/src/containers/WorkspaceOptionsMenu.js index 81d550af57..285ca00ce4 100644 --- a/src/containers/WorkspaceOptionsMenu.js +++ b/src/containers/WorkspaceOptionsMenu.js @@ -1,9 +1,3 @@ -import { compose } from 'redux'; -import { withTranslation } from 'react-i18next'; import { WorkspaceOptionsMenu } from '../components/WorkspaceOptionsMenu'; -const enhance = compose( - withTranslation(), -); - -export default enhance(WorkspaceOptionsMenu); +export default WorkspaceOptionsMenu; diff --git a/src/containers/WorkspaceSelectionDialog.js b/src/containers/WorkspaceSelectionDialog.js index 3305e53216..ec2624d677 100644 --- a/src/containers/WorkspaceSelectionDialog.js +++ b/src/containers/WorkspaceSelectionDialog.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import { WorkspaceSelectionDialog } from '../components/WorkspaceSelectionDialog'; import * as actions from '../state/actions'; @@ -23,7 +22,6 @@ const mapDispatchToProps = { const mapStateToProps = state => ({ workspaceType: getWorkspaceType(state) }); const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('WorkspaceSelectionDialog'), ); diff --git a/src/containers/ZoomControls.js b/src/containers/ZoomControls.js index 1cc85d5455..35eb2757a0 100644 --- a/src/containers/ZoomControls.js +++ b/src/containers/ZoomControls.js @@ -1,6 +1,5 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withTranslation } from 'react-i18next'; import { withPlugins } from '../extend/withPlugins'; import * as actions from '../state/actions'; import { getViewer } from '../state/selectors'; @@ -25,7 +24,6 @@ const mapStateToProps = (state, { windowId }) => ( const mapDispatchToProps = { updateViewport: actions.updateViewport }; const enhance = compose( - withTranslation(), connect(mapStateToProps, mapDispatchToProps), withPlugins('ZoomControls'), );