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: add country list in settings page, using it as default country in eco-score #892

Merged
merged 8 commits into from
Feb 20, 2024

Conversation

Gaurav-Verma07
Copy link
Contributor

@Gaurav-Verma07 Gaurav-Verma07 commented Feb 19, 2024

…in eco-score

What

Add country drop-down in settings page using countries.json.
Settings it as default in eco-score page.

Screenshot

image

Fixes bug(s)

Fix #887

@Gaurav-Verma07 Gaurav-Verma07 requested a review from a team as a code owner February 19, 2024 10:01
Copy link

netlify bot commented Feb 19, 2024

Deploy Preview for warm-cannoli-79bbb2 ready!

Name Link
🔨 Latest commit 05d069c
🔍 Latest deploy log https://app.netlify.com/sites/warm-cannoli-79bbb2/deploys/65d3ab12cd111300082e789f
😎 Deploy Preview https://deploy-preview-892--warm-cannoli-79bbb2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Gaurav-Verma07 Gaurav-Verma07 changed the title feat: add country list in settings page, using it as default country … feat: add country list in settings page, using it as default country in eco-score Feb 19, 2024
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

Sounds good. I added some minor comments

src/pages/eco-score/index.tsx Outdated Show resolved Hide resolved
);

React.useEffect(() => {
setSearchParams({ cc: selectedCountry });
}, [selectedCountry]);
}, [selectedCountry, searchParams]);
Copy link
Member

Choose a reason for hiding this comment

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

I don't see why adding this dependency

Suggested change
}, [selectedCountry, searchParams]);
}, [selectedCountry]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see why adding this dependency

Actually it's kind of important, if you go to https://hunger.openfoodfacts.org/eco-score?cc=en%3Afrance
and click eco-score in navbar, the query parameter disappears which is not an expected behavior.
What you think?

Copy link
Member

Choose a reason for hiding this comment

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

ok, why not 👍

src/pages/eco-score/index.tsx Outdated Show resolved Hide resolved
src/pages/settings/index.jsx Outdated Show resolved Hide resolved
src/pages/settings/index.jsx Outdated Show resolved Hide resolved
@alexfauquette alexfauquette merged commit 5f92e6a into openfoodfacts:master Feb 20, 2024
11 checks passed
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.

Save user country country
2 participants