diff --git a/app/components/projects/ProjectItem.js b/app/components/projects/ProjectItem.js index b23b0bb..788adfd 100644 --- a/app/components/projects/ProjectItem.js +++ b/app/components/projects/ProjectItem.js @@ -1,6 +1,7 @@ import React from 'react-native'; import GlobalStyles from '../../settings/styles'; import { getProjectRecentBuilds } from '../../api/CircleCI'; +import moment from 'moment'; const { View, @@ -22,10 +23,10 @@ const styles = StyleSheet.create({ repoCell: { paddingHorizontal: 4, paddingVertical: 3, - flex: 0.74 + flex: 0.84 }, buildCell: { - flex: 0.35, + flex: 0.25, paddingHorizontal: 6, paddingVertical: 3, borderLeftColor: GlobalStyles.get('CIRCLE_ITEM_BORDER'), @@ -66,10 +67,10 @@ export default class ProjectItem extends React.Component { const buildTime = minutes + ':' + seconds; const commit = mostRecentBuild.all_commit_details[0]; return ( - - T: { buildTime } - B: { commit.branch } + #{ mostRecentBuild.build_num } + D: { buildTime } + C: { commit.commit.substring(0, 6) } ); } @@ -78,23 +79,26 @@ export default class ProjectItem extends React.Component { console.log(this.props.userDetails); const project = this.props.project; const mostRecentBuild = this.state.recentBuild; - const statusColour = mostRecentBuild.failed ? + const master = project.branches[project.default_branch].recent_builds[0]; + const statusColour = master.outcome === 'failed' ? GlobalStyles.get('CIRCLE_TEST_FAIL') : GlobalStyles.get('CIRCLE_TEST_PASS'); - let username; - if (this.props.userDetails && this.props.userDetails.login !== project.username) { - username = project.username + '/'; - } + const username = this.props.userDetails && this.props.userDetails.login !== project.username ? + (U: {project.username}) : null; + + const language = project.language ? + (L: {project.language}) : null; + const buildDetails = mostRecentBuild ? this._displayMoreInfo(mostRecentBuild) : null; return ( - {username}{project.reponame} - - - { buildDetails } + {project.reponame} + { username } + { language } + { buildDetails } );