Repository navigation
Conversation
The country dropdowns in Main Settings and Add Village were long lists that couldn't be searched. Both now use a new shared CountrySelect component: type a few letters to narrow the list, then pick a country.
In Main Settings, picking a country also fills in its currency, unless
you've already chosen a currency yourself. The country-to-currency
mapping lives in countryCurrencies.json, and only currencies MPM
supports are suggested. 12 African currencies that were missing, such
as the Zambian and Malawian kwacha, are now in currency.json.
This also fixes three problems around Sites:
- Leaving the Clusters dashboard before it finished loading no longer
crashes the app.
- With no Sites yet, the Sites page asks you to add one instead of
spinning forever.
- After creating a Site, Add Village now opens with that Site instead
of failing.
There was a problem hiding this comment.
Looking good!!
Just one question regarding countries... I always disliked the fact that we are essentially managing countries and currencies in sooo many different places. countries tables, backend countries JSON , currencies JSON and frontend JSON.
Can we use this opportunity to simplify to a single source of truth? I don't think we need to split currency and countries. It can all be tracked in a single.
Also, I think there is some benefit of having a countries table in SQL. But this would mean for the frontend to do HTTP request to get pretty constant data.
What about if we have one countries/currencies JSON and share that between Frontend/Backend and also use the same JSON to populate countries table.
WDYT?
|
….json - Country data was spread over several files, and the frontend had its own country-to-currency map. countries.json now holds each country's name and currency. - A tenant migration copies the currency into a new countries.currency_code column, and GET /api/countries returns it, so the frontend no longer needs a copy.
Brief summary of the change made
Closes: #1811
The country dropdowns in Main Settings and Add Village were long lists that couldn't be searched. Both now use a new shared CountrySelect component: type a few letters to narrow the list, then pick a country.
In Main Settings, picking a country also fills in its currency, unless you've already chosen a currency yourself. The country-to-currency mapping lives in countryCurrencies.json, and it suggests only currencies MPM supports. 12 missing African currencies, such as the Zambian and Malawian kwacha, are now in currency.json.
This also fixes three problems around Sites:
Are there any other side effects of this change that we should be aware of?
Describe how you tested your changes?
Pull Request checklist
Please confirm you have completed any of the necessary steps below.