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

feat: facebook like button #395

Merged
merged 6 commits into from
Jan 21, 2022

Conversation

cavesdev
Copy link
Contributor

@cavesdev cavesdev commented Jan 4, 2022

Description

Closes #310

Added a Facebook like button to the tree details page. The like is linked to a specific URL (using the tree id) and users must have a FB account to like the tree.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshots

Screen Shot 2022-01-03 at 12 40 25

How Has This Been Tested?

  • Cypress integration
  • Cypress component tests
  • Jest unit tests

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Member

@VWRoli VWRoli left a comment

Choose a reason for hiding this comment

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

Not working on my side.
Screenshot from 2022-01-05 08-32-59
And you get this error message while rendering sometimes:
Screenshot from 2022-01-05 08-34-28

Tried it with different browsers like Brave, Chrome, and Firefox.

@dadiorchen
Copy link
Collaborator

Maybe we need to load some js file from FB?

@cavesdev
Copy link
Contributor Author

cavesdev commented Jan 6, 2022

Maybe we need to load some js file from FB?

The Facebook's SDK is being loaded at the beginning.

One problem I faced: depending on your browser's configuration, it may be blocking requests to Facebook. For example, I use Edge with Strict Tracking Protection and it doesn't show the like button.
Screen Shot 2022-01-06 at 13 03 22

I updated the code to test if the SDK is loaded before attempting to use it.

@cavesdev cavesdev requested a review from VWRoli January 6, 2022 19:09
Copy link
Member

@VWRoli VWRoli left a comment

Choose a reason for hiding this comment

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

Seems like the error message is gone but still can't see it.

@cavesdev
Copy link
Contributor Author

Is there anyone else that can test this? On my side it's working so I don't know what to fix :(

@dadiorchen
Copy link
Collaborator

@VWRoli can you help to test it and do some research on your side?

@VWRoli
Copy link
Member

VWRoli commented Jan 12, 2022

@VWRoli can you help to test it and do some research on your side?

Sure, I will take a look at it.

@VWRoli
Copy link
Member

VWRoli commented Jan 15, 2022

@cavesdev can you tell me what OS and browser do you use? Can you show me a screenshot of the inspected element?

Screenshot from 2022-01-15 09-45-21

My best guess is that we run it locally with http, instead of https, and that causes the problem. Because we load the scripts, just the iframe does not have a height and width. If that is the problem then it should work when we run it on a public domain. Not sure though, it is just a theory.

@dadiorchen
Copy link
Collaborator

@VWRoli
Copy link
Member

VWRoli commented Jan 17, 2022

Is this useful? https://create-react-app.dev/docs/using-https-in-development/

Yes, it was. Set up HTTPS for next, but the like button still does not work. It seems I have to dig deeper.

@VWRoli
Copy link
Member

VWRoli commented Jan 17, 2022

Found the problem, staring right in my face. https://developers.facebook.com/docs/plugins/like-button
Screenshot from 2022-01-17 09-27-02

Switched my location to somewhere else and the like button worked.
Screenshot from 2022-01-17 09-28-26

So it is just location and policy issues, the component itself is working fine.

@cavesdev
Copy link
Contributor Author

Oh I see, sorry I'm just seeing your messages! Nice catch, will it be a problem for users on those regions? It will be awkward if some users see the button and some don't.

@dadiorchen
Copy link
Collaborator

oh.... funny problem... the whole Europe? it seems unacceptable...

@dadiorchen
Copy link
Collaborator

@cavesdev can you solve the conflict above and merge your code to branch, we can raise new issue for the problem mentioned above.

@cavesdev
Copy link
Contributor Author

Done! Pulled the most recent changes from web-map-site

@dadiorchen
Copy link
Collaborator

Thanks!

@dadiorchen dadiorchen merged commit bd87785 into Greenstand:web-map-site Jan 21, 2022
@github-actions
Copy link

🎉 This PR is included in version 1.15.0-beta.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The like component and function
3 participants