Skip to content

Commit

Permalink
Adds an empty workspace message fixes #1965
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Apr 8, 2019
1 parent 6a9dc46 commit c284333
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 7 deletions.
6 changes: 6 additions & 0 deletions __tests__/src/components/WorkspaceAdd.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
37 changes: 30 additions & 7 deletions src/components/WorkspaceAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -56,13 +57,35 @@ export class WorkspaceAdd extends React.Component {

return (
<div className={ns('workspace-add')}>
<Paper className={classes.list}>
<Typography variant="srOnly" component="h1">{t('miradorResources')}</Typography>
<List>
{manifestList}
</List>
</Paper>

{(Object.keys(manifests).length < 1) ? (
<Grid
alignItems="center"
container
style={{
height: '100%',
}}
>
<Grid
xs={12}
item
>
<Typography
variant="h1"
component="div"
align="center"
>
{t('emptyResourceList')}
</Typography>
</Grid>
</Grid>
) : (
<Paper className={classes.list}>
<Typography variant="srOnly" component="h1">{t('miradorResources')}</Typography>
<List>
{manifestList}
</List>
</Paper>
)}
<Fab
variant="extended"
disabled={addResourcesOpen}
Expand Down
1 change: 1 addition & 0 deletions src/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"downloadExportWorkspace": "Arbeitsfläche exortieren",
"elastic": "Elastisch",
"elasticDescription": "Fenster können frei und unbegrenzt innerhalb der Arbeitsfläche bewegt werden und sich überlappen",
"emptyResourceList": "Ihre Ressourcenliste ist leer",
"errorDialogTitle": "Es ist ein Fehler aufgetreten",
"errorDialogConfirm": "OK",
"exitFullScreen": "Vollbildmodus verlassen",
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"downloadExportWorkspace": "Export workspace",
"elastic": "Elastic",
"elasticDescription": "Move and size windows freely in an unlimited workspace. Windows can overlap.",
"emptyResourceList": "Your resource list is empty",
"errorDialogConfirm": "OK",
"errorDialogTitle": "An error occurred",
"exitFullScreen": "Exit full screen",
Expand Down

0 comments on commit c284333

Please sign in to comment.