SarthakKeshari / calc_for_everything

This repository aims to provide Calculators for educational, professional, scientific, health and well-being and other purposes.
https://calc-for-everything-psi.vercel.app
MIT License
113 stars 103 forks source link

Finished Potential Energy Calc + fixed buggy grav force calc #485

Closed IshaanShettigar closed 10 months ago

IshaanShettigar commented 10 months ago

Issue Id you have worked upon -

406

Briefly explain your program logic -

I have created two TextFields with the appropriate error messages in case the input is wrong. Created 3 main states to handle the two inputs + the output. Also created 4 pieces of state to handle the error state. (one for whether to show the error and one for the error message, both of these are applied to two inputs, mass and height).

Screenshots(Attach 2 screenshots of your own input and output) -

image

image


By raising this PR I affirm that -

SarthakKeshari commented 10 months ago

@IshaanShettigar, Kindly elaborate on the bug that you have fixed.

IshaanShettigar commented 10 months ago

It is the error that I mentioned at the end of my PR #443.

I noticed a small error where the Gravitational Force shows NaN N, instead of the error message, when the button is clicked once. (It shows the proper error message only when clicked twice). I apologize for this oversight. This error happened due to the fact that the parseFloat was async while the code that checks for the error is sync so I had to modify it a bit by using useEffect and it worked fine.

SarthakKeshari commented 10 months ago

@IshaanShettigar, No worries, thanks for mentioning the error and responsibly fixing the same.

SarthakKeshari commented 10 months ago

Congratulations 🎉 @IshaanShettigar on your contribution. Thanks for adding value to this repository. 😊

Let's celebrate this fest 😃 by providing more developers 👨‍💻👩‍💻 an opportunity to contribute. Help us make this repository reach far and more by sharing this to your friends and colleagues.

Your efforts can make difference.

SarthakKeshari commented 10 months ago

Hey 👋, may you also encourage us by clicking the star icon on the repository main page. ⭐

image