diff --git a/src/localeStorageManager.ts b/src/localeStorageManager.ts
index 61ceda0e1..7108e1fe2 100644
--- a/src/localeStorageManager.ts
+++ b/src/localeStorageManager.ts
@@ -16,6 +16,7 @@ const STORAGE_KEY = "hunger-game-settings";
export const localSettingsKeys = {
language: "lang",
+ country: "country",
colorMode: "colorMode",
isDevMode: "devMode",
visiblePages: "visiblePages",
diff --git a/src/pages/eco-score/index.tsx b/src/pages/eco-score/index.tsx
index 0c2853dff..dbb7f62e3 100644
--- a/src/pages/eco-score/index.tsx
+++ b/src/pages/eco-score/index.tsx
@@ -11,9 +11,10 @@ import SmallQuestionCard from "../../components/SmallQuestionCard";
import Opportunities from "../../components/Opportunities";
import { DEFAULT_FILTER_STATE } from "../../components/QuestionFilter/const";
import { useTranslation } from "react-i18next";
-import { capitaliseName } from "../../utils";
import Loader from "../loader";
import { useSearchParams } from "react-router-dom";
+import { localSettings } from "../../localeStorageManager";
+import countryNames from "../../assets/countries.json";
const ecoScoreCards = [
{
@@ -148,33 +149,19 @@ const ecoScoreCards = [
},
];
-export const countryNames = [
- "en:belgium",
- "en:denmark",
- "en:france",
- "en:germany",
- "en:italy",
- "en:netherlands",
- "en:portugal",
- "en:spain",
- "en:sweden",
- "en:switzerland",
- "en:united-states",
- "en:canada",
- "en:australia",
- "en:united-kingdom",
-];
+
export default function EcoScore() {
const { t } = useTranslation();
+ const localData= localSettings.fetch();
const [searchParams, setSearchParams] = useSearchParams();
const [selectedCountry, setSelectedCountry] = React.useState(
- searchParams.get("cc") || countryNames[0],
+ searchParams.get("cc") || localData['country'] || "en:france",
);
React.useEffect(() => {
setSearchParams({ cc: selectedCountry });
- }, [selectedCountry]);
+ }, [selectedCountry, searchParams]);
return (
{t("settings.dev_mode_title")}