Skip to content

Commit 68c87b7

Browse files
authored
Dataset page cleanup (#194)
* Removed Explore breadcrumb on Explore pages since it wasn't clickable and just took up space. * Moved action menu on dataset page to standalone file. Change position to left of breadcrumb. * Fixed file icon color in dataset table. * Split up action menu in dataset page into multiple buttons. * Moved dataset name and description to top left and made it bigger to make it more prominent. Replaced edit dataset name and description inline with modal. * Changed datasets menu icon to horizontal ellipses. * Moved delete folder action from dataset to folders/files table. * Added icons to menu items in dataset view. * Pretty print bytes using pretty-bytes library. * Fixed extra bytes in files table. * Updated package-lock.json.
1 parent 5952507 commit 68c87b7

File tree

15 files changed

+722
-20754
lines changed

15 files changed

+722
-20754
lines changed

frontend/package-lock.json

Lines changed: 97 additions & 20460 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"html-react-parser": "^3.0.4",
5050
"jquery": "^3.6.0",
5151
"jwt-decode": "^3.0.0",
52+
"pretty-bytes": "^6.0.0",
5253
"prop-types": "^15.7.2",
5354
"react": "^17.0.2",
5455
"react-dom": "^17.0.2",

frontend/src/components/Explore.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import {Box, Button, ButtonGroup, Grid, Tab, Tabs} from "@mui/material";
33

44
import {Dataset, RootState} from "../types/data";
55
import {useDispatch, useSelector} from "react-redux";
6-
import {datasetDeleted, fetchDatasets,} from "../actions/dataset";
6+
import {fetchDatasets} from "../actions/dataset";
77
import {resetFailedReason} from "../actions/common";
88
import {downloadThumbnail} from "../utils/thumbnail";
99

1010
import {a11yProps, TabPanel} from "./tabs/TabComponent";
11-
import {MainBreadcrumbs} from "./navigation/BreadCrumb";
1211
import {ActionModal} from "./dialog/ActionModal";
1312
import DatasetCard from "./datasets/DatasetCard";
1413
import config from "../app.config";
@@ -27,7 +26,6 @@ export const Explore = (): JSX.Element => {
2726

2827
// Redux connect equivalent
2928
const dispatch = useDispatch();
30-
const deleteDataset = (datasetId: string) => dispatch(datasetDeleted(datasetId));
3129
const listDatasets = (skip: number | undefined, limit: number | undefined, mine: boolean | undefined) => dispatch(fetchDatasets(skip, limit, mine));
3230
const dismissError = () => dispatch(resetFailedReason());
3331
const datasets = useSelector((state: RootState) => state.dataset.datasets);
@@ -117,26 +115,13 @@ export const Explore = (): JSX.Element => {
117115
}
118116
}, [skip]);
119117

120-
// for breadcrumb
121-
const paths = [
122-
{
123-
"name": "Explore",
124-
"url": "/",
125-
}
126-
];
127-
128118
return (
129119
<Layout>
130120
<div className="outer-container">
131121
{/*Error Message dialogue*/}
132122
<ActionModal actionOpen={errorOpen} actionTitle="Something went wrong..." actionText={reason}
133123
actionBtnName="Report" handleActionBtnClick={handleErrorReport}
134124
handleActionCancel={handleErrorCancel}/>
135-
<Box m={1} display="flex" justifyContent="space-between" alignItems="flex-end">
136-
<MainBreadcrumbs paths={paths}/>
137-
{/*<Button href="/create-dataset" variant="contained" sx={{display: "flex", alignItems: "center"}}>New*/}
138-
{/* Dataset</Button>*/}
139-
</Box>
140125
<div className="inner-container">
141126
<Grid container spacing={4}>
142127
<Grid item xs>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import {Button, Stack} from "@mui/material";
2+
import React from "react";
3+
import {datasetDownloaded} from "../../actions/dataset";
4+
import {useDispatch, useSelector} from "react-redux";
5+
import {RootState} from "../../types/data";
6+
import {Download} from "@mui/icons-material";
7+
import {NewMenu} from "./NewMenu";
8+
import {OtherMenu} from "./OtherMenu";
9+
10+
type ActionsMenuProps = {
11+
datasetId: string,
12+
folderId: string
13+
}
14+
15+
export const ActionsMenu = (props: ActionsMenuProps): JSX.Element => {
16+
const {datasetId, folderId} = props;
17+
18+
// redux
19+
const dispatch = useDispatch();
20+
21+
const downloadDataset = (datasetId: string | undefined, filename: string | undefined) => dispatch(datasetDownloaded(datasetId, filename))
22+
23+
// state
24+
const about = useSelector((state: RootState) => state.dataset.about);
25+
26+
return (
27+
<Stack direction="row"
28+
justifyContent="flex-end"
29+
alignItems="center"
30+
spacing={0.5}>
31+
<Button variant="contained"
32+
onClick={() => {
33+
downloadDataset(datasetId, about["name"]);
34+
}} endIcon={<Download/>}>
35+
Download
36+
</Button>
37+
<NewMenu datasetId={datasetId} folderId={folderId}/>
38+
<OtherMenu datasetId={datasetId} folderId={folderId}/>
39+
</Stack>)
40+
}

0 commit comments

Comments
 (0)