From c28433326a3604acd746cd63bac49544b0c5d14c Mon Sep 17 00:00:00 2001 From: Jack Reed Date: Mon, 8 Apr 2019 13:01:56 -0600 Subject: [PATCH] Adds an empty workspace message fixes #1965 --- __tests__/src/components/WorkspaceAdd.test.js | 6 +++ src/components/WorkspaceAdd.js | 37 +++++++++++++++---- src/locales/de/translation.json | 1 + src/locales/en/translation.json | 1 + 4 files changed, 38 insertions(+), 7 deletions(-) diff --git a/__tests__/src/components/WorkspaceAdd.test.js b/__tests__/src/components/WorkspaceAdd.test.js index 1c600f9f1b..91fda9666f 100644 --- a/__tests__/src/components/WorkspaceAdd.test.js +++ b/__tests__/src/components/WorkspaceAdd.test.js @@ -27,6 +27,12 @@ describe('WorkspaceAdd', () => { expect(wrapper.find(ManifestListItem).length).toBe(2); }); + it('without manifests, renders an empty message', () => { + const wrapper = createWrapper({ manifests: {} }); + expect(wrapper.find(ManifestListItem).length).toEqual(0); + expect(wrapper.find('WithStyles(Typography)').first().children().text()).toEqual('emptyResourceList'); + }); + it('toggles the workspace visibility', () => { const setWorkspaceAddVisibility = jest.fn(); const wrapper = createWrapper({ setWorkspaceAddVisibility }); diff --git a/src/components/WorkspaceAdd.js b/src/components/WorkspaceAdd.js index 8cef253ea6..035ccf4d23 100644 --- a/src/components/WorkspaceAdd.js +++ b/src/components/WorkspaceAdd.js @@ -5,6 +5,7 @@ import AddIcon from '@material-ui/icons/AddSharp'; import ExpandMoreIcon from '@material-ui/icons/ExpandMoreSharp'; import AppBar from '@material-ui/core/AppBar'; import Drawer from '@material-ui/core/Drawer'; +import Grid from '@material-ui/core/Grid'; import Fab from '@material-ui/core/Fab'; import List from '@material-ui/core/List'; import Paper from '@material-ui/core/Paper'; @@ -56,13 +57,35 @@ export class WorkspaceAdd extends React.Component { return (
- - {t('miradorResources')} - - {manifestList} - - - + {(Object.keys(manifests).length < 1) ? ( + + + + {t('emptyResourceList')} + + + + ) : ( + + {t('miradorResources')} + + {manifestList} + + + )}