|
| 1 | +import React from "react"; |
| 2 | +import { Box, Typography, IconButton, Drawer, Grid, Card, CardContent, CardActions, Button } from "@mui/material"; |
| 3 | +import CloseIcon from "@mui/icons-material/Close"; |
| 4 | +import { NodeObject } from "modules/universe/NeuroJsonGraph"; |
| 5 | +import { Colors} from "design/theme"; |
| 6 | + |
| 7 | +interface NodeInfoPanelProps { |
| 8 | + open: boolean; |
| 9 | + onClose: () => void; |
| 10 | + nodeData: NodeObject | null; |
| 11 | +} |
| 12 | + |
| 13 | +const NodeInfoPanel: React.FC<NodeInfoPanelProps> = ({ open, onClose, nodeData }) => { |
| 14 | + console.log("nodeData:", nodeData); |
| 15 | + return ( |
| 16 | + <Drawer |
| 17 | + anchor="right" |
| 18 | + // open={true} |
| 19 | + open={open} |
| 20 | + onClose={onClose} |
| 21 | + sx={{ |
| 22 | + "& .MuiDrawer-paper": { |
| 23 | + width: "30%", |
| 24 | + padding: "1rem", |
| 25 | + backgroundColor: Colors.lightGray, |
| 26 | + boxShadow: "-2px 0 8px rgba(0, 0, 0, 0.2)", |
| 27 | + }, |
| 28 | + }} |
| 29 | + > |
| 30 | + <Box> |
| 31 | + {nodeData? ( |
| 32 | + <> |
| 33 | + {/* Close Button */} |
| 34 | + <Box display="flex" justifyContent="space-between" alignItems="center"> |
| 35 | + <Typography variant="h6" sx={{color: Colors.primary.dark}}>{nodeData.name}</Typography> |
| 36 | + <IconButton onClick={onClose} sx={{color: Colors.primary.main}}> |
| 37 | + <CloseIcon /> |
| 38 | + </IconButton> |
| 39 | + </Box> |
| 40 | + {/* Node Metadata */} |
| 41 | + <Grid container spacing={2}> |
| 42 | + <Grid item xs={12}> |
| 43 | + <Typography>Website</Typography> |
| 44 | + <Typography> |
| 45 | + <a href={nodeData.url} target="_blank">{nodeData.url}</a> |
| 46 | + </Typography> |
| 47 | + </Grid> |
| 48 | + |
| 49 | + <Grid item xs={12}> |
| 50 | + <Typography>Number of Datasets</Typography> |
| 51 | + <Typography>{nodeData.datasets}</Typography> |
| 52 | + </Grid> |
| 53 | + |
| 54 | + <Grid item xs={12}> |
| 55 | + <Typography>Data Types</Typography> |
| 56 | + <Typography>{nodeData.datatype.join(",")}</Typography> |
| 57 | + </Grid> |
| 58 | + |
| 59 | + <Grid item xs={12}> |
| 60 | + <Typography>Data Standards</Typography> |
| 61 | + <Typography>{nodeData.standard.join(",")}</Typography> |
| 62 | + </Grid> |
| 63 | + |
| 64 | + <Grid item xs={12}> |
| 65 | + <Typography>Upstream Contact</Typography> |
| 66 | + <Typography>{nodeData.support}</Typography> |
| 67 | + </Grid> |
| 68 | + |
| 69 | + <Grid item xs={12}> |
| 70 | + <Typography>NeuroJSON-Cuated Datasets</Typography> |
| 71 | + </Grid> |
| 72 | + </Grid> |
| 73 | + {/*database info card*/} |
| 74 | + <Card sx={{ mt:2, backgroundColor: Colors.white }}> |
| 75 | + <CardContent> |
| 76 | + <Grid container spacing={1}> |
| 77 | + <Grid item xs={12}> |
| 78 | + <Typography>NeuroJSON.io Database Name</Typography> |
| 79 | + <Typography></Typography> |
| 80 | + </Grid> |
| 81 | + <Grid item xs={12}> |
| 82 | + <Typography>REST-API URL</Typography> |
| 83 | + <Typography></Typography> |
| 84 | + </Grid> |
| 85 | + <Grid item xs={12}> |
| 86 | + <Typography>Database Creation Time</Typography> |
| 87 | + <Typography></Typography> |
| 88 | + </Grid> |
| 89 | + <Grid item xs={12}> |
| 90 | + <Typography>Searchable Database Size</Typography> |
| 91 | + <Typography></Typography> |
| 92 | + </Grid> |
| 93 | + <Grid item xs={12}> |
| 94 | + <Typography>DatabaseDisk Size_compressed</Typography> |
| 95 | + <Typography></Typography> |
| 96 | + </Grid> |
| 97 | + </Grid> |
| 98 | + </CardContent> |
| 99 | + <CardActions> |
| 100 | + <Grid container direction="column" spacing={1}> |
| 101 | + <Grid item xs={12}> |
| 102 | + <Button |
| 103 | + variant="contained" |
| 104 | + fullWidth |
| 105 | + sx={{ |
| 106 | + backgroundColor: Colors.primary.main, |
| 107 | + color: Colors.white, |
| 108 | + "&:hover": { |
| 109 | + backgroundColor: Colors.primary.dark, |
| 110 | + }, |
| 111 | + }} |
| 112 | + > |
| 113 | + Browse Database |
| 114 | + </Button> |
| 115 | + </Grid> |
| 116 | + <Grid item xs={12}> |
| 117 | + <Button |
| 118 | + variant="contained" |
| 119 | + fullWidth |
| 120 | + sx={{ |
| 121 | + backgroundColor: Colors.primary.main, |
| 122 | + color: Colors.white, |
| 123 | + "&:hover": { |
| 124 | + backgroundColor: Colors.primary.dark, |
| 125 | + }, |
| 126 | + }} |
| 127 | + > |
| 128 | + Search Subjects |
| 129 | + </Button> |
| 130 | + </Grid> |
| 131 | + <Grid item xs={12}> |
| 132 | + <Button |
| 133 | + variant="contained" |
| 134 | + fullWidth |
| 135 | + sx={{ |
| 136 | + backgroundColor: Colors.primary.main, |
| 137 | + color: Colors.white, |
| 138 | + "&:hover": { |
| 139 | + backgroundColor: Colors.primary.dark, |
| 140 | + }, |
| 141 | + }} |
| 142 | + > |
| 143 | + Advanced Search |
| 144 | + </Button> |
| 145 | + </Grid> |
| 146 | + <Grid item xs={12}> |
| 147 | + <Button |
| 148 | + variant="contained" |
| 149 | + fullWidth |
| 150 | + sx={{ |
| 151 | + backgroundColor: Colors.primary.main, |
| 152 | + color: Colors.white, |
| 153 | + "&:hover": { |
| 154 | + backgroundColor: Colors.primary.dark, |
| 155 | + }, |
| 156 | + }} |
| 157 | + > |
| 158 | + DownLoad Database |
| 159 | + </Button> |
| 160 | + </Grid> |
| 161 | + </Grid> |
| 162 | + </CardActions> |
| 163 | + |
| 164 | + </Card> |
| 165 | + {/* <Box display="flex" flexDirection="column"> |
| 166 | + <Box> |
| 167 | + <Typography><strong>NeuroJSON.io Database Name</strong></Typography> |
| 168 | + <Typography><strong>REST-API URL</strong></Typography> |
| 169 | + <Typography><strong>Database Creation Time</strong></Typography> |
| 170 | + <Typography><strong>Searchable Database Size</strong></Typography> |
| 171 | + <Typography><strong>DatabaseDisk Size_compressed</strong></Typography> |
| 172 | + </Box> |
| 173 | + </Box> */} |
| 174 | + </> |
| 175 | + ) : ( |
| 176 | + <Typography>Select a node to see metadata.</Typography> |
| 177 | + )} |
| 178 | + </Box> |
| 179 | + </Drawer> |
| 180 | + ) |
| 181 | +}; |
| 182 | + |
| 183 | +export default NodeInfoPanel; |
0 commit comments