From ddfe97da373cd801873d49bd2102cd5bf60d22fa Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 27 Apr 2020 09:37:51 +0200 Subject: [PATCH] fix: show org name instead of individual dev --- .../src/components/appCards/AppCardItem.jsx | 46 +++++++++++-------- client/src/components/appView/AppView.jsx | 30 +++--------- 2 files changed, 32 insertions(+), 44 deletions(-) diff --git a/client/src/components/appCards/AppCardItem.jsx b/client/src/components/appCards/AppCardItem.jsx index 74bbae371..eaa5ff74f 100644 --- a/client/src/components/appCards/AppCardItem.jsx +++ b/client/src/components/appCards/AppCardItem.jsx @@ -1,26 +1,13 @@ -import React from 'react' +// eslint-disable-next-line react/no-deprecated +import React, { PropTypes } from 'react' + import { Link } from 'react-router-dom' import config from '../../../config' -import { - Card, - CardMedia, - CardTitle, - CardText, - CardActions, -} from 'material-ui/Card' -import Button from 'material-ui/FlatButton' +import { Card, CardMedia, CardTitle } from 'material-ui/Card' import Theme from '../../styles/theme' const AppItem = props => { - const { - id, - name, - developer, - description, - appType, - images, - requiredDhisVersion, - } = props.app + const { id, name, developer, appType, images } = props.app const logo = images.find(elem => elem.logo) let backgroundImage = '' //svg-string for wallpaper @@ -40,6 +27,11 @@ const AppItem = props => { height: '190px', } + let developerNameToShow = developer.organisation + if (!developerNameToShow) { + developerNameToShow = developer.name ? developer.name : 'Unspecified' + } + return (
@@ -50,8 +42,9 @@ const AppItem = props => { title={{name}} subtitle={ - {developer.name ? developer.name : 'Unspecified'}{' '} -
{config.ui.appTypeToDisplayName[appType]}{' '} + {developerNameToShow} +
+ {config.ui.appTypeToDisplayName[appType]}{' '}
} /> @@ -60,4 +53,17 @@ const AppItem = props => { ) } +AppItem.propTypes = { + app: PropTypes.shape({ + appType: PropTypes.number, + developer: PropTypes.shape({ + name: PropTypes.string, + organisation: PropTypes.string, + }), + id: PropTypes.string, + images: PropTypes.array, + name: PropTypes.string, + }), +} + export default AppItem diff --git a/client/src/components/appView/AppView.jsx b/client/src/components/appView/AppView.jsx index 7dfe02956..bc43aa3be 100644 --- a/client/src/components/appView/AppView.jsx +++ b/client/src/components/appView/AppView.jsx @@ -1,24 +1,16 @@ +// eslint-disable-next-line react/no-deprecated import React, { Component, PropTypes } from 'react' import { connect } from 'react-redux' -import { - Card, - CardText, - CardTitle, - CardHeader, - CardMedia, -} from 'material-ui/Card' +import { Card, CardText, CardTitle, CardHeader } from 'material-ui/Card' import ImageViewer from './ImageViewer' import Subheader from '../header/SubHeader' import Grid from '../../material/Grid/Grid' import Col from '../../material/Grid/Col' -import { Link } from 'react-router-dom' -import { Redirect, Route } from 'react-router-dom' import VersionList from '../appVersion/VersionList' import { loadApp } from '../../actions/actionCreators' import config from '../../../config' import AppLogo from './AppLogo' import Theme from '../../styles/theme' -import { FadeAnimation } from '../utils/Animate' const styles = { appDescription: { @@ -42,23 +34,11 @@ class AppView extends Component { return null } - const { - id, - appName, - developer, - description, - images, - appType, - requiredDhisVersion, - lastUpdated, - } = app - const versions = app.versions.sort( - (a, b) => a.lastUpdated - b.lastUpdated - ) + const { description, images } = app + const subtitle = (
Type: {config.ui.appTypeToDisplayName[app.appType]}
- Author: {app.developer.name}
Organisation: {app.developer.organisation}{' '}
) @@ -119,7 +99,9 @@ class AppView extends Component { } AppView.propTypes = { + loadApp: PropTypes.func.isRequired, app: PropTypes.object, + match: PropTypes.object, } const mapStateToProps = (state, ownProps) => ({