summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/components/projects/ProjectRow.js
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-13 16:35:01 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-17 17:06:50 +0200
commit1891a6f3963d3ddeae0ea093f9a7e3608a97b4d7 (patch)
tree5fe20a483d7e51e25a7e0759d21981e38844f139 /opendc-web/opendc-web-ui/src/components/projects/ProjectRow.js
parent24147cba0f5723be3525e8f40d1954144841629b (diff)
ui: Simplify projects page
This change simplifies the logic and components of the projects page and reduces its dependency on Redux for simple operations.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/components/projects/ProjectRow.js')
-rw-r--r--opendc-web/opendc-web-ui/src/components/projects/ProjectRow.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-ui/src/components/projects/ProjectRow.js b/opendc-web/opendc-web-ui/src/components/projects/ProjectRow.js
new file mode 100644
index 00000000..bc63c805
--- /dev/null
+++ b/opendc-web/opendc-web-ui/src/components/projects/ProjectRow.js
@@ -0,0 +1,24 @@
+import classNames from 'classnames'
+import React from 'react'
+import ProjectActions from '../../containers/projects/ProjectActions'
+import { Authorization } from '../../shapes/index'
+import { AUTH_DESCRIPTION_MAP, AUTH_ICON_MAP } from '../../util/authorizations'
+import { parseAndFormatDateTime } from '../../util/date-time'
+
+const ProjectRow = ({ projectAuth }) => (
+ <tr>
+ <td className="pt-3">{projectAuth.project.name}</td>
+ <td className="pt-3">{parseAndFormatDateTime(projectAuth.project.datetimeLastEdited)}</td>
+ <td className="pt-3">
+ <span className={classNames('fa', 'fa-' + AUTH_ICON_MAP[projectAuth.authorizationLevel], 'mr-2')} />
+ {AUTH_DESCRIPTION_MAP[projectAuth.authorizationLevel]}
+ </td>
+ <ProjectActions projectId={projectAuth.project._id} />
+ </tr>
+)
+
+ProjectRow.propTypes = {
+ projectAuth: Authorization.isRequired,
+}
+
+export default ProjectRow