Skip to content

Commit f6f8445

Browse files
committed
Merge remote-tracking branch 'upstream/master' into add-notifications-reducer-tests
2 parents a701604 + 5e33fee commit f6f8445

File tree

9 files changed

+124
-129
lines changed

9 files changed

+124
-129
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
__tests__/**
22
testenv.js
3+
coverage/**

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ cache:
66
node_js:
77
- 7
88
script:
9-
- yarn run test
9+
- yarn run test:coverage
1010
- yarn run eslint

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
## Introduction
4141

4242
[![Build Status](https://img.shields.io/travis/gitpoint/git-point.svg?style=flat-square)](https://travis-ci.org/gitpoint/git-point)
43+
[![Coveralls](https://img.shields.io/coveralls/github/gitpoint/git-point.svg?style=flat-square)](https://coveralls.io/github/gitpoint/git-point)
4344
[![All Contributors](https://img.shields.io/badge/all_contributors-59-orange.svg?style=flat-square)](#contributors)
4445
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
4546
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/)

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"prettier": "prettier --write \"**/*.js\"",
2424
"test": "jest",
2525
"test:watch": "jest --watch",
26+
"test:coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls",
2627
"flow-start": "flow start",
2728
"flow-stop": "flow stop",
2829
"flow-status": "flow status",
@@ -106,6 +107,7 @@
106107
"babel-preset-flow": "^6.23.0",
107108
"babel-preset-react-native": "1.9.1",
108109
"concurrently": "^3.5.0",
110+
"coveralls": "^3.0.0",
109111
"cz-conventional-changelog": "^2.0.0",
110112
"doctoc": "^1.3.0",
111113
"eslint": "^3.19.0",

