Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted Main.js to a functional component #365

Merged
merged 7 commits into from
Aug 28, 2021

Conversation

ashutosh1297
Copy link
Contributor

Pull request in resolution of issue #363

@vercel
Copy link

vercel bot commented May 9, 2021

Someone is attempting to deploy a commit to a Personal Account owned by @saadpasta on Vercel.

@saadpasta first needs to authorize it.

Copy link
Collaborator

@kartikcho kartikcho left a comment

Choose a reason for hiding this comment

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

Looks good. Just need to address a couple of comments and fix the formatting check to get this in!

src/containers/Main.js Outdated Show resolved Hide resolved
src/containers/Main.js Outdated Show resolved Hide resolved
@kartikcho
Copy link
Collaborator

@ashutosh1297 can you address the requested changes and then rebase #366 to reflect these changes.

@ashutosh1297
Copy link
Contributor Author

Ah sorry, my bad! I had typed the response but forgot to submit review. Please check my response and let me know how to proceed. Thanks! @kartikcho

@kartikcho
Copy link
Collaborator

It's all good @ashutosh1297, I've added a new comment with a more optimal solution than the one we have been using. This should also slightly improve performance of our app.

@ashutosh1297
Copy link
Contributor Author

@kartikcho I moved the whole localStorage logic to a custom hook, checkout the new commit for updates.

Keeping the context API to share theme state through the component tree seems like a better idea than using localStorage calls everywhere, can you elaborate on how you were planning of getting rid of the context API?

PS - sorry about the delay in replies, I am a little caught up with work but I will try and wrap this up soon

Copy link
Collaborator

@kartikcho kartikcho left a comment

Choose a reason for hiding this comment

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

No worries, thanks for the update!
In hindsight, I thought we could move away from Context altogether and check for the localStorage key where ever we need the dark mode flag. Thinking about it now, it might cause needless overhead.
Lets scratch that idea and stick with Context calls.

@kartikcho
Copy link
Collaborator

Hey @ashutosh1297, could you run prettier on this branch to fix the checks?

@naveen521kk
Copy link
Collaborator

It's very bad that prettier doesn't show the file diff. Let me see if I can fix it.

@naveen521kk
Copy link
Collaborator

naveen521kk commented Jun 2, 2021

It's very bad that prettier doesn't show the file diff. Let me see if I can fix it.

Can we set up pre-commit https://prettier.io/docs/en/precommit.html#option-3-pre-commithttpsgithubcompre-commitpre-commit? I usually use it other python project it works and I can setup Github Actions to run that and output the diff. Tbh, I can't find a better idea looking at the docs or there is a bot which will automatically commit if there are file diff https://pre-commit.ci/

@kartikcho
Copy link
Collaborator

I have used Husky in the past for adding a pre commit hook but it's a hit or miss honestly, it only works correctly for some git users.
https://pre-commit.ci/ looks promising and if we can set it up, that'd be great too. Anyway, @naveen521kk we should log the errors from the prettier gh action.
Also @ashutosh1297, the check is still failing 😅

@naveen521kk
Copy link
Collaborator

https://pre-commit.ci/ looks promising and if we can set it up, that'd be great too.

Should be simple enough that @saadpasta should install a Github App as instructed there. I will make a PR for adding pre-commit config then :).

@saadpasta
Copy link
Owner

@naveen521kk I have added pre-commit cli app

@vercel
Copy link

vercel bot commented Jun 4, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/saadpasta/developer-folio/DHzwg4NyoSvsfHjEsFD574PwuQxH
✅ Preview: https://developer-foli-git-fork-ashutosh1297-363-functional-home-ca4e92.vercel.app

@naveen521kk
Copy link
Collaborator

I have added pre-commit cli app

Thanks, I will set up pre-commit in another PR.

@naveen521kk naveen521kk mentioned this pull request Jun 4, 2021
@kartikcho
Copy link
Collaborator

pre-commit.ci autofix

@kartikcho
Copy link
Collaborator

@naveen521kk shouldn't this just run the prettier command in a new commit on this PR? So why is it failing?
Their logs are anything but helpful.

@naveen521kk
Copy link
Collaborator

pre-commit.ci autofix

@naveen521kk
Copy link
Collaborator

Hmm, this looks confusing.

@ashutosh1297
Copy link
Contributor Author

Also @ashutosh1297, the check is still failing 😅

@kartikcho I am not sure why it's failing, I ran the prettier script from package.json and it showed that everything's fixed. Are there more steps involved?

@naveen521kk
Copy link
Collaborator

@kartikcho I am not sure why it's failing, I ran the prettier script from package.json and it showed that everything's fixed. Are there more steps involved?

Can you rebase with the master and then run npm run format? Maybe it fixes this.

@kartikcho
Copy link
Collaborator

I'll probably take a look at the tests this weekend but for now, try doing what Naveen suggested.

@saadpasta
Copy link
Owner

@kartikcho are you looking into this.

@kartikcho
Copy link
Collaborator

Sorry, I've been busy and this totally skipped my mind. Will try to take a look whenever possible.

@kartikcho kartikcho mentioned this pull request Jun 20, 2021
@kartikcho
Copy link
Collaborator

Hey @ashutosh1297, rebase from master and this should be green.

Copy link
Owner

@saadpasta saadpasta left a comment

Choose a reason for hiding this comment

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

LGTM 👍
@ashutosh1297 please rebase from master

@kartikcho kartikcho mentioned this pull request Aug 20, 2021
@kartikcho
Copy link
Collaborator

Hey @ashutosh1297 are you still working on this?

@kartikcho kartikcho mentioned this pull request Aug 21, 2021
@kartikcho kartikcho merged commit 189dab9 into saadpasta:master Aug 28, 2021
Mehranmzn pushed a commit to Mehranmzn/mehranmzn.github.io that referenced this pull request Sep 13, 2024
* Converted Main.js to a functional component

* Moved localStorage theme logic into a custom hook

* Add extra line to EOF

* Prettier check fixes

* fix formatting, rebase branch

Co-authored-by: Ashutosh Sharma <ashutosh@thefastway.in>
Co-authored-by: Kartik Choudhary <kartikc.918@gmail.com>
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.

4 participants