Skip to content

Commit 1cd8f25

Browse files
committed
added default user image for anonymous users
1 parent 0592f57 commit 1cd8f25

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

src/gists/gistoptions.screen.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ const GistOptions = ({ onDelete, onCancel }) => (
1616
<Text style={{ color: colors.red, fontSize: 18, fontStyle: '600' }}>Delete</Text>
1717
</TouchableOpacity>
1818
<TouchableOpacity
19-
style={{ padding: '4%', fontStyle: '600' }}
19+
style={{ padding: '4%' }}
2020
onPress={onCancel}>
21-
<Text style={{ color: colors.pictonBlue, fontSize: 18 }}>Cancel</Text>
21+
<Text style={{ color: colors.pictonBlue, fontSize: 18, fontStyle: '600' }}>Cancel</Text>
2222
</TouchableOpacity>
2323
</View>
2424
</View>

src/gists/gists.reducer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const setFavoriteValue = (state, { payload }) => {
6363
return {
6464
...state,
6565
isStarred: value,
66+
inProgress: false,
6667
};
6768
};
6869

@@ -103,5 +104,6 @@ export default {
103104
),
104105
initialFavoriteValue: createReducer({
105106
[fetchInitialFavoriteValue.successType]: setFavoriteValue,
106-
}, { isStarred: false }),
107+
[fetchInitialFavoriteValue.progressType]: setInProgressState,
108+
}, { isStarred: false, inProgress: false }),
107109
};

src/gists/gists.saga.js

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ function* fetchCommentsForGist(action) {
9494
function* starAGist(action) {
9595
try {
9696
const token = yield select(tokenSelector);
97+
98+
yield put(starGist.progress());
9799
const status = yield call(requestStarGist, token, action.payload);
98100

99101
if (status === 204) {

src/gists/screens/components/GistDetailHeader.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import isEmpty from 'lodash/isEmpty';
44
import moment from 'moment';
55
import fileSize from 'filesize';
66
import { colors, normalizeFont } from '../../../config';
7-
// import defaultUserImage from '../../assets/default_user_image.png';
7+
import defaultUserImage from '../../../assets/default_user_image.png';
88

99
const Container = styled.View`
1010
display: flex;
@@ -46,7 +46,7 @@ export default GistDetailsHeader = ({
4646
}) => {
4747
return (
4848
<Container>
49-
<Avatar source={userImage ? { uri: userImage } : ''} />
49+
<Avatar source={userImage ? { uri: userImage } : defaultUserImage} />
5050
<DetailsContainer>
5151
<Title numberOfLines={2}>
5252
{userName}

src/gists/screens/gistdetails.screen.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,16 @@ class GistDetails extends React.Component {
7171
renderToobarContent = () => {
7272
return (
7373
<ToolbarContentContainer>
74-
<TouchableOpacity onPress={this.handleActionButtonClick}>
75-
<Icon
76-
name={this.state.iconName}
77-
size={20}
78-
/>
79-
</TouchableOpacity>
74+
{!this.props.inProgress &&
75+
(
76+
<TouchableOpacity onPress={this.handleActionButtonClick}>
77+
<Icon
78+
name={this.state.iconName}
79+
size={20}
80+
/>
81+
</TouchableOpacity>
82+
)
83+
}
8084
<Icon
8185
name="globe"
8286
size={20}
@@ -122,6 +126,9 @@ const mapDispatchToProps = dispatch => ({
122126
});
123127

124128
const mapStateToProps = ({ initialFavoriteValue }) =>
125-
({ isStarred: initialFavoriteValue.isStarred });
129+
({
130+
isStarred: initialFavoriteValue.isStarred,
131+
inProgress: initialFavoriteValue.inProgress,
132+
});
126133

127134
export default connect(mapStateToProps, mapDispatchToProps)(GistDetails);

0 commit comments

Comments
 (0)