src/components/badge.component.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ type Props = {
1212

1313
const BadgeContainer = styled.View`
1414
flex: 1;
15-
align-items: 'center';
16-
justify-content: 'center';
15+
align-items: center;
16+
justify-content: center;
1717
border-radius: 18;
1818
width: 18;
1919
height: 18;
@@ -24,7 +24,7 @@ const BadgeContainer = styled.View`
2424

2525
const BadgeText = styled.Text`
2626
${{ ...fonts.fontPrimaryBold }};
27-
background-color: 'transparent';
27+
background-color: transparent;
2828
${({ largeText }) =>
2929
`font-size: ${largeText ? normalize(9.5) : normalize(7)};`};
3030
`;

src/components/entity-info.component.js

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { StyleSheet } from 'react-native';
2+
import styled from 'styled-components/native';
33
import { ListItem } from 'react-native-elements';
44
import Communications from 'react-native-communications';
55

@@ -14,31 +14,18 @@ type Props = {
1414
navigation: Object,
1515
};
1616

17-
const styles = StyleSheet.create({
18-
badge: {
19-
padding: 12,
20-
paddingTop: 3,
21-
paddingBottom: 3,
22-
borderRadius: 20,
23-
},
24-
mergedIssue: {
25-
backgroundColor: colors.purple,
26-
},
27-
openIssue: {
28-
backgroundColor: colors.green,
29-
},
30-
closedIssue: {
31-
backgroundColor: colors.red,
32-
},
33-
listTitle: {
17+
const StyledListItem = styled(ListItem).attrs({
18+
titleStyle: {
3419
color: colors.black,
3520
...fonts.fontPrimary,
3621
},
37-
listSubTitle: {
22+
subtitleStyle: {
3823
color: colors.greyDark,
3924
...fonts.fontPrimary,
4025
},
41-
});
26+
underlayColor: props => (props.unknown ? null : colors.greyLight),
27+
hideChevron: props => props.unknown,
28+
})``;
4229

4330
const getBlogLink = url =>
4431
url.substr(0, 4) === 'http' ? url : `http://${url}`;
@@ -78,73 +65,59 @@ export const EntityInfo = ({ entity, orgs, locale, navigation }: Props) => {
7865
<SectionList title={translate('common.info', locale)}>
7966
{!!entity.company &&
8067
entity.company !== '' && (
81-
<ListItem
68+
<StyledListItem
8269
title={translate('common.company', locale)}
83-
titleStyle={styles.listTitle}
8470
leftIcon={{
8571
name: 'organization',
8672
color: colors.grey,
8773
type: 'octicon',
8874
}}
8975
subtitle={entity.company}
90-
subtitleStyle={styles.listSubTitle}
9176
onPress={() => navigateToCompany(entity.company, orgs, navigation)}
92-
underlayColor={
93-
companyInOrgs(entity.company, orgs) ? colors.greyLight : null
94-
}
95-
hideChevron={!companyInOrgs(entity.company, orgs)}
77+
unknown={companyInOrgs(entity.company, orgs)}
9678
/>
9779
)}
9880

9981
{!!entity.location &&
10082
entity.location !== '' && (
101-
<ListItem
83+
<StyledListItem
10284
title={translate('common.location', locale)}
103-
titleStyle={styles.listTitle}
10485
leftIcon={{
10586
name: 'location',
10687
color: colors.grey,
10788
type: 'octicon',
10889
}}
10990
subtitle={entity.location}
110-
subtitleStyle={styles.listSubTitle}
11191
onPress={() => Communications.web(getLocationLink(entity.location))}
112-
underlayColor={colors.greyLight}
11392
/>
11493
)}
11594

11695
{!!entity.email &&
11796
entity.email !== '' && (
118-
<ListItem
97+
<StyledListItem
11998
title={translate('common.email', locale)}
120-
titleStyle={styles.listTitle}
12199
leftIcon={{
122100
name: 'mail',
123101
color: colors.grey,
124102
type: 'octicon',
125103
}}
126104
subtitle={entity.email}
127-
subtitleStyle={styles.listSubTitle}
128105
onPress={() =>
129106
Communications.email([entity.email], null, null, null, null)}
130-
underlayColor={colors.greyLight}
131107
/>
132108
)}
133109

134110
{!!entity.blog &&
135111
entity.blog !== '' && (
136-
<ListItem
112+
<StyledListItem
137113
title={translate('common.website', locale)}
138-
titleStyle={styles.listTitle}
139114
leftIcon={{
140115
name: 'link',
141116
color: colors.grey,
142117
type: 'octicon',
143118
}}
144119
subtitle={entity.blog}
145-
subtitleStyle={styles.listSubTitle}
146120
onPress={() => Communications.web(getBlogLink(entity.blog))}
147-
underlayColor={colors.greyLight}
148121
/>
149122
)}
150123
</SectionList>
Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,46 @@
11
import React, { Component } from 'react';
2-
import {
3-
StyleSheet,
4-
Image,
5-
View,
6-
Modal,
7-
Dimensions,
8-
TouchableOpacity,
9-
TouchableHighlight,
10-
} from 'react-native';
2+
import { Image, Modal, Dimensions } from 'react-native';
113
import { Icon } from 'react-native-elements';
4+
import styled from 'styled-components/native';
125
import PhotoView from 'react-native-photo-view';
136

147
import { colors } from 'config';
158

16-
const styles = StyleSheet.create({
17-
touchable: {
18-
justifyContent: 'center',
19-
alignItems: 'center',
20-
},
21-
modalContainer: {
22-
flex: 1,
23-
backgroundColor: colors.black,
24-
justifyContent: 'center',
25-
alignItems: 'center',
26-
},
27-
closeButton: {
28-
position: 'absolute',
29-
top: 30,
30-
right: 10,
31-
},
32-
});
9+
const Touchable = styled.TouchableHighlight`
10+
justify-content: center;
11+
align-items: center;
12+
`;
13+
14+
const ModalContainer = styled.View`
15+
flex: 1;
16+
background-color: ${colors.black};
17+
justify-content: center;
18+
align-items: center;
19+
`;
20+
21+
const StyledPhotoView = styled(PhotoView).attrs({
22+
resizeMode: 'contain',
23+
minimumZoomScale: 0.5,
24+
maximumZoomScale: 3,
25+
})`
26+
width: ${Dimensions.get('window').width}px;
27+
height: ${Dimensions.get('window').height}px;
28+
`;
29+
30+
const CloseButton = styled.TouchableOpacity.attrs({
31+
activeOpacity: 0.5,
32+
})`
33+
position: absolute;
34+
top: 30px;
35+
right: 10px;
36+
`;
37+
38+
const CloseIcon = styled(Icon).attrs({
39+
color: colors.white,
40+
size: 28,
41+
name: 'x',
42+
type: 'octicon',
43+
})``;
3344

3445
export class ImageZoom extends Component {
3546
props: {
@@ -53,42 +64,26 @@ export class ImageZoom extends Component {
5364
}
5465

5566
render() {
56-
const window = Dimensions.get('window');
5767
const { uri, style } = this.props;
5868

5969
if (this.state.imgZoom) {
6070
return (
6171
<Modal animationType={'fade'} onRequestClose={() => this.closeModal()}>
62-
<View style={styles.modalContainer}>
63-
<PhotoView
64-
resizeMode={'contain'}
65-
onTap={() => this.closeModal()}
66-
source={uri}
67-
minimumZoomScale={0.5}
68-
maximumZoomScale={3}
69-
style={{ width: window.width, height: window.height }}
70-
/>
72+
<ModalContainer>
73+
<StyledPhotoView onTap={() => this.closeModal()} source={uri} />
7174

72-
<TouchableOpacity
73-
activeOpacity={0.5}
74-
onPress={() => this.closeModal()}
75-
style={styles.closeButton}
76-
>
77-
<Icon color={colors.white} size={28} name="x" type="octicon" />
78-
</TouchableOpacity>
79-
</View>
75+
<CloseButton onPress={() => this.closeModal()}>
76+
<CloseIcon />
77+
</CloseButton>
78+
</ModalContainer>
8079
</Modal>
8180
);
8281
}
8382

8483
return (
85-
<TouchableHighlight
86-
onPress={() => this.openModal()}
87-
underlayColor="transparent"
88-
style={styles.touchable}
89-
>
84+
<Touchable onPress={() => this.openModal()} underlayColor="transparent">
9085
<Image style={style} source={uri} />
91-
</TouchableHighlight>
86+
</Touchable>
9287
);
9388
}
9489
}

src/components/mention-area.component.js

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
import React, { Component } from 'react';
22
import fuzzysort from 'fuzzysort';
3-
import {
4-
Text,
5-
View,
6-
TouchableOpacity,
7-
Animated,
8-
ScrollView,
9-
StyleSheet,
10-
} from 'react-native';
3+
import styled from 'styled-components/native';
4+
import { TouchableOpacity, Animated, ScrollView } from 'react-native';
115

126
import { animations, fonts, normalize } from 'config';
137

14-
const styles = StyleSheet.create({
15-
suggestionsRowContainer: {
16-
padding: 5,
17-
flexDirection: 'row',
18-
paddingRight: 15,
19-
paddingBottom: 15,
20-
},
21-
userDetailsBox: {
22-
flex: 1,
23-
margin: 5,
24-
},
25-
displayNameText: {
26-
fontSize: normalize(12),
27-
...fonts.fontPrimary,
28-
},
29-
realNameText: {
30-
fontSize: normalize(12),
31-
...fonts.fontPrimarySemiBold,
32-
},
33-
});
8+
const StyledAnimatedView = styled(Animated.View)`
9+
${({ style }) => style};
10+
`;
11+
12+
const SuggestionsRowContainer = styled.View`
13+
flex-direction: row;
14+
padding-top: 5;
15+
padding-left: 5;
16+
padding-right: 15;
17+
padding-bottom: 15;
18+
`;
19+
20+
const UserDetailsBox = styled.View`
21+
flex: 1;
22+
margin-left: 5;
23+
margin-right: 5;
24+
margin-top: 5;
25+
margin-bottom: 5;
26+
`;
27+
28+
const DisplayNameText = styled.Text`
29+
fontsize: ${normalize(12)};
30+
${fonts.fontPrimary};
31+
`;
3432

3533
export class MentionArea extends Component {
3634
props: {
@@ -149,11 +147,11 @@ export class MentionArea extends Component {
149147
key={user}
150148
onPress={() => this.onSuggestionTap(user, true)}
151149
>
152-
<View style={styles.suggestionsRowContainer}>
153-
<View style={styles.userDetailsBox}>
154-
<Text style={styles.displayNameText}>@{user}</Text>
155-
</View>
156-
</View>
150+
<SuggestionsRowContainer>
151+
<UserDetailsBox>
152+
<DisplayNameText>@{user}</DisplayNameText>
153+
</UserDetailsBox>
154+
</SuggestionsRowContainer>
157155
</TouchableOpacity>
158156
));
159157
}
@@ -167,13 +165,13 @@ export class MentionArea extends Component {
167165
}
168166

169167
return (
170-
<Animated.View
171-
style={[{ ...this.props.style }, { height: this.state.height }]}
168+
<StyledAnimatedView
169+
style={{ ...this.props.style, height: this.state.height }}
172170
>
173171
<ScrollView keyboardShouldPersistTaps="always">
174172
{this.state.tracking && this.renderSuggestionsRow(searched)}
175173
</ScrollView>
176-
</Animated.View>
174+
</StyledAnimatedView>
177175
);
178176
}
179177
}

0 commit comments

Comments
 (0)