@@ -2,45 +2,51 @@ import PluginManager from '@jbrowse/core/PluginManager'
2
2
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
3
3
import { PluggableElementType } from '@jbrowse/core/pluggableElementTypes'
4
4
import { IAnyModelType } from 'mobx-state-tree'
5
- import { getSession , getContainingTrack } from '@jbrowse/core/util'
5
+ import { getSession , getContainingTrack , Feature } from '@jbrowse/core/util'
6
6
7
7
// icons
8
8
import AddIcon from '@mui/icons-material/Add'
9
9
10
10
// locals
11
11
import LaunchProteinViewDialog from './components/LaunchProteinViewDialog'
12
+ import { MenuItem } from '@jbrowse/core/ui'
12
13
13
14
function isDisplay ( elt : { name : string } ) : elt is DisplayType {
14
15
return elt . name === 'LinearBasicDisplay'
15
16
}
16
17
17
18
function extendStateModel ( stateModel : IAnyModelType ) {
18
- return stateModel . views ( self => {
19
- const superContextMenuItems = self . contextMenuItems
20
- return {
21
- contextMenuItems ( ) {
22
- const feature = self . contextMenuFeature
23
- const track = getContainingTrack ( self )
24
- return [
25
- ...superContextMenuItems ( ) ,
26
- ...( feature
27
- ? [
28
- {
29
- label : 'Launch 3-D protein view' ,
30
- icon : AddIcon ,
31
- onClick : ( ) => {
32
- getSession ( track ) . queueDialog ( handleClose => [
33
- LaunchProteinViewDialog ,
34
- { model : track , handleClose, feature } ,
35
- ] )
19
+ return stateModel . views (
20
+ ( self : {
21
+ contextMenuItems : ( ) => MenuItem [ ]
22
+ contextMenuFeature ?: Feature
23
+ } ) => {
24
+ const superContextMenuItems = self . contextMenuItems
25
+ return {
26
+ contextMenuItems ( ) {
27
+ const feature = self . contextMenuFeature
28
+ const track = getContainingTrack ( self )
29
+ return [
30
+ ...superContextMenuItems ( ) ,
31
+ ...( feature
32
+ ? [
33
+ {
34
+ label : 'Launch 3-D protein view' ,
35
+ icon : AddIcon ,
36
+ onClick : ( ) => {
37
+ getSession ( track ) . queueDialog ( handleClose => [
38
+ LaunchProteinViewDialog ,
39
+ { model : track , handleClose, feature } ,
40
+ ] )
41
+ } ,
36
42
} ,
37
- } ,
38
- ]
39
- : [ ] ) ,
40
- ]
41
- } ,
42
- }
43
- } )
43
+ ]
44
+ : [ ] ) ,
45
+ ]
46
+ } ,
47
+ }
48
+ } ,
49
+ )
44
50
}
45
51
46
52
export default function LaunchProteinViewF ( pluginManager : PluginManager ) {
0 commit comments