-
Notifications
You must be signed in to change notification settings - Fork 2
/
figureSelectOverlay.tsx
102 lines (98 loc) · 5.6 KB
/
figureSelectOverlay.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 React from "react";
import {TreeView} from "../../../../components/treeView";
import {TreeItem} from "../../../../components/treeItem";
import {CircularGenomeBuilderView} from "../../circularGenomeBuilderView";
import {GridWrapper} from "../../../../containers/gridWrapper";
import {Grid} from "../../../../components/grid";
import {Typography} from "../../../../components/typography";
import {ChevronRight} from "../../../../components/icons/chevronRight";
import {blue} from "../../../../styles/colours";
import {ExpandMore} from "../../../../components/icons/expandMore";
import {AddBox} from "../../../../components/icons/addBox";
import {Overlay} from "./overlay";
export interface FigureSelectOverlayProps {
builder: CircularGenomeBuilderView;
onClose : () => void;
open : boolean;
}
export function FigureSelectOverlay(props: FigureSelectOverlayProps): JSX.Element
{
return (
<Overlay
kind="drawerLeft"
restrictions={[]}
onClose={props.onClose}
open={props.open}
>
<div>
<GridWrapper>
<div style={{marginRight: "1vh", marginLeft: "1vh", marginBottom: "1vh"}}>
<Grid container spacing={4} justify="center">
<Grid item>
<Typography variant="h5">Open a Figure</Typography>
</Grid>
</Grid>
</div>
</GridWrapper>
<GridWrapper>
<div style={{marginLeft: "1vh", marginBottom: "1vh"}}>
<Grid container direction="row" spacing={1} justify="center">
<Grid item>
<TreeView
defaultExpandIcon={<ChevronRight color="primary" classes={{colorPrimary:blue}} />}
defaultCollapseIcon={<ExpandMore color="primary" classes={{colorPrimary:blue}} />}
>
{
props.builder.props.fastas.map((fasta,fastaIndex) =>
{
return (
<TreeItem nodeId={`${fastaIndex}`} label={fasta.alias} id={`${fasta.uuid}ExpandTree`}>
{
props.builder.props.figures.map((figure,figureIndex) =>
{
if (fasta.uuid == figure.uuidFasta)
{
return (
<TreeItem
nodeId={`${fastaIndex}-${figureIndex}`}
label={figure.name}
onClick={()=>
{
props.builder.setState({
selectedFigure : figure.uuid,
figureSelectOvelayOpen : false
});
}}
/>
);
}
return (<TreeItem nodeId="" label="" />);
})
}
<TreeItem
id={`${fasta.uuid}NewFigure`}
nodeId={`${fastaIndex}-new`}
label="Create New Figure"
icon={
<AddBox
color="primary"
classes={{colorPrimary:blue}}
/>
}
onClick={()=>
{
props.builder.newFigure(fasta);
}}
/>
</TreeItem>
);
})}
</TreeView>
</Grid>
</Grid>
</div>
</GridWrapper>
</div>
</Overlay>
);
}