Add better status colour style management

This commit is contained in:
Jake Howard 2016-03-17 22:25:21 +00:00
parent c31e186f94
commit c794561561
4 changed files with 13 additions and 11 deletions

View file

@ -35,9 +35,8 @@ export default class BuildList extends React.Component {
if (build.build_time_millis < 1) { if (build.build_time_millis < 1) {
return null; return null;
} }
const statusColour = build.status === 'failed' ? const statusColour = GlobalStyles.get('CIRCLE_TEST_COLOURS').get(build.status.toUpperCase());
GlobalStyles.get('CIRCLE_TEST_FAIL') : console.log('status colour', statusColour);
GlobalStyles.get('CIRCLE_TEST_PASS');
return <BuildItem build={build} project={this.props.project} statusColour={statusColour} />; return <BuildItem build={build} project={this.props.project} statusColour={statusColour} />;
} }

View file

@ -98,9 +98,8 @@ export default class ProjectItem extends React.Component {
const project = this.props.project; const project = this.props.project;
const mostRecentBuild = this.state.recentBuild; const mostRecentBuild = this.state.recentBuild;
const master = project.branches[project.default_branch].recent_builds[0]; const master = project.branches[project.default_branch].recent_builds[0];
const statusColour = master.outcome === 'failed' ?
GlobalStyles.get('CIRCLE_TEST_FAIL') : const statusColour = GlobalStyles.get('CIRCLE_TEST_COLOURS').get(master.outcome.toUpperCase());
GlobalStyles.get('CIRCLE_TEST_PASS');
const username = this.props.userDetails && this.props.userDetails.login !== project.username ? const username = this.props.userDetails && this.props.userDetails.login !== project.username ?
(<Text style={[styles.details, styles.mainDetails]}><Icon name="person" /> {project.username}</Text>) : null; (<Text style={[styles.details, styles.mainDetails]}><Icon name="person" /> {project.username}</Text>) : null;

View file

@ -51,9 +51,7 @@ export default class ProjectDetails extends React.Component {
render() { render() {
const master = this.state.project.branches[this.state.project.default_branch].recent_builds[0]; const master = this.state.project.branches[this.state.project.default_branch].recent_builds[0];
const statusStyle = master.outcome === 'failed' ? const statusStyle = { color: GlobalStyles.get('CIRCLE_TEST_COLOURS').get(master.outcome.toUpperCase()) };
{ color: GlobalStyles.get('CIRCLE_TEST_FAIL')} :
{ color: GlobalStyles.get('CIRCLE_TEST_PASS')};
return ( return (
<View style={styles.container}> <View style={styles.container}>
<View style={styles.panel}> <View style={styles.panel}>

View file

@ -8,8 +8,14 @@ export default Map({
CIRCLE_TEXT: '#212121', CIRCLE_TEXT: '#212121',
CIRCLE_ITEM_BG: '#fff', CIRCLE_ITEM_BG: '#fff',
CIRCLE_ITEM_BORDER: '#E5E5E5', 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 TITLE_FONT_SIZE: 24
}); });