protect-earth / protect.earth

International Directory of Climate Action for Humans, Businesses, and anyone else.
https://protect.earth
MIT License
35 stars 15 forks source link

feat: implement persisted country selection; deps for writing tests #94

Closed piperchester closed 3 years ago

piperchester commented 4 years ago

This implements #28. I use window.sessionStorage to persist the selected country as well as React's state to trigger a client-side refresh when the user selects and clears the option.

selected-country

Open to any suggestions, big or small on any of this!

Also

Todo

piperchester commented 4 years ago

Hey Phil and Mike! Requested you as reviewers as I'm not sure who the best folks to reach out to are. Happy to elaborate on any of this!

philsturgeon commented 4 years ago

Thanks for taking a swing at this!

Sorry for any confusion, but this is only meant to be a country selector. Everyone is still stuck seeing english, it's just going to display content for Brazil or Australia or Bolivia, it's all about restricting to content relevant to you. A basic filter, which is persisted.

Localiztion is out of scope, as #14 will give people language. If somebody else wants to view the site in French when they live in Mongolia that should be fine.

Do you think you could tweak that to make it clear?

piperchester commented 4 years ago

Do you think you could tweak that to make it clear?

For sure! So is the intent to fold the functionality from the "Filter site for your country" bit into a single dropdown?

Also good timing I think - guessing the site's undergoing some maintenance but getting a "website is pending domain owner verification" on https://protect.earth/.

philsturgeon commented 4 years ago

Right, the goal was to make the "Filter site for your country" work properly.

  1. persist the country of choice
  2. display the country of choice
  3. make sure it showed things from your country and things which had no country, because a website available anywhere is a good thing to show to somebody wherever they are

Does that make sense?

The hosted URL is https://actions.protect.earth whilst we switch the main page over to Squarespace, which is surprisingly slow at making SSL certificates. 😓

piperchester commented 3 years ago

Took another stab at this @philsturgeon! Happy to make any desired changes.

piperchester commented 3 years ago

Getting a chance to revisit this @philsturgeon - apologies for the delays!

Following the contrib guidelines, do you mind sharing env variables for the new Airtable setup?

philsturgeon commented 3 years ago

Sorry or the delays here too! Agh.

This project is finally getting its new home, merged with climatechoice over here https://github.com/impactmakers/climatechoice/pull/161

The airtable source and directory approach is simply being moved over there, so this will still need to be done, just once the dust has settled of that PR. Could you subscribe to the PR and when its done try and help with a country selector?

philsturgeon commented 3 years ago

Btw I'll try and get the read-only version of the API up so people dont need EVN vars soon.