From c794561561c3fed7ddf3c536f19bbec4ef614369 Mon Sep 17 00:00:00 2001 From: RealOrangeOne Date: Thu, 17 Mar 2016 22:25:21 +0000 Subject: [PATCH] Add better status colour style management --- app/components/builds/BuildList.js | 5 ++--- app/components/projects/ProjectItem.js | 5 ++--- app/components/routes/project-details.js | 4 +--- app/settings/styles.js | 10 ++++++++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/components/builds/BuildList.js b/app/components/builds/BuildList.js index a8f9b3e..b8b9b0d 100644 --- a/app/components/builds/BuildList.js +++ b/app/components/builds/BuildList.js @@ -35,9 +35,8 @@ export default class BuildList extends React.Component { if (build.build_time_millis < 1) { return null; } - const statusColour = build.status === 'failed' ? - GlobalStyles.get('CIRCLE_TEST_FAIL') : - GlobalStyles.get('CIRCLE_TEST_PASS'); + const statusColour = GlobalStyles.get('CIRCLE_TEST_COLOURS').get(build.status.toUpperCase()); + console.log('status colour', statusColour); return ; } diff --git a/app/components/projects/ProjectItem.js b/app/components/projects/ProjectItem.js index 6c6fd6d..dd75307 100644 --- a/app/components/projects/ProjectItem.js +++ b/app/components/projects/ProjectItem.js @@ -98,9 +98,8 @@ export default class ProjectItem extends React.Component { const project = this.props.project; const mostRecentBuild = this.state.recentBuild; 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'); + + const statusColour = GlobalStyles.get('CIRCLE_TEST_COLOURS').get(master.outcome.toUpperCase()); const username = this.props.userDetails && this.props.userDetails.login !== project.username ? ( {project.username}) : null; diff --git a/app/components/routes/project-details.js b/app/components/routes/project-details.js index b13b822..bfd20ed 100644 --- a/app/components/routes/project-details.js +++ b/app/components/routes/project-details.js @@ -51,9 +51,7 @@ export default class ProjectDetails extends React.Component { render() { const master = this.state.project.branches[this.state.project.default_branch].recent_builds[0]; - const statusStyle = master.outcome === 'failed' ? - { color: GlobalStyles.get('CIRCLE_TEST_FAIL')} : - { color: GlobalStyles.get('CIRCLE_TEST_PASS')}; + const statusStyle = { color: GlobalStyles.get('CIRCLE_TEST_COLOURS').get(master.outcome.toUpperCase()) }; return ( diff --git a/app/settings/styles.js b/app/settings/styles.js index edbf776..43507c7 100644 --- a/app/settings/styles.js +++ b/app/settings/styles.js @@ -8,8 +8,14 @@ export default Map({ CIRCLE_TEXT: '#212121', CIRCLE_ITEM_BG: '#fff', CIRCLE_ITEM_BORDER: '#E5E5E5', - CIRCLE_TEST_FAIL: '#ED5C5C', - CIRCLE_TEST_PASS: '#42C88A', + + CIRCLE_TEST_COLOURS: Map({ + SUCCESS: '#42C88A', + FAILED: '#ED5C5C', + FIXED: '#42C88A', + RUNNING: '#66D3E4', + RETRIED: '#898989' + }), TITLE_FONT_SIZE: 24 });