Skip to content
This repository was archived by the owner on Sep 24, 2020. It is now read-only.

Merge button for PR screen#60

Open
brascene wants to merge 4 commits into
ovr:masterfrom
brascene:master
Open

Merge button for PR screen#60
brascene wants to merge 4 commits into
ovr:masterfrom
brascene:master

Conversation

@brascene

@brascene brascene commented Oct 7, 2017

Copy link
Copy Markdown

I've made UI for now, and later I can configure/add redux and api actions for merging.

Comment thread components/ImageButton/ImageButton.js Outdated
import { TouchableOpacity, StyleSheet, ImageBackground } from 'react-native';

type Props = {
children: Object,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React$Element

Comment thread components/Button/Button.js Outdated
onPress: () => any,
style?: ComponentStyles
style?: ComponentStyles,
textStyle: Object

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ComponentStyles

Comment thread components/Button/Button.js Outdated
return (
<TouchableOpacity onPress={onPress} style={[styles.button, style]}>
<UIText style={styles.text}>
<UIText style={textStyle !== {} ? textStyle : styles.text}>

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[styles.text, textStyle] m?

Comment thread components/ImageButton/ImageButton.js Outdated
export default class ImageButton extends PureComponent<Props> {
render() {
const { onPress } = this.props;
const image = require('../../assets/threeDots.png');

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use import, but will be better to use vector icons, we already use https://github.com/oblador/react-native-vector-icons

Comment thread components/ImageButton/ImageButton.js Outdated

const styles = StyleSheet.create({
imageBackground: {
width:50, height: 20, marginTop: 10,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every style must be on new line ;)

styleText={styles.buttonText}>
Close PR
</ImageButton>
<Modal

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use openModal instead of manually do modals

Comment thread package.json
".js"
]
}
"name": "ghubber",

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert ident for this file
Thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what to revert here?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, not needed to change this file (code indentation - spaces)

Comment thread .eslintrc Outdated
"ThunkAction": true,
"ActionType": true
"ActionType": true,
"require": true

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop, because not needed ;)

];
}

setModalVisible(visible) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove


class RepositoryPullRequestScreen extends PureComponent<Props> {
class RepositoryPullRequestScreen extends PureComponent<Props, ModalState> {
state: ModalState = {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

export default connect(
null,
{ addModal }
)(ImageButton);

@firec0der firec0der Oct 20, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connecting a component to the redux store w/o props passing is the wrong way.
Bind dispatch to addModal where you're rendering this component and pass it as a prop here. But seems like you don't use it here, so remove connecting at all.

@@ -0,0 +1,2 @@

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove this unnecessary empty line

<UIText style={styles.body}>{pullRequest.body}</UIText>
<ImageButton
style={styles.button}
onPress={() => this.props.addModal(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such kind of function passing is the anti-pattern.
Related reading

data={[{ type: 'merge' }]}
renderOption={
({ item }) => {
return (

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can omit it.

renderOption={({ item }) => (
    <TouchableOpacity
         key={item.type}
         style={styles.modalContent}
         onPress={() => { // <- remove this arrow function passing
             closeModal();
         }}
    >
        <Text style={styles.modalTitle}>Merge this pull request?</Text>
        <Button
            style={styles.deletePr}
            textStyle={styles.deletePrText}
            onPress={() => this.props.closeModal()} // <- remove this arrow function passing
        >
            Merge
        </Button>
    </TouchableOpacity>
)}

But, I do prefer extract this rendering to a separate function.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants