This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
Sphere/app/components/routes/project-details.js

69 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2016-03-11 11:53:55 +00:00
import React from 'react-native';
import loaderHandler from 'react-native-busy-indicator/LoaderHandler';
2016-03-11 20:56:26 +00:00
import BuildList from '../builds/BuildList';
2016-03-11 11:53:55 +00:00
import GlobalStyles from '../../settings/styles';
const {
StyleSheet,
View,
2016-03-11 20:56:26 +00:00
Text,
2016-03-11 11:53:55 +00:00
} = React;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: GlobalStyles.get('CIRCLE_BG')
},
title: {
fontSize: GlobalStyles.get('TITLE_FONT_SIZE'),
textAlign: 'center'
},
statusHeading: {
fontSize: 18,
textAlign: 'center'
2016-03-11 20:56:26 +00:00
},
statusRow: {
flexDirection: 'row',
alignItems: 'center',
alignSelf: 'center',
},
panel: {
alignItems: 'stretch',
borderBottomColor: GlobalStyles.get('CIRCLE_NAVBAR_TEXT'),
borderBottomWidth: 2,
paddingVertical: 10
2016-03-11 11:53:55 +00:00
}
});
export default class ProjectDetails extends React.Component {
constructor(props) {
super(props);
this.state = {
2016-03-11 20:56:26 +00:00
project: props.currentRoute.props.project,
recentBuilds: false
2016-03-11 11:53:55 +00:00
};
}
2016-03-11 20:56:26 +00:00
componentWillMount() {
2016-03-13 21:43:35 +00:00
loaderHandler.showLoader('Fetching');
2016-03-11 20:56:26 +00:00
}
2016-03-11 11:53:55 +00:00
render() {
2016-03-11 20:56:26 +00:00
const master = this.state.project.branches[this.state.project.default_branch].recent_builds[0];
const statusStyle = { color: GlobalStyles.get('CIRCLE_TEST_COLOURS').get(master.outcome.toUpperCase()) };
2016-03-11 11:53:55 +00:00
return (
<View style={styles.container}>
2016-03-11 20:56:26 +00:00
<View style={styles.panel}>
<Text style={styles.title}>Recent Builds</Text>
<View style={styles.statusRow}>
<Text style={styles.statusHeading}>Status: </Text>
<Text style={[styles.statusHeading, statusStyle]}>{master.outcome}</Text>
</View>
</View>
2016-03-13 19:28:22 +00:00
<BuildList builds={this.state.recentBuilds} project={this.state.project}/>
2016-03-11 11:53:55 +00:00
</View>
);
}
};