Skip to content

Commit

Permalink
fix: show org name instead of individual dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik committed Apr 27, 2020
1 parent 9cb7522 commit ddfe97d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 44 deletions.
46 changes: 26 additions & 20 deletions client/src/components/appCards/AppCardItem.jsx
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -40,6 +27,11 @@ const AppItem = props => {
height: '190px',
}

let developerNameToShow = developer.organisation
if (!developerNameToShow) {
developerNameToShow = developer.name ? developer.name : 'Unspecified'
}

return (
<div data-test="app-card">
<Card style={{ height: '100%' }}>
Expand All @@ -50,8 +42,9 @@ const AppItem = props => {
title={<Link to={`/app/${id}`}>{name}</Link>}
subtitle={
<span>
{developer.name ? developer.name : 'Unspecified'}{' '}
<br /> {config.ui.appTypeToDisplayName[appType]}{' '}
{developerNameToShow}
<br />
{config.ui.appTypeToDisplayName[appType]}{' '}
</span>
}
/>
Expand All @@ -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
30 changes: 6 additions & 24 deletions client/src/components/appView/AppView.jsx
Original file line number Diff line number Diff line change
@@ -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: {
Expand All @@ -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 = (
<div>
Type: {config.ui.appTypeToDisplayName[app.appType]} <br />
Author: {app.developer.name} <br />
Organisation: {app.developer.organisation}{' '}
</div>
)
Expand Down Expand Up @@ -119,7 +99,9 @@ class AppView extends Component {
}

AppView.propTypes = {
loadApp: PropTypes.func.isRequired,
app: PropTypes.object,
match: PropTypes.object,
}

const mapStateToProps = (state, ownProps) => ({
Expand Down

0 comments on commit ddfe97d

Please sign in to comment.