Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Mar 2, 2022
1 parent 7a8b5b1 commit 6fe777d
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 5 deletions.
5 changes: 1 addition & 4 deletions packages/core/data_adapters/BaseAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import { isStateTreeNode, getSnapshot } from 'mobx-state-tree'
import { ObservableCreate } from '../util/rxjs'
import { checkAbortSignal, observeAbortSignal } from '../util'
import { Feature } from '../util/simpleFeature'
import {
AnyConfigurationModel,
ConfigurationSchema,
} from '../configuration/configurationSchema'
import { AnyConfigurationModel, ConfigurationSchema } from '../configuration'
import { getSubAdapterType } from './dataAdapterCache'
import { AugmentedRegion as Region, NoAssemblyRegion } from '../util/types'
import { blankStats, rectifyStats, scoresToStats } from '../util/stats'
Expand Down
78 changes: 78 additions & 0 deletions packages/core/ui/ReturnToImportFormDialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import React from 'react'
import { observer } from 'mobx-react'
import { makeStyles } from '@material-ui/core/styles'
import {
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Divider,
IconButton,
Typography,
} from '@material-ui/core'
import CloseIcon from '@material-ui/icons/Close'

const useStyles = makeStyles(theme => ({
closeButton: {
position: 'absolute',
right: theme.spacing(1),
top: theme.spacing(1),
color: theme.palette.grey[500],
},
}))

function ReturnToImportFormDialog({
model,
handleClose,
}: {
model: { clearView: Function }
handleClose: () => void
}) {
const classes = useStyles()
return (
<Dialog maxWidth="xl" open onClose={handleClose}>
<DialogTitle>
Reference sequence
{handleClose ? (
<IconButton
className={classes.closeButton}
onClick={() => handleClose()}
>
<CloseIcon />
</IconButton>
) : null}
</DialogTitle>
<Divider />

<DialogContent>
<Typography>
Are you sure you want to return to the import form? This will lose
your current view
</Typography>
</DialogContent>
<DialogActions>
<Button
onClick={() => {
model.clearView()
handleClose()
}}
variant="contained"
color="primary"
autoFocus
>
OK
</Button>
<Button
onClick={() => handleClose()}
color="secondary"
variant="contained"
>
Cancel
</Button>
</DialogActions>
</Dialog>
)
}

export default observer(ReturnToImportFormDialog)
1 change: 1 addition & 0 deletions packages/core/ui/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './theme'
export { LogoFull, Logomark } from './Logo'
export { default as App } from './App'
export { default as ReturnToImportFormDialog } from './ReturnToImportFormDialog'
export { default as ErrorMessage } from './ErrorMessage'
export { default as AssemblySelector } from './AssemblySelector'
export { default as FileSelector } from './FileSelector'
Expand Down
8 changes: 7 additions & 1 deletion packages/core/util/Base1DViewModel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { types, cast, getSnapshot, Instance } from 'mobx-state-tree'
import { clamp, viewBpToPx } from './index'
import { Feature } from './simpleFeature'
import { Region } from './types/mst'
import { Region, ElementId } from './types/mst'
import { Region as IRegion } from './types'
import calculateDynamicBlocks from './calculateDynamicBlocks'
import calculateStaticBlocks from './calculateStaticBlocks'
Expand All @@ -16,6 +16,7 @@ export interface BpOffset {

const Base1DView = types
.model('Base1DView', {
id: ElementId,
displayedRegions: types.array(Region),
bpPerPx: 0,
offsetPx: 0,
Expand All @@ -41,6 +42,11 @@ const Base1DView = types
get width() {
return self.volatileWidth
},
get assemblyNames() {
return [
...new Set(self.displayedRegions.map(region => region.assemblyName)),
]
},

get displayedRegionsTotalPx() {
return this.totalBp / self.bpPerPx
Expand Down

0 comments on commit 6fe777d

Please sign in to comment.