Browse Source

fix translationFAB not shown correctly

Ramona Plogmann 1 year ago
parent
commit
a63b5bddb4

+ 1 - 1
client/src/components/Meals/Meals.jsx

@@ -92,7 +92,7 @@ const Meals = (props) => {
   // set TranslationFab visibility
   // it is in useEffect because it updates the state of the parent component which cannot be done while rendering
   useEffect(() => {
-    if (setIsTranslationFabHidden) setIsTranslationFabHidden(meals.length === 0); // if there are no meals or meals are loading, hid translation FAB
+    if (setIsTranslationFabHidden && meals.length > 0) setIsTranslationFabHidden(false); // if there are no meals or meals are loading, keep translation FAB hidden (it is hidden by default), otherwise, show it
   }, [setIsTranslationFabHidden, meals]);
 
   const updateIsCategoryOpen = (key, value) => {

+ 1 - 1
client/src/components/Plans/Plans.jsx

@@ -74,7 +74,7 @@ const Plans = (props) => {
   const fetchAndUpdatePlans = () => {
     getPlansOfUser(userId, plansFound => {
       setPlans(plansFound);
-      if (setIsTranslationFabHidden) setIsTranslationFabHidden(plansFound.length === 0);
+      if (setIsTranslationFabHidden && plansFound.length > 0) setIsTranslationFabHidden(false);
       if (addThingsToTranslate) {
         addThingsToTranslate(plansFound.filter(plan => !(plan.hasDate && new Date(plan.date).setHours(0, 0, 0, 0) < new Date().setHours(0, 0, 0, 0))) // plan is not in past
                                        .map(plan => plan.title)); // add each plan's title to thingsToTranslate

+ 1 - 1
client/src/i18n.js

@@ -58,7 +58,7 @@ export const languageShorthandForAuth0 = { // for Auth0, see comment above.
 export const languagesISO3 = { // for franc translation package https://www.npmjs.com/package/franc-min?activeTab=readme
   de: 'deu',
   it: 'ita',
-  ja: 'jap',
+  ja: 'jpn',
   fr_FR: 'fra',
   en_GB: 'eng',
   en_US: 'eng',