From 885c81f41af6fd4628dc3bb583a6a59989b2a89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haukur=20P=C3=A1ll?= Date: Tue, 12 Sep 2023 21:28:32 +0000 Subject: [PATCH] Disabling Polish and Faroese in the UI --- package.json | 2 +- src/components/Disclaimer/index.jsx | 2 +- src/components/LanguagePicker/index.js | 43 ++++++++++++++++---------- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 643c263..ce882a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "0.5.2", + "version": "0.5.3", "private": true, "dependencies": { "@reduxjs/toolkit": "^1.6.2", diff --git a/src/components/Disclaimer/index.jsx b/src/components/Disclaimer/index.jsx index 6a25606..76e141d 100644 --- a/src/components/Disclaimer/index.jsx +++ b/src/components/Disclaimer/index.jsx @@ -21,7 +21,7 @@ export default function Disclaimer() { "By using this service you agreee to our use of cookies. Translations may be logged for quality assurance purposes." )}

-

{t("disclaimer-last-updated", "Last updated: ")} 2023-01-12

+

{t("disclaimer-last-updated", "Last updated: ")} 2023-09-12

); diff --git a/src/components/LanguagePicker/index.js b/src/components/LanguagePicker/index.js index ec4fcd2..9c0b9a9 100644 --- a/src/components/LanguagePicker/index.js +++ b/src/components/LanguagePicker/index.js @@ -34,11 +34,15 @@ function LanguageDirectionPicker() { // TODO: Get this information from the backend const SUPPORTED_LANGUAGE_PAIRS = useMemo(() => { return { - en: ["is", "fo"], - is: ["en", "pl"], - pl: ["is"], - fo: ["en"], + is: ["en"], + en: ["is"], }; + // return { + // en: ["is", "fo"], + // is: ["en", "pl"], + // pl: ["is"], + // fo: ["en"], + // }; }, []); const LANGUAGE_OPTIONS = useMemo(() => { return { @@ -54,18 +58,18 @@ function LanguageDirectionPicker() { value: "en", flag: "uk", }, - pl: { - key: "pl", - text: t("Polish"), - value: "pl", - flag: "pl", - }, - fo: { - key: "fo", - text: t("Faroese"), - value: "fo", - flag: "fo", - }, + // pl: { + // key: "pl", + // text: t("Polish"), + // value: "pl", + // flag: "pl", + // }, + // fo: { + // key: "fo", + // text: t("Faroese"), + // value: "fo", + // flag: "fo", + // }, }; }, [t]); useEffect(() => { @@ -87,6 +91,13 @@ function LanguageDirectionPicker() { const SRC_LANGUAGE_OPTIONS = Object.keys(LANGUAGE_OPTIONS).map( (key) => LANGUAGE_OPTIONS[key] ); + // In case the currently selected sourceLang is not supported, select the first as sourceLang + if ( + SRC_LANGUAGE_OPTIONS.map((option) => option.value).indexOf(sourceLang) === + -1 + ) { + dispatch(setSourceLanguage(SRC_LANGUAGE_OPTIONS[0].value)); + } return (