Skip to content

Commit

Permalink
Add simple loading text for LGV (#2442)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 23, 2021
1 parent 195c635 commit 6e0da15
Showing 1 changed file with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,30 @@ import Ruler from './Ruler'
type LGV = Instance<LinearGenomeViewStateModel>

const useStyles = makeStyles(theme => ({
errorMessage: {
note: {
textAlign: 'center',
paddingTop: theme.spacing(1),
paddingBottom: theme.spacing(1),
},
spacer: {
marginRight: theme.spacing(2),
dots: {
'&::after': {
display: 'inline-block',
animation: '$ellipsis 1.5s infinite',
content: '"."',
width: '1em',
textAlign: 'left',
},
},
'@keyframes ellipsis': {
'0%': {
content: '"."',
},
'33%': {
content: '".."',
},
'66%': {
content: '"..."',
},
},
}))

Expand All @@ -41,11 +58,16 @@ const LinearGenomeView = observer(({ model }: { model: LGV }) => {
const classes = useStyles()

if (!initialized && !error) {
return null
return (
<Typography className={classes.dots} variant="h5">
Loading
</Typography>
)
}
if (!hasDisplayedRegions || error) {
return <ImportForm model={model} />
}

return (
<div style={{ position: 'relative' }}>
{model.seqDialogDisplayed ? (
Expand Down Expand Up @@ -79,15 +101,15 @@ const LinearGenomeView = observer(({ model }: { model: LGV }) => {
)}
<TracksContainer model={model}>
{!tracks.length ? (
<Paper variant="outlined" className={classes.errorMessage}>
<Paper variant="outlined" className={classes.note}>
<Typography>No tracks active.</Typography>
<Button
variant="contained"
color="primary"
onClick={model.activateTrackSelector}
style={{ zIndex: 1000 }}
startIcon={<TrackSelectorIcon />}
>
<TrackSelectorIcon className={classes.spacer} />
Open track selector
</Button>
</Paper>
Expand Down

0 comments on commit 6e0da15

Please sign in to comment.