From b4bdf9fde013bb7ff9579693b64ff575f7b00e44 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Tue, 7 Jul 2020 09:55:10 +0200 Subject: Rename simulations to projects and remove experiment view --- frontend/src/components/projects/FilterButton.js | 24 ++++++++++++ frontend/src/components/projects/FilterPanel.js | 13 +++++++ frontend/src/components/projects/FilterPanel.sass | 5 +++ .../projects/NewProjectButtonComponent.js | 17 +++++++++ .../components/projects/ProjectActionButtons.js | 37 +++++++++++++++++++ .../src/components/projects/ProjectAuthList.js | 43 ++++++++++++++++++++++ frontend/src/components/projects/ProjectAuthRow.js | 32 ++++++++++++++++ 7 files changed, 171 insertions(+) create mode 100644 frontend/src/components/projects/FilterButton.js create mode 100644 frontend/src/components/projects/FilterPanel.js create mode 100644 frontend/src/components/projects/FilterPanel.sass create mode 100644 frontend/src/components/projects/NewProjectButtonComponent.js create mode 100644 frontend/src/components/projects/ProjectActionButtons.js create mode 100644 frontend/src/components/projects/ProjectAuthList.js create mode 100644 frontend/src/components/projects/ProjectAuthRow.js (limited to 'frontend/src/components/projects') diff --git a/frontend/src/components/projects/FilterButton.js b/frontend/src/components/projects/FilterButton.js new file mode 100644 index 00000000..664f9b46 --- /dev/null +++ b/frontend/src/components/projects/FilterButton.js @@ -0,0 +1,24 @@ +import classNames from 'classnames' +import PropTypes from 'prop-types' +import React from 'react' + +const FilterButton = ({ active, children, onClick }) => ( + +) + +FilterButton.propTypes = { + active: PropTypes.bool.isRequired, + children: PropTypes.node.isRequired, + onClick: PropTypes.func.isRequired, +} + +export default FilterButton diff --git a/frontend/src/components/projects/FilterPanel.js b/frontend/src/components/projects/FilterPanel.js new file mode 100644 index 00000000..0970f573 --- /dev/null +++ b/frontend/src/components/projects/FilterPanel.js @@ -0,0 +1,13 @@ +import React from 'react' +import FilterLink from '../../containers/projects/FilterLink' +import './FilterPanel.css' + +const FilterPanel = () => ( +
+ All Projects + My Projects + Shared with me +
+) + +export default FilterPanel diff --git a/frontend/src/components/projects/FilterPanel.sass b/frontend/src/components/projects/FilterPanel.sass new file mode 100644 index 00000000..f71cf6c8 --- /dev/null +++ b/frontend/src/components/projects/FilterPanel.sass @@ -0,0 +1,5 @@ +.filter-panel + display: flex + + button + flex: 1 !important diff --git a/frontend/src/components/projects/NewProjectButtonComponent.js b/frontend/src/components/projects/NewProjectButtonComponent.js new file mode 100644 index 00000000..3ddef5e5 --- /dev/null +++ b/frontend/src/components/projects/NewProjectButtonComponent.js @@ -0,0 +1,17 @@ +import PropTypes from 'prop-types' +import React from 'react' + +const NewProjectButtonComponent = ({ onClick }) => ( +
+
+ + New Project +
+
+) + +NewProjectButtonComponent.propTypes = { + onClick: PropTypes.func.isRequired, +} + +export default NewProjectButtonComponent diff --git a/frontend/src/components/projects/ProjectActionButtons.js b/frontend/src/components/projects/ProjectActionButtons.js new file mode 100644 index 00000000..456dd6b6 --- /dev/null +++ b/frontend/src/components/projects/ProjectActionButtons.js @@ -0,0 +1,37 @@ +import PropTypes from 'prop-types' +import React from 'react' +import { Link } from 'react-router-dom' + +const ProjectActionButtons = ({ projectId, onViewUsers, onDelete }) => ( + + + + +
onViewUsers(projectId)} + > + +
+
onDelete(projectId)} + > + +
+ +) + +ProjectActionButtons.propTypes = { + projectId: PropTypes.string.isRequired, + onViewUsers: PropTypes.func, + onDelete: PropTypes.func, +} + +export default ProjectActionButtons diff --git a/frontend/src/components/projects/ProjectAuthList.js b/frontend/src/components/projects/ProjectAuthList.js new file mode 100644 index 00000000..5a2c6695 --- /dev/null +++ b/frontend/src/components/projects/ProjectAuthList.js @@ -0,0 +1,43 @@ +import PropTypes from 'prop-types' +import React from 'react' +import Shapes from '../../shapes/index' +import ProjectAuthRow from './ProjectAuthRow' + +const ProjectAuthList = ({ authorizations }) => { + return ( +
+ {authorizations.length === 0 ? ( +
+ + No projects here yet... Add some with the 'New + Project' button! +
+ ) : ( + + + + + + + + + + {authorizations.map(authorization => ( + + ))} + +
Project nameLast editedAccess rights +
+ )} +
+ ) +} + +ProjectAuthList.propTypes = { + authorizations: PropTypes.arrayOf(Shapes.Authorization).isRequired, +} + +export default ProjectAuthList diff --git a/frontend/src/components/projects/ProjectAuthRow.js b/frontend/src/components/projects/ProjectAuthRow.js new file mode 100644 index 00000000..be9de6e0 --- /dev/null +++ b/frontend/src/components/projects/ProjectAuthRow.js @@ -0,0 +1,32 @@ +import classNames from 'classnames' +import React from 'react' +import ProjectActions from '../../containers/projects/ProjectActions' +import Shapes from '../../shapes/index' +import { AUTH_DESCRIPTION_MAP, AUTH_ICON_MAP } from '../../util/authorizations' +import { parseAndFormatDateTime } from '../../util/date-time' + +const ProjectAuthRow = ({ projectAuth }) => ( + + {projectAuth.project.name} + + {parseAndFormatDateTime(projectAuth.project.datetimeLastEdited)} + + + + {AUTH_DESCRIPTION_MAP[projectAuth.authorizationLevel]} + + + +) + +ProjectAuthRow.propTypes = { + projectAuth: Shapes.Authorization.isRequired, +} + +export default ProjectAuthRow -- cgit v1.2.3