Skip to content

Conversation

@Bhuvneshwar-MB
Copy link
Contributor

I Have Implemented a Time r Component under components on Timer Screen

@MDHayes MDHayes self-requested a review April 30, 2020 14:05
Copy link
Member

@MDHayes MDHayes left a comment

Choose a reason for hiding this comment

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

Some feedback:

  • The name TimerComponent seems a little redundant in the components directory. Maybe change this to TimerButton?
  • Leads onto, this needs a TouchableOpacity wrapping it to start/stop the timer and state that monitors it being started. I think we can do the within the component, although it would give some added flexibility if we passed them in as props. What do you think?
  • We're using styles here differently than other places ie Vinod is using const { textContainerStyle, textStyle } = styles rather than styles.stylename
  • Remove console.log
  • Magic numbers in the timer, the code I suggested had the default set in config this is good practice and will help in future if we want to increase the timer.
  • I notice the colours are specific to where they are implemented... what if we changed our minds and want the green to be #52D9B3?

@Bhuvneshwar-MB
Copy link
Contributor Author

  • The name TimerComponent seems a little redundant in the components directory. Maybe change this to TimerButton? - Done

  • Leads onto, this needs a TouchableOpacity wrapping it to start/stop the timer and state that monitors it being started. I think we can do the within the component, although it would give some added flexibility if we passed them in as props. What do you think? - i think here is not any start.stop in UI so that i did that.

  • We're using styles here differently than other places ie Vinod is using const { textContainerStyle, textStyle } = styles rather than styles.stylename - done

  • Remove console.log - done

  • Magic numbers in the timer, the code I suggested had the default set in config this is good practice and will help in future if we want to increase the timer. - done

  • I notice the colours are specific to where they are implemented... what if we changed our minds and want the green to be #52D9B3? - if we want to change green color, definitely its changes to everywhere we used green color or if we want to add new color then we can do that. What you suggest?

@Bhuvneshwar-MB Bhuvneshwar-MB requested a review from MDHayes May 1, 2020 06:02
@Bhuvneshwar-MB
Copy link
Contributor Author

PR refreshed as now use only FontAwesome for icons.

Copy link
Member

@MDHayes MDHayes left a comment

Choose a reason for hiding this comment

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

This needs some more work. Comments inline with the code. Specifically I think this should be reusable on the home page.

You also asked about colors. I've been recommending we have colors generic rather than implementation specific. I think its always easier to add special cases than to have many colors.

I guess this comes down to preference but something to think about when doing colors in future.

Comment on lines 40 to 50
const renderTimer = () => {
return (
<View>
{timer === 0 ? (
<FontAwesome5 name={'thumbs-up'} size={30} color={white} />
) : (
<Text style={textSeconds}>{timer}</Text>
)}
</View>
)
}
Copy link
Member

Choose a reason for hiding this comment

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

Why are we doing a function like this? It should be in the main return or split out. I think this is small enough to put in the return?

Also this button should be reused on the home screen:

Screenshot 2020-05-01 at 08 45 28

That is why you need the TouchableOpcity on it. You would also need to make the icon here generic (was can pass in a name) and the text value changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At homeScreen we just need to show image. there are no progress needed and no state requires for the same. so that we use image at home screen and Circular progress on Timer screen.

Copy link
Member

Choose a reason for hiding this comment

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

I disagree. The home screen has an icon and text the same, same styling/spacing. I think we can make this one component.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok i have use same component for both Home Screen and Timer Screen by using props.

}
}, [timer])

const fill = 100 - timer * 5
Copy link
Member

Choose a reason for hiding this comment

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

Magic numbers here. What would happen to the animation if we changed the defaultTimer time to 40 seconds?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay then. What should i do?

Copy link
Member

Choose a reason for hiding this comment

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

Can you have a think about a solution first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what you think about this :

const fill = 100 - (timer * 100) / timerDefault

Copy link
Member

Choose a reason for hiding this comment

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

yeah that looks good.

@MDHayes
Copy link
Member

MDHayes commented May 1, 2020

@Bhuvneshwar-MB let me know when this is good to review. Also merge with develop so there's no conflicts in the PR.

@Bhuvneshwar-MB
Copy link
Contributor Author

I am working on conflicts. i thing some other branch merged in develop branch

@Bhuvneshwar-MB
Copy link
Contributor Author

Can you please review now?

@Bhuvneshwar-MB Bhuvneshwar-MB requested a review from MDHayes May 1, 2020 11:10
Copy link
Member

@MDHayes MDHayes left a comment

Choose a reason for hiding this comment

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

We can do a better job on making the TimerButton more reusable and not having functions returning JSX. Check with Vinod and see if you can work together to improve it, he improved the SelectCell a lot in a similar way.

Comment on lines 45 to 76
const renderCircularProgress = () => {
return (
<AnimatedCircularProgress
style={progressStyle}
size={200}
width={10}
fill={fill}
rotation={0}
tintColor={green}
backgroundColor={white}
>
{() => (
<View style={viewStyle}>
<Text style={textSeconds}>{timer}</Text>
<Text style={textSecondName}>{bottomText}</Text>
</View>
)}
</AnimatedCircularProgress>
)
}

const renderCircularView = () => {
return (
<View style={circularView}>
<FontAwesome name={image} size={30} color={white} />
<Text style={textSecondName}>{bottomText}</Text>
</View>
)
}

return (
<View style={container}>
Copy link
Member

Choose a reason for hiding this comment

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

This is something we've repeatedly asked not to have in the code. I think Vinod can maybe apply his learning from the SettingCell here, can he support you on this?

@Bhuvneshwar-MB
Copy link
Contributor Author

can you please review now?

@Bhuvneshwar-MB Bhuvneshwar-MB requested a review from MDHayes May 1, 2020 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants