-
Notifications
You must be signed in to change notification settings - Fork 2
/
toolBarView.tsx
147 lines (137 loc) · 6.65 KB
/
toolBarView.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import * as electron from "electron";
const ipc = electron.ipcRenderer;
import * as React from "react";
import {AtomicOperation} from "../../../operations/atomicOperations";
import formatByteString from "../../formatByteString";
import {Typography} from "../../components/typography";
import {GridWrapper} from "../../containers/gridWrapper";
import {Grid} from "../../components/grid";
import {activeHover, activeHoverButton} from "../../styles/activeHover";
import {toolBarButton} from "../../styles/toolBarButton";
import {Fastq} from "../../../fastq";
import {Fasta} from "../../../fasta";
import {AlignData} from "../../../alignData";
import {InputView} from "../inputView/inputView";
import {PHATView} from "../../phatView";
import {ToolBarTab, ToolBarTabs} from "./containers/toolBarTabs/toolBarTabs";
import {tabInfo} from "./tabInfo";
import { AlignView } from '../../AlignRenderer/AlignView';
export interface ToolBarViewState
{
views? : Array<ToolBarTab<ToolBarViewProps>>;
}
export interface ToolBarViewProps
{
operations? : Array<AtomicOperation>;
fastqs? : Array<Fastq>;
fastas? : Array<Fasta>;
aligns? : Array<AlignData>;
runningOpText? : string;
saveText? : string;
}
export class ToolBarView extends React.Component<ToolBarViewProps,ToolBarViewState> implements PHATView
{
public state : ToolBarViewState;
public constructor(props : ToolBarViewProps)
{
super(props);
this.state = {
views : []
} as ToolBarViewState;
}
public render() : JSX.Element
{
return (
<div style={{width:"100%",position:"absolute",left:"0px"}}>
{this.props.saveText ? (
<div>
<h1>Saving Project</h1>
<Typography>{this.props.saveText}</Typography>
</div>
) : (
<div>
<GridWrapper>
<Grid container spacing={1} justify="flex-start">
<Grid item>
<img
src={tabInfo["Input"].imgURI()}
className={`${activeHover} ${activeHoverButton} ${toolBarButton}`}
onClick={() =>
{
this.setState({
views : this.state.views.concat([
{
label : "Input",
refKey : "Input",
body : (props : ToolBarViewProps) => (
<InputView
fastqs={props.fastqs}
fastas={props.fastas}
aligns={props.aligns}
operations={props.operations}
/>
)
}
])
});
}}
/>
</Grid>
<Grid item>
<img
src={tabInfo["QC"].imgURI()}
className={`${activeHover} ${activeHoverButton} ${toolBarButton}`}
/>
</Grid>
<Grid item>
<img
src={tabInfo["Align"].imgURI()}
className={`${activeHover} ${activeHoverButton} ${toolBarButton}`}
onClick={()=>{
this.setState({
views : this.state.views.concat([
{
label : "Alignment",
refKey : "Align",
body : (props : ToolBarViewProps) => (
<AlignView
fastqs={props.fastqs}
fastas={props.fastas}
operations={props.operations}
/>
)
}
])
})
}}
/>
</Grid>
<Grid item>
<img
src={tabInfo["Output"].imgURI()}
className={`${activeHover} ${activeHoverButton} ${toolBarButton}`}
/>
</Grid>
<Grid item>
<img
src={tabInfo["Genome Builder"].imgURI()}
className={`${activeHover} ${activeHoverButton} ${toolBarButton}`}
/>
</Grid>
</Grid>
</GridWrapper>
<ToolBarTabs
onTabDelete={(tab : ToolBarTab<ToolBarViewProps>,i : number) =>
{
this.state.views.splice(i,1);
this.setState({});
}}
tabs={this.state.views}
propPack={this.props}
/>
</div>
)}
</div>
);
}
}