-
Notifications
You must be signed in to change notification settings - Fork 2
/
circularGenomeBuilderView.tsx
102 lines (93 loc) · 3.67 KB
/
circularGenomeBuilderView.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import * as electron from "electron";
const ipc = electron.ipcRenderer;
import * as React from "react";
import { AppBar } from '../../components/appBar';
import { Toolbar } from '../../components/toolBar';
import { IconButton } from '../../components/iconButton';
import { MenuRounded } from '../../components/icons/menuRounded';
import { white } from '../../styles/colours';
import { CircularFigure } from '../../circularFigure/circularFigure';
import { Fasta } from '../../../fasta';
import { SaveKeyEvent } from '../../../ipcEvents';
import { CircularGenome } from './containers/circularGenome/circularGenome';
import { DonutLargeOutlined } from '../../components/icons/donutLargeOutlined';
import { WavesOutlined } from '../../components/icons/wavesOutlined';
import { FigureSelectOverlay } from './containers/overlays/figureSelectOverlay';
import { appBar } from './containers/styles/appBar';
export interface CircularGenomeBuilderViewState {
figureSelectDrawerOpen: boolean;
selectedFigure: string;
}
export interface CircularGenomeBuilderViewProps {
figures: Array<CircularFigure>;
fastas: Array<Fasta>;
}
export class CircularGenomeBuilderView extends React.Component<CircularGenomeBuilderViewProps, CircularGenomeBuilderViewState>
{
public constructor(props: CircularGenomeBuilderViewProps) {
super(props);
this.state = {
figureSelectDrawerOpen: false,
} as CircularGenomeBuilderViewState;
}
public newFigure(fasta: Fasta): void {
ipc.send(
"saveKey",
{
action: "saveKey",
channel: "circularGenomeBuilder",
key: "circularFigures",
val: [...this.props.figures, new CircularFigure("New Figure", fasta.uuid, fasta.contigs)]
} as SaveKeyEvent
);
}
public render(): JSX.Element {
return (
<React.Fragment>
<AppBar position="fixed" className={appBar}>
<Toolbar>
<IconButton
edge="start"
color="primary"
classes={{ colorPrimary: white }}
onClick={() => {
this.setState({
figureSelectDrawerOpen: !this.state.figureSelectDrawerOpen
});
}}
>
<MenuRounded />
</IconButton>
<IconButton
edge="start"
color="primary"
classes={{ colorPrimary: white }}
>
<DonutLargeOutlined />
</IconButton>
<IconButton
edge="start"
color="primary"
classes={{ colorPrimary: white }}
>
<WavesOutlined />
</IconButton>
</Toolbar>
</AppBar>
<FigureSelectOverlay builder={this} />
{
this.props.figures.map((x) => {
if (x.uuid == this.state.selectedFigure) {
return (
<CircularGenome
figure={x}
/>
)
}
return null;
})
}
</React.Fragment>
);
}
}