From 2264ade7438922908ec844265457fd9af9ff4864 Mon Sep 17 00:00:00 2001 From: Pierre Bresson Date: Thu, 30 Sep 2021 07:05:42 +0200 Subject: [PATCH] v0.8.0 --- App.tsx | 2 +- app.example.json | 6 +- .../__tests__/emissions.selectors.test.ts | 31 +- app/ducks/emissions/emissions.selectors.ts | 6 + app/screens/Budget/BudgetScreen.tsx | 49 ++- .../ProgressChart/ProgressChart.styles.ts | 3 + .../ProgressChart/ProgressChart.tsx | 41 +- .../__tests__/ProgressChart.test.tsx | 24 -- .../__snapshots__/ProgressChart.test.tsx.snap | 55 --- .../ProgressChart/components/Chart/Chart.tsx | 12 +- .../__snapshots__/Chart.test.tsx.snap | 26 +- .../components/Legend/Legend.styles.ts | 2 - .../components/Legend/Legend.tsx | 62 ++- .../Legend/__tests__/Legend.test.tsx | 12 +- .../__snapshots__/Legend.test.tsx.snap | 54 ++- .../components/LegendItem/LegendItem.tsx | 28 +- .../LegendItem/__tests__/LegendItem.test.tsx | 11 +- .../__snapshots__/LegendItem.test.tsx.snap | 67 ++- .../Budget/ducks/BudgetScreen.selectors.ts | 117 +++++- .../__tests__/BudgetScreen.selectors.test.ts | 396 ++++++++++++++++-- app/screens/Budget/translations/da.json | 23 +- app/screens/Budget/translations/de.json | 29 +- app/screens/Budget/translations/en.json | 36 +- app/screens/Budget/translations/es.json | 29 +- app/screens/Budget/translations/fr.json | 29 +- app/screens/Budget/translations/index.ts | 10 +- app/screens/Budget/translations/ms.json | 29 +- app/screens/Budget/translations/pl.json | 29 +- app/screens/Budget/translations/pt.json | 29 +- app/screens/Budget/translations/ru.json | 29 +- app/screens/Budget/translations/sv.json | 29 +- app/screens/Budget/translations/zh.json | 29 +- .../MonthlyBudget/MonthlyBudgetScreen.tsx | 2 +- .../MonthlyBudgetScreen.test.tsx.snap | 4 +- .../MonthlyBudget/translations/da.json | 30 +- .../MonthlyBudget/translations/en.json | 30 +- .../MonthlyBudget/translations/es.json | 30 +- .../MonthlyBudget/translations/fr.json | 30 +- .../MonthlyBudget/translations/ms.json | 30 +- .../MonthlyBudget/translations/pt.json | 30 +- .../MonthlyBudget/translations/ru.json | 30 +- .../MonthlyBudget/translations/sv.json | 30 +- .../MonthlyBudget/translations/zh.json | 30 +- scripts/poeditor/da.json | 3 +- scripts/poeditor/de.json | 1 - scripts/poeditor/en.json | 12 +- scripts/poeditor/es.json | 371 ++++++++-------- scripts/poeditor/fr.json | 3 +- scripts/poeditor/ms.json | 3 +- scripts/poeditor/my.json | 196 --------- scripts/poeditor/pl.json | 1 - scripts/poeditor/pt.json | 3 +- scripts/poeditor/ru.json | 3 +- scripts/poeditor/sv.json | 3 +- scripts/poeditor/zh.json | 3 +- 55 files changed, 1212 insertions(+), 1000 deletions(-) delete mode 100644 app/screens/Budget/components/ProgressChart/__tests__/ProgressChart.test.tsx delete mode 100644 app/screens/Budget/components/ProgressChart/__tests__/__snapshots__/ProgressChart.test.tsx.snap delete mode 100644 scripts/poeditor/my.json diff --git a/App.tsx b/App.tsx index 6714fdc7..1d2707de 100644 --- a/App.tsx +++ b/App.tsx @@ -27,7 +27,7 @@ const supportedLanguages: string[] = [ "pt", "pl", "zh", - "my", + "ms", "es", ]; const defaultLanguage = "en"; diff --git a/app.example.json b/app.example.json index 11330df6..84bd06c2 100644 --- a/app.example.json +++ b/app.example.json @@ -4,7 +4,7 @@ "slug": "not-my-fault-earth", "privacy": "public", "platforms": ["ios", "android"], - "version": "0.7.3", + "version": "0.8.0", "orientation": "portrait", "splash": { "image": "./assets/images/splash.png", @@ -19,13 +19,13 @@ "icon": "./assets/images/ios.icon.png", "bundleIdentifier": "nmf.earth", "supportsTablet": true, - "buildNumber": "31" + "buildNumber": "33" }, "android": { "icon": "./assets/images/android.icon.png", "useNextNotificationsApi": true, "package": "nmf.earth", - "versionCode": 31 + "versionCode": 33 }, "userInterfaceStyle": "automatic", "hooks": { diff --git a/app/ducks/emissions/__tests__/emissions.selectors.test.ts b/app/ducks/emissions/__tests__/emissions.selectors.test.ts index 1f814245..5f5cde00 100644 --- a/app/ducks/emissions/__tests__/emissions.selectors.test.ts +++ b/app/ducks/emissions/__tests__/emissions.selectors.test.ts @@ -1,11 +1,11 @@ import { FoodType, + MealType, TransportType, StreamingType, - ElectricityType, - FashionType, PurchaseType, - MealType, + FashionType, + ElectricityType, } from "carbon-footprint"; import { Emission, EmissionType } from "interfaces"; @@ -92,6 +92,15 @@ const emissionMeal: Emission = { value: 20, }; +const emissionProductScanned: Emission = { + id: "9", + creationDate: "2020-01-29T11:04:55.334Z", + emissionModelType: "productScanned", + emissionType: EmissionType.productScanned, + isMitigated: false, + value: 100, +}; + describe("if there are emissions", () => { beforeEach(() => { state = { @@ -105,6 +114,7 @@ describe("if there are emissions", () => { emissionFashion, emissionPurchase, emissionMeal, + emissionProductScanned, ], }; }); @@ -125,6 +135,7 @@ describe("if there are emissions", () => { emissionFashion, emissionPurchase, emissionMeal, + emissionProductScanned, ])); test("`getCustomEmissions` should return custom emissions", () => @@ -158,15 +169,8 @@ describe("if there are emissions", () => { emissionMeal, ])); - test("`getOtherEmissions` should return other emissions", () => - expect(emissions.selectors.getOtherEmissions(state)).toEqual([ - emissionCustom, - emissionStreaming, - emissionElectricity, - emissionFashion, - emissionPurchase, - emissionMeal, - ])); + test("`getProductScanned` should return product scanned emissions", () => + expect(emissions.selectors.getProductScanned(state)).toEqual([emissionProductScanned])); }); describe("if there are no emissions", () => { @@ -209,6 +213,9 @@ describe("if there are no emissions", () => { test("`getMealEmissions` should return mitigated no emission", () => expect(emissions.selectors.getMealEmissions(state)).toEqual([])); + test("`getProductScanned` should return mitigated no emission", () => + expect(emissions.selectors.getProductScanned(state)).toEqual([])); + test("`getEatableEmissions` should return mitigated no emission", () => expect(emissions.selectors.getEatableEmissions(state)).toEqual([])); }); diff --git a/app/ducks/emissions/emissions.selectors.ts b/app/ducks/emissions/emissions.selectors.ts index f5930930..c596f5ec 100644 --- a/app/ducks/emissions/emissions.selectors.ts +++ b/app/ducks/emissions/emissions.selectors.ts @@ -31,6 +31,9 @@ const isCustomEmission = (emission) => emission.emissionType === EmissionType.cu const isMealEmission = (emission) => emission.emissionType === EmissionType.meal; +const isProductScannedEmission = (emission) => + emission.emissionType === EmissionType.productScanned; + const isEatableEmission = (emission) => emission.emissionType === EmissionType.meal || emission.emissionType === EmissionType.food; @@ -60,6 +63,8 @@ const getEatableEmissions = pipe(getAllEmissions, filter(isEatableEmission)); const getCustomEmissions = pipe(getAllEmissions, filter(isCustomEmission)); +const getProductScanned = pipe(getAllEmissions, filter(isProductScannedEmission)); + const getOtherEmissions = pipe(getAllEmissions, filter(isOtherEmission)); export default { @@ -71,6 +76,7 @@ export default { getFashionEmissions, getPurchaseEmissions, getCustomEmissions, + getProductScanned, getOtherEmissions, getMealEmissions, getEatableEmissions, diff --git a/app/screens/Budget/BudgetScreen.tsx b/app/screens/Budget/BudgetScreen.tsx index 77e30d05..04d70775 100644 --- a/app/screens/Budget/BudgetScreen.tsx +++ b/app/screens/Budget/BudgetScreen.tsx @@ -18,15 +18,36 @@ const BudgetScreen: NavStatelessComponent = () => { const navigator = navigate(navigation); const monthlyCarbonBudget = useSelector(selectors.getMonthlyCarbonBudget); - const totalCurrentMonthEmissions = useSelector(selectors.getCurrentMonthAllCarbonValue); - const transportCurrentMonthEmissions = useSelector(selectors.getCurrentMonthTransportCarbonValue); + const foodCurrentMonthEmissions = useSelector(selectors.getCurrentMonthFoodCarbonValue); - const otherCurrentMonthEmissions = useSelector(selectors.getCurrentMonthOtherCarbonValue); + const mealCurrentMonthEmissions = useSelector(selectors.getCurrentMonthMealCarbonValue); + const transportCurrentMonthEmissions = useSelector(selectors.getCurrentMonthTransportCarbonValue); + const streamingCurrentMonthEmissions = useSelector(selectors.getCurrentMonthStreamingCarbonValue); + const purchaseCurrentMonthEmissions = useSelector(selectors.getCurrentMonthPurchaseCarbonValue); + const fashionCurrentMonthEmissions = useSelector(selectors.getCurrentMonthFashionCarbonValue); + const electricityCurrentMonthEmissions = useSelector( + selectors.getCurrentMonthElectricityCarbonValue + ); + const productScannedCurrentMonthEmissions = useSelector( + selectors.getCurrentMonthProductScannedCarbonValue + ); + const customCurrentMonthEmissions = useSelector(selectors.getCurrentMonthCustomCarbonValue); + const totalCurrentMonthEmissions = useSelector(selectors.getCurrentMonthAllCarbonValue); - const totalCurrentYearEmissions = useSelector(selectors.getCurrentYearAllCarbonValue); - const transportCurrentYearEmissions = useSelector(selectors.getCurrentMonthTransportCarbonValue); const foodCurrentYearEmissions = useSelector(selectors.getCurrentYearFoodCarbonValue); - const otherCurrentYearEmissions = useSelector(selectors.getCurrentYearOtherCarbonValue); + const mealCurrentYearEmissions = useSelector(selectors.getCurrentYearMealCarbonValue); + const transportCurrentYearEmissions = useSelector(selectors.getCurrentYearTransportCarbonValue); + const streamingCurrentYearEmissions = useSelector(selectors.getCurrentYearStreamingCarbonValue); + const purchaseCurrentYearEmissions = useSelector(selectors.getCurrentYearPurchaseCarbonValue); + const fashionCurrentYearEmissions = useSelector(selectors.getCurrentYearFashionCarbonValue); + const electricityCurrentYearEmissions = useSelector( + selectors.getCurrentYearElectricityCarbonValue + ); + const productScannedCurrentYearEmissions = useSelector( + selectors.getCurrentYearProductScannedCarbonValue + ); + const customCurrentYearEmissions = useSelector(selectors.getCurrentYearCustomCarbonValue); + const totalCurrentYearEmissions = useSelector(selectors.getCurrentYearAllCarbonValue); return ( @@ -34,8 +55,14 @@ const BudgetScreen: NavStatelessComponent = () => { isMonth totalEmissions={totalCurrentMonthEmissions} foodEmissions={foodCurrentMonthEmissions} + mealEmissions={mealCurrentMonthEmissions} transportEmissions={transportCurrentMonthEmissions} - otherEmissions={otherCurrentMonthEmissions} + streamingEmissions={streamingCurrentMonthEmissions} + purchaseEmissions={purchaseCurrentMonthEmissions} + fashionEmissions={fashionCurrentMonthEmissions} + electricityEmissions={electricityCurrentMonthEmissions} + productScannedEmissions={productScannedCurrentMonthEmissions} + customEmissions={customCurrentMonthEmissions} monthlyEmissionsBudget={monthlyCarbonBudget} /> { diff --git a/app/screens/Budget/components/ProgressChart/ProgressChart.styles.ts b/app/screens/Budget/components/ProgressChart/ProgressChart.styles.ts index d2b14263..2b0f5c36 100644 --- a/app/screens/Budget/components/ProgressChart/ProgressChart.styles.ts +++ b/app/screens/Budget/components/ProgressChart/ProgressChart.styles.ts @@ -24,4 +24,7 @@ export default StyleSheet.create({ header: { textTransform: "capitalize", }, + subHeader: { + paddingTop: 20, + }, }); diff --git a/app/screens/Budget/components/ProgressChart/ProgressChart.tsx b/app/screens/Budget/components/ProgressChart/ProgressChart.tsx index b73061dc..3e1c80f9 100644 --- a/app/screens/Budget/components/ProgressChart/ProgressChart.tsx +++ b/app/screens/Budget/components/ProgressChart/ProgressChart.tsx @@ -7,22 +7,34 @@ import { Text } from "components"; import { withLocalization, LocalizationContextProps, getLocaleForMoment } from "utils"; import styles from "./ProgressChart.styles"; -import { Legend, Chart, PeriodBudget } from "./components"; +import { Legend, PeriodBudget } from "./components"; interface Props { isMonth?: boolean; totalEmissions: number; foodEmissions: number; + mealEmissions: number; transportEmissions: number; - otherEmissions: number; + streamingEmissions: number; + purchaseEmissions: number; + fashionEmissions: number; + electricityEmissions: number; + productScannedEmissions: number; + customEmissions: number; monthlyEmissionsBudget: number; } const ProgressChart = ({ totalEmissions = 0, foodEmissions = 0, + mealEmissions = 0, transportEmissions = 0, - otherEmissions = 0, + streamingEmissions = 0, + purchaseEmissions = 0, + fashionEmissions = 0, + electricityEmissions = 0, + productScannedEmissions = 0, + customEmissions = 0, monthlyEmissionsBudget = 0, isMonth = false, language = "", @@ -33,12 +45,7 @@ const ProgressChart = ({ const periodEmissionsBudget = isMonth ? monthlyEmissionsBudget : monthlyEmissionsBudget * 12; - const totalEmissionsPercentage = - totalEmissions / periodEmissionsBudget > 1 ? 1 : totalEmissions / periodEmissionsBudget; - const transportEmissionsPercentage = - transportEmissions / periodEmissionsBudget > 1 ? 1 : transportEmissions / periodEmissionsBudget; - const foodEmissionsPercentage = - foodEmissions / periodEmissionsBudget > 1 ? 1 : foodEmissions / periodEmissionsBudget; + const totalEmissionsPercentage = Math.round((totalEmissions / periodEmissionsBudget) * 100); const period = moment() .locale(getLocaleForMoment(language)) @@ -48,17 +55,21 @@ const ProgressChart = ({ {period} + + {totalEmissionsPercentage + "%"} + - diff --git a/app/screens/Budget/components/ProgressChart/__tests__/ProgressChart.test.tsx b/app/screens/Budget/components/ProgressChart/__tests__/ProgressChart.test.tsx deleted file mode 100644 index e2b743da..00000000 --- a/app/screens/Budget/components/ProgressChart/__tests__/ProgressChart.test.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from "react"; -import { create } from "react-test-renderer"; - -import ProgressChart from "../ProgressChart"; - -jest.unmock("../ProgressChart"); - -const props = { - totalEmissions: 900, - foodEmissions: 200, - transportEmissions: 600, - otherEmissions: 100, - monthlyEmissionsBudget: 1000, -}; - -it("ProgressChart renders correctly", () => { - const tree = create().toJSON(); - expect(tree).toMatchSnapshot(); -}); - -it("ProgressChart should not render if monthlyEmissionsBudget equals 0", () => { - const tree = create().toJSON(); - expect(tree).toBeNull(); -}); diff --git a/app/screens/Budget/components/ProgressChart/__tests__/__snapshots__/ProgressChart.test.tsx.snap b/app/screens/Budget/components/ProgressChart/__tests__/__snapshots__/ProgressChart.test.tsx.snap deleted file mode 100644 index 85782b5b..00000000 --- a/app/screens/Budget/components/ProgressChart/__tests__/__snapshots__/ProgressChart.test.tsx.snap +++ /dev/null @@ -1,55 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`ProgressChart renders correctly 1`] = ` - - - - 2021 - - - - - - -`; diff --git a/app/screens/Budget/components/ProgressChart/components/Chart/Chart.tsx b/app/screens/Budget/components/ProgressChart/components/Chart/Chart.tsx index a540f20a..dea87944 100644 --- a/app/screens/Budget/components/ProgressChart/components/Chart/Chart.tsx +++ b/app/screens/Budget/components/ProgressChart/components/Chart/Chart.tsx @@ -31,18 +31,12 @@ const ringWidth = chartWidth / dirtyFactor; interface Props { totalEmissionsPercentage: number; - transportEmissionsPercentage: number; - foodEmissionsPercentage: number; } -const Chart: React.FC = ({ - totalEmissionsPercentage, - transportEmissionsPercentage, - foodEmissionsPercentage, -}) => { +const Chart: React.FC = ({ totalEmissionsPercentage }) => { const data = { - values: [foodEmissionsPercentage, transportEmissionsPercentage, totalEmissionsPercentage], - colors: [Colors.green50, Colors.yellow50, Colors.apricot], + values: [totalEmissionsPercentage], + colors: [Colors.apricot], }; const pies = data.values.map((pieData, i) => { diff --git a/app/screens/Budget/components/ProgressChart/components/Chart/__tests__/__snapshots__/Chart.test.tsx.snap b/app/screens/Budget/components/ProgressChart/components/Chart/__tests__/__snapshots__/Chart.test.tsx.snap index b062cb8f..a96a8ba0 100644 --- a/app/screens/Budget/components/ProgressChart/components/Chart/__tests__/__snapshots__/Chart.test.tsx.snap +++ b/app/screens/Budget/components/ProgressChart/components/Chart/__tests__/__snapshots__/Chart.test.tsx.snap @@ -19,37 +19,13 @@ exports[`Chart renders correctly 1`] = ` - - - - = ({ totalEmissions, - transportEmissions, foodEmissions, - otherEmissions, + mealEmissions, + transportEmissions, + streamingEmissions, + purchaseEmissions, + fashionEmissions, + electricityEmissions, + productScannedEmissions, + customEmissions, }) => { const items = [ { - name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL"), - value: totalEmissions, - color: Colors.apricot, + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD"), + value: foodEmissions, + }, + { + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_MEAL"), + value: mealEmissions, }, { name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT"), value: transportEmissions, - color: Colors.yellow50, }, { - name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD"), - value: foodEmissions, - color: Colors.green50, + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_STREAMING"), + value: streamingEmissions, + }, + { + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_PURCHASE"), + value: purchaseEmissions, }, { - name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER"), - value: otherEmissions, - color: Colors.grey70, + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FASHION"), + value: fashionEmissions, + }, + { + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_ELECTRICITY"), + value: electricityEmissions, + }, + { + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_PRODUCT_SCANNED"), + value: productScannedEmissions, + }, + { + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_CUSTOM"), + value: customEmissions, + }, + { + name: t("BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL"), + value: totalEmissions, }, ]; + return ( {items.map((item, index) => ( - + ))} ); diff --git a/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/Legend.test.tsx b/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/Legend.test.tsx index 03f55201..d84aa716 100644 --- a/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/Legend.test.tsx +++ b/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/Legend.test.tsx @@ -4,10 +4,16 @@ import { create } from "react-test-renderer"; import Legend from "../Legend"; const props = { - totalEmissions: 900, + totalEmissions: 1000, foodEmissions: 200, - transportEmissions: 600, - otherEmissions: 100, + mealEmissions: 300, + transportEmissions: 200, + streamingEmissions: 50, + purchaseEmissions: 50, + fashionEmissions: 100, + electricityEmissions: 50, + customEmissions: 20, + productScannedEmissions: 30, }; jest.unmock("../Legend"); diff --git a/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/__snapshots__/Legend.test.tsx.snap b/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/__snapshots__/Legend.test.tsx.snap index 5e9be29c..86cff71b 100644 --- a/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/__snapshots__/Legend.test.tsx.snap +++ b/app/screens/Budget/components/ProgressChart/components/Legend/__tests__/__snapshots__/Legend.test.tsx.snap @@ -4,32 +4,60 @@ exports[`Legend renders correctly 1`] = ` + + + + + + `; diff --git a/app/screens/Budget/components/ProgressChart/components/LegendItem/LegendItem.tsx b/app/screens/Budget/components/ProgressChart/components/LegendItem/LegendItem.tsx index a360430d..3f8a8a3b 100644 --- a/app/screens/Budget/components/ProgressChart/components/LegendItem/LegendItem.tsx +++ b/app/screens/Budget/components/ProgressChart/components/LegendItem/LegendItem.tsx @@ -7,24 +7,30 @@ import styles from "./LegendItem.styles"; interface Props { name: string; - value: number; - color: string; + amount: number; + totalAmount: number; } -const LegendItem: React.FC = ({ name = "", value = 0, color = "" }) => { - if (value === 0) { +const LegendItem: React.FC = ({ name = "", amount = 0, totalAmount = 0 }) => { + if (amount === 0 || totalAmount === 0) { return null; } + let showPercentage = true; + let unitAmount = " kg - "; + + const percentage = Math.round((amount / totalAmount) * 100); + + if (totalAmount == amount || !percentage) { + showPercentage = false; + unitAmount = " kg"; + } + return ( - - - - - {name} - {value + " kg"} - + {name + " : "} + {amount + unitAmount} + {showPercentage && {percentage + " %"}} ); }; diff --git a/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/LegendItem.test.tsx b/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/LegendItem.test.tsx index 96d3b2e4..155c0b75 100644 --- a/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/LegendItem.test.tsx +++ b/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/LegendItem.test.tsx @@ -5,8 +5,8 @@ import LegendItem from "../LegendItem"; const props = { name: "Food", - value: 10, - color: "red", + amount: 60, + totalAmount: 100, }; jest.unmock("../LegendItem"); @@ -16,7 +16,12 @@ it("LegendItem renders correctly", () => { expect(tree).toMatchSnapshot(); }); +it("LegendItem should not render % if percentage is 0", () => { + const tree = create().toJSON(); + expect(tree).toMatchSnapshot(); +}); + it("LegendItem should not render if value is 0", () => { - const tree = create().toJSON(); + const tree = create().toJSON(); expect(tree).toBeNull(); }); diff --git a/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/__snapshots__/LegendItem.test.tsx.snap b/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/__snapshots__/LegendItem.test.tsx.snap index 656e53b1..ebe335e3 100644 --- a/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/__snapshots__/LegendItem.test.tsx.snap +++ b/app/screens/Budget/components/ProgressChart/components/LegendItem/__tests__/__snapshots__/LegendItem.test.tsx.snap @@ -10,42 +10,39 @@ exports[`LegendItem renders correctly 1`] = ` } } > - + Food : + + + 60 kg - + + + 60 % + + +`; + +exports[`LegendItem should not render % if percentage is 0 1`] = ` + + + Food : + + - - - - - Food - - - 10 kg - - + 0.01 kg + `; diff --git a/app/screens/Budget/ducks/BudgetScreen.selectors.ts b/app/screens/Budget/ducks/BudgetScreen.selectors.ts index 99a8dd07..3aed6b3e 100644 --- a/app/screens/Budget/ducks/BudgetScreen.selectors.ts +++ b/app/screens/Budget/ducks/BudgetScreen.selectors.ts @@ -15,58 +15,143 @@ const getCarbonValue = pipe(map(calculation.getC02ValueFromEmission), sum, Math. const getCurrentMonthEmissions = filter(isEmissionInCurrentMonth); +const getCurrentMonthFoodCarbonValue = pipe( + emissions.selectors.getFoodEmissions, + getCurrentMonthEmissions, + getCarbonValue +); +const getCurrentMonthMealCarbonValue = pipe( + emissions.selectors.getMealEmissions, + getCurrentMonthEmissions, + getCarbonValue +); const getCurrentMonthTransportCarbonValue = pipe( emissions.selectors.getTransportEmissions, getCurrentMonthEmissions, getCarbonValue ); -const getCurrentMonthFoodCarbonValue = pipe( - emissions.selectors.getFoodEmissions, +const getCurrentMonthStreamingCarbonValue = pipe( + emissions.selectors.getStreamingEmissions, getCurrentMonthEmissions, getCarbonValue ); -const getCurrentMonthOtherCarbonValue = pipe( - emissions.selectors.getOtherEmissions, +const getCurrentMonthPurchaseCarbonValue = pipe( + emissions.selectors.getPurchaseEmissions, + getCurrentMonthEmissions, + getCarbonValue +); +const getCurrentMonthFashionCarbonValue = pipe( + emissions.selectors.getFashionEmissions, + getCurrentMonthEmissions, + getCarbonValue +); +const getCurrentMonthElectricityCarbonValue = pipe( + emissions.selectors.getElectricityEmissions, + getCurrentMonthEmissions, + getCarbonValue +); +const getCurrentMonthProductScannedCarbonValue = pipe( + emissions.selectors.getProductScanned, + getCurrentMonthEmissions, + getCarbonValue +); +const getCurrentMonthCustomCarbonValue = pipe( + emissions.selectors.getCustomEmissions, getCurrentMonthEmissions, getCarbonValue ); const getCurrentYearEmissions = filter(isEmissionInCurrentYear); +const getCurrentYearFoodCarbonValue = pipe( + emissions.selectors.getFoodEmissions, + getCurrentYearEmissions, + getCarbonValue +); +const getCurrentYearMealCarbonValue = pipe( + emissions.selectors.getMealEmissions, + getCurrentYearEmissions, + getCarbonValue +); const getCurrentYearTransportCarbonValue = pipe( emissions.selectors.getTransportEmissions, getCurrentYearEmissions, getCarbonValue ); -const getCurrentYearFoodCarbonValue = pipe( - emissions.selectors.getFoodEmissions, +const getCurrentYearStreamingCarbonValue = pipe( + emissions.selectors.getStreamingEmissions, + getCurrentYearEmissions, + getCarbonValue +); +const getCurrentYearPurchaseCarbonValue = pipe( + emissions.selectors.getPurchaseEmissions, + getCurrentYearEmissions, + getCarbonValue +); +const getCurrentYearFashionCarbonValue = pipe( + emissions.selectors.getFashionEmissions, + getCurrentYearEmissions, + getCarbonValue +); +const getCurrentYearElectricityCarbonValue = pipe( + emissions.selectors.getElectricityEmissions, getCurrentYearEmissions, getCarbonValue ); -const getCurrentYearOtherCarbonValue = pipe( - emissions.selectors.getOtherEmissions, +const getCurrentYearProductScannedCarbonValue = pipe( + emissions.selectors.getProductScanned, + getCurrentYearEmissions, + getCarbonValue +); + +const getCurrentYearCustomCarbonValue = pipe( + emissions.selectors.getCustomEmissions, getCurrentYearEmissions, getCarbonValue ); const getCurrentMonthAllCarbonValue = (state) => - getCurrentMonthTransportCarbonValue(state) + getCurrentMonthFoodCarbonValue(state) + - getCurrentMonthOtherCarbonValue(state); + getCurrentMonthMealCarbonValue(state) + + getCurrentMonthTransportCarbonValue(state) + + getCurrentMonthStreamingCarbonValue(state) + + getCurrentMonthPurchaseCarbonValue(state) + + getCurrentMonthFashionCarbonValue(state) + + getCurrentMonthElectricityCarbonValue(state) + + getCurrentMonthProductScannedCarbonValue(state) + + getCurrentMonthCustomCarbonValue(state); const getCurrentYearAllCarbonValue = (state) => - getCurrentYearTransportCarbonValue(state) + getCurrentYearFoodCarbonValue(state) + - getCurrentYearOtherCarbonValue(state); + getCurrentYearMealCarbonValue(state) + + getCurrentYearTransportCarbonValue(state) + + getCurrentYearStreamingCarbonValue(state) + + getCurrentYearPurchaseCarbonValue(state) + + getCurrentYearFashionCarbonValue(state) + + getCurrentYearElectricityCarbonValue(state) + + getCurrentYearProductScannedCarbonValue(state) + + getCurrentYearCustomCarbonValue(state); export default { getMonthlyCarbonBudget: budget.selectors.getMonthlyCarbonBudget, - getCurrentMonthTransportCarbonValue, getCurrentMonthFoodCarbonValue, - getCurrentMonthOtherCarbonValue, + getCurrentMonthMealCarbonValue, + getCurrentMonthTransportCarbonValue, + getCurrentMonthStreamingCarbonValue, + getCurrentMonthPurchaseCarbonValue, + getCurrentMonthFashionCarbonValue, + getCurrentMonthElectricityCarbonValue, + getCurrentMonthProductScannedCarbonValue, + getCurrentMonthCustomCarbonValue, getCurrentMonthAllCarbonValue, - getCurrentYearTransportCarbonValue, getCurrentYearFoodCarbonValue, - getCurrentYearOtherCarbonValue, + getCurrentYearMealCarbonValue, + getCurrentYearTransportCarbonValue, + getCurrentYearStreamingCarbonValue, + getCurrentYearPurchaseCarbonValue, + getCurrentYearFashionCarbonValue, + getCurrentYearElectricityCarbonValue, + getCurrentYearProductScannedCarbonValue, + getCurrentYearCustomCarbonValue, getCurrentYearAllCarbonValue, }; diff --git a/app/screens/Budget/ducks/__tests__/BudgetScreen.selectors.test.ts b/app/screens/Budget/ducks/__tests__/BudgetScreen.selectors.test.ts index 3fbae66b..24c5f482 100644 --- a/app/screens/Budget/ducks/__tests__/BudgetScreen.selectors.test.ts +++ b/app/screens/Budget/ducks/__tests__/BudgetScreen.selectors.test.ts @@ -1,4 +1,12 @@ -import { FoodType, TransportType } from "carbon-footprint"; +import { + FoodType, + MealType, + TransportType, + StreamingType, + PurchaseType, + FashionType, + ElectricityType, +} from "carbon-footprint"; import moment from "moment"; import { emissions } from "ducks"; @@ -9,73 +17,346 @@ import { selectors } from "../"; let state; -const emissionToday: Emission = { +const emissionFood: Emission = { id: "1", creationDate: moment().utc().toISOString(), emissionModelType: FoodType.beans, emissionType: EmissionType.food, isMitigated: false, - value: 10, + value: 11, }; -const emissionLastMonth: Emission = { - id: "12", - creationDate: moment().subtract(1, "month").utc().toISOString(), +const emissionMeal: Emission = { + id: "2", + creationDate: moment().utc().toISOString(), + emissionModelType: MealType.highMeat, + emissionType: EmissionType.meal, + isMitigated: false, + value: 12, +}; + +const emissionTransport: Emission = { + id: "3", + creationDate: moment().utc().toISOString(), emissionModelType: TransportType.boat, emissionType: EmissionType.transport, isMitigated: false, - value: 100, + value: 13000, +}; + +const emissionStreaming: Emission = { + id: "4", + creationDate: moment().utc().toISOString(), + emissionModelType: StreamingType.ultraHDVideo, + emissionType: EmissionType.streaming, + isMitigated: false, + value: 14000, +}; + +const emissionPurchase: Emission = { + id: "5", + creationDate: moment().utc().toISOString(), + emissionModelType: PurchaseType.computer, + emissionType: EmissionType.purchase, + isMitigated: false, + value: 15, }; -const emissionLastYear: Emission = { - id: "123", - creationDate: moment().subtract(1, "year").utc().toISOString(), - emissionModelType: FoodType.cheese, +const emissionFashion: Emission = { + id: "6", + creationDate: moment().utc().toISOString(), + emissionModelType: FashionType.coat, + emissionType: EmissionType.fashion, + isMitigated: false, + value: 16, +}; + +const emissionElectricity: Emission = { + id: "7", + creationDate: moment().utc().toISOString(), + emissionModelType: ElectricityType.argentina, + emissionType: EmissionType.electricity, + isMitigated: false, + value: 17000000, +}; + +const emissionProductScanned: Emission = { + id: "8", + creationDate: moment().utc().toISOString(), + emissionModelType: "productScanned", + emissionType: EmissionType.productScanned, + isMitigated: false, + value: 18, +}; + +const emissionCustom: Emission = { + id: "9", + creationDate: moment().utc().toISOString(), + emissionModelType: "custom", + emissionType: EmissionType.custom, + isMitigated: false, + value: 19, +}; + +//year + +const emissionFoodYear: Emission = { + id: "11", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: FoodType.beans, emissionType: EmissionType.food, isMitigated: false, - value: 5, + value: 11, +}; + +const emissionMealYear: Emission = { + id: "12", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: MealType.highMeat, + emissionType: EmissionType.meal, + isMitigated: false, + value: 12, +}; + +const emissionTransportYear: Emission = { + id: "13", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: TransportType.boat, + emissionType: EmissionType.transport, + isMitigated: false, + value: 13000, +}; + +const emissionStreamingYear: Emission = { + id: "14", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: StreamingType.ultraHDVideo, + emissionType: EmissionType.streaming, + isMitigated: false, + value: 14000, +}; + +const emissionPurchaseYear: Emission = { + id: "15", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: PurchaseType.computer, + emissionType: EmissionType.purchase, + isMitigated: false, + value: 15, +}; + +const emissionFashionYear: Emission = { + id: "16", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: FashionType.coat, + emissionType: EmissionType.fashion, + isMitigated: false, + value: 16, +}; + +const emissionElectricityYear: Emission = { + id: "17", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: ElectricityType.argentina, + emissionType: EmissionType.electricity, + isMitigated: false, + value: 17000000, +}; + +const emissionProductScannedYear: Emission = { + id: "18", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: "productScanned", + emissionType: EmissionType.productScanned, + isMitigated: false, + value: 18, +}; + +const emissionCustomYear: Emission = { + id: "19", + creationDate: moment().startOf("year").utc().toISOString(), + emissionModelType: "custom", + emissionType: EmissionType.custom, + isMitigated: false, + value: 19, }; describe("if there are emissions", () => { beforeEach(() => { state = { - [emissions.namespace]: [emissionToday, emissionLastMonth, emissionLastYear], + [emissions.namespace]: [ + emissionFood, + emissionMeal, + emissionTransport, + emissionStreaming, + emissionPurchase, + emissionFashion, + emissionElectricity, + emissionProductScanned, + emissionCustom, + emissionFoodYear, + emissionMealYear, + emissionTransportYear, + emissionStreamingYear, + emissionPurchaseYear, + emissionFashionYear, + emissionElectricityYear, + emissionProductScannedYear, + emissionCustomYear, + ], }; }); + test("`getCurrentMonthAllCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthAllCarbonValue(state)).toEqual( + Math.round(calculation.getC02ValueFromEmission(emissionFood)) + + Math.round(calculation.getC02ValueFromEmission(emissionMeal)) + + Math.round(calculation.getC02ValueFromEmission(emissionTransport)) + + Math.round(calculation.getC02ValueFromEmission(emissionStreaming)) + + Math.round(calculation.getC02ValueFromEmission(emissionPurchase)) + + Math.round(calculation.getC02ValueFromEmission(emissionFashion)) + + Math.round(calculation.getC02ValueFromEmission(emissionElectricity)) + + Math.round(calculation.getC02ValueFromEmission(emissionProductScanned)) + + Math.round(calculation.getC02ValueFromEmission(emissionCustom)) + )); + test("`getCurrentMonthFoodCarbonValue` should return CO2 value from today's emission", () => expect(selectors.getCurrentMonthFoodCarbonValue(state)).toEqual( - calculation.getC02ValueFromEmission(emissionToday) + Math.round(calculation.getC02ValueFromEmission(emissionFood)) )); - test("`getCurrentMonthAllCarbonValue` should return CO2 value from today's emission", () => - expect(selectors.getCurrentMonthAllCarbonValue(state)).toEqual( - calculation.getC02ValueFromEmission(emissionToday) + test("`getCurrentMonthMealCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthMealCarbonValue(state)).toEqual( + Math.round(calculation.getC02ValueFromEmission(emissionMeal)) )); - test("`getCurrentMonthOtherCarbonValue` should return CO2 values from today's emission", () => - expect(selectors.getCurrentMonthOtherCarbonValue(state)).toEqual(0)); - test("`getCurrentMonthTransportCarbonValue` should return CO2 values from today's emission", () => - expect(selectors.getCurrentMonthTransportCarbonValue(state)).toEqual(0)); + expect(selectors.getCurrentMonthTransportCarbonValue(state)).toEqual( + Math.round(calculation.getC02ValueFromEmission(emissionTransport)) + )); - test("`getCurrentYearFoodCarbonValue` should return CO2 value from today's emission", () => - expect(selectors.getCurrentYearFoodCarbonValue(state)).toEqual( - calculation.getC02ValueFromEmission(emissionToday) + test("`getCurrentMonthStreamingCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthStreamingCarbonValue(state)).toEqual( + Math.round(calculation.getC02ValueFromEmission(emissionStreaming)) + )); + + test("`getCurrentMonthPurchaseCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthPurchaseCarbonValue(state)).toEqual( + calculation.getC02ValueFromEmission(emissionPurchase) + )); + + test("`getCurrentMonthFashionCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthFashionCarbonValue(state)).toEqual( + calculation.getC02ValueFromEmission(emissionFashion) + )); + + test("`getCurrentMonthElectricityCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthElectricityCarbonValue(state)).toEqual( + Math.round(calculation.getC02ValueFromEmission(emissionElectricity)) )); + test("`getCurrentMonthProductScannedCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthProductScannedCarbonValue(state)).toEqual( + calculation.getC02ValueFromEmission(emissionProductScanned) + )); + + test("`getCurrentMonthCustomCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentMonthCustomCarbonValue(state)).toEqual( + calculation.getC02ValueFromEmission(emissionCustom) + )); + + // last year + test("`getCurrentYearAllCarbonValue` should return CO2 value from today's emission", () => expect(selectors.getCurrentYearAllCarbonValue(state)).toEqual( - Math.round(calculation.getC02ValueFromEmission(emissionToday)) + - Math.round(calculation.getC02ValueFromEmission(emissionLastMonth)) + Math.round(calculation.getC02ValueFromEmission(emissionFood)) + + Math.round(calculation.getC02ValueFromEmission(emissionMeal)) + + Math.round(calculation.getC02ValueFromEmission(emissionTransport)) + + Math.round(calculation.getC02ValueFromEmission(emissionStreaming)) + + Math.round(calculation.getC02ValueFromEmission(emissionPurchase)) + + Math.round(calculation.getC02ValueFromEmission(emissionFashion)) + + Math.round(calculation.getC02ValueFromEmission(emissionElectricity)) + + Math.round(calculation.getC02ValueFromEmission(emissionProductScanned)) + + Math.round(calculation.getC02ValueFromEmission(emissionCustom)) + + Math.round(calculation.getC02ValueFromEmission(emissionFoodYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionMealYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionTransportYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionStreamingYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionPurchaseYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionFashionYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionElectricityYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionProductScannedYear)) + + Math.round(calculation.getC02ValueFromEmission(emissionCustomYear)) )); - test("`getCurrentYearOtherCarbonValue` should return CO2 values from today's emission", () => - expect(selectors.getCurrentYearOtherCarbonValue(state)).toEqual(0)); + test("`getCurrentYearFoodCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearFoodCarbonValue(state)).toEqual( + Math.round( + calculation.getC02ValueFromEmission(emissionFood) + + calculation.getC02ValueFromEmission(emissionFoodYear) + ) + )); + + test("`getCurrentYearMealCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearMealCarbonValue(state)).toEqual( + Math.round( + calculation.getC02ValueFromEmission(emissionMeal) + + calculation.getC02ValueFromEmission(emissionMealYear) + ) + )); test("`getCurrentYearTransportCarbonValue` should return CO2 values from today's emission", () => expect(selectors.getCurrentYearTransportCarbonValue(state)).toEqual( - Math.round(calculation.getC02ValueFromEmission(emissionLastMonth)) + Math.round( + calculation.getC02ValueFromEmission(emissionTransport) + + calculation.getC02ValueFromEmission(emissionTransportYear) + ) + )); + + test("`getCurrentYearStreamingCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearStreamingCarbonValue(state)).toEqual( + Math.round( + calculation.getC02ValueFromEmission(emissionStreaming) + + calculation.getC02ValueFromEmission(emissionStreamingYear) + ) + )); + + test("`getCurrentYearPurchaseCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearPurchaseCarbonValue(state)).toEqual( + Math.round( + calculation.getC02ValueFromEmission(emissionPurchase) + + calculation.getC02ValueFromEmission(emissionPurchaseYear) + ) + )); + + test("`getCurrentYearFashionCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearFashionCarbonValue(state)).toEqual( + Math.round( + calculation.getC02ValueFromEmission(emissionFashion) + + calculation.getC02ValueFromEmission(emissionFashionYear) + ) + )); + + test("`getCurrentYearElectricityCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearElectricityCarbonValue(state)).toEqual( + Math.round( + calculation.getC02ValueFromEmission(emissionElectricity) + + calculation.getC02ValueFromEmission(emissionElectricityYear) + ) + )); + + test("`getCurrentYearProductScannedCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearProductScannedCarbonValue(state)).toEqual( + Math.round( + calculation.getC02ValueFromEmission(emissionProductScanned) + + calculation.getC02ValueFromEmission(emissionProductScannedYear) + ) + )); + + test("`getCurrentYearCustomCarbonValue` should return CO2 value from today's emission", () => + expect(selectors.getCurrentYearCustomCarbonValue(state)).toEqual( + calculation.getC02ValueFromEmission(emissionCustom) + + calculation.getC02ValueFromEmission(emissionCustomYear) )); }); @@ -89,24 +370,61 @@ describe("if there are no emissions", () => { test("`getCurrentMonthFoodCarbonValue` should return 0", () => expect(selectors.getCurrentMonthFoodCarbonValue(state)).toEqual(0)); - test("`getCurrentMonthAllCarbonValue` should return 0", () => - expect(selectors.getCurrentMonthAllCarbonValue(state)).toEqual(0)); - - test("`getCurrentMonthOtherCarbonValue` should return 0", () => - expect(selectors.getCurrentMonthOtherCarbonValue(state)).toEqual(0)); + test("`getCurrentMonthMealCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthMealCarbonValue(state)).toEqual(0)); test("`getCurrentMonthTransportCarbonValue` should return 0", () => expect(selectors.getCurrentMonthTransportCarbonValue(state)).toEqual(0)); + test("`getCurrentMonthStreamingCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthStreamingCarbonValue(state)).toEqual(0)); + + test("`getCurrentMonthPurchaseCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthPurchaseCarbonValue(state)).toEqual(0)); + + test("`getCurrentMonthFashionCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthFashionCarbonValue(state)).toEqual(0)); + + test("`getCurrentMonthElectricityCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthElectricityCarbonValue(state)).toEqual(0)); + + test("`getCurrentMonthProductScannedCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthProductScannedCarbonValue(state)).toEqual(0)); + + test("`getCurrentMonthCustomCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthCustomCarbonValue(state)).toEqual(0)); + + //year test("`getCurrentYearFoodCarbonValue` should return 0", () => expect(selectors.getCurrentYearFoodCarbonValue(state)).toEqual(0)); - test("`getCurrentYearAllCarbonValue` should return 0", () => - expect(selectors.getCurrentYearAllCarbonValue(state)).toEqual(0)); - - test("`getCurrentYearOtherCarbonValue` should return 0", () => - expect(selectors.getCurrentYearOtherCarbonValue(state)).toEqual(0)); + test("`getCurrentYearMealCarbonValue` should return 0", () => + expect(selectors.getCurrentYearMealCarbonValue(state)).toEqual(0)); test("`getCurrentYearTransportCarbonValue` should return 0", () => expect(selectors.getCurrentYearTransportCarbonValue(state)).toEqual(0)); + + test("`getCurrentYearStreamingCarbonValue` should return 0", () => + expect(selectors.getCurrentYearStreamingCarbonValue(state)).toEqual(0)); + + test("`getCurrentYearPurchaseCarbonValue` should return 0", () => + expect(selectors.getCurrentYearPurchaseCarbonValue(state)).toEqual(0)); + + test("`getCurrentYearFashionCarbonValue` should return 0", () => + expect(selectors.getCurrentYearFashionCarbonValue(state)).toEqual(0)); + + test("`getCurrentYearElectricityCarbonValue` should return 0", () => + expect(selectors.getCurrentYearElectricityCarbonValue(state)).toEqual(0)); + + test("`getCurrentYearProductScannedCarbonValue` should return 0", () => + expect(selectors.getCurrentYearProductScannedCarbonValue(state)).toEqual(0)); + + test("`getCurrentYearCustomCarbonValue` should return 0", () => + expect(selectors.getCurrentYearCustomCarbonValue(state)).toEqual(0)); + + test("`getCurrentYearAllCarbonValue` should return 0", () => + expect(selectors.getCurrentYearAllCarbonValue(state)).toEqual(0)); + + test("`getCurrentMonthAllCarbonValue` should return 0", () => + expect(selectors.getCurrentMonthAllCarbonValue(state)).toEqual(0)); }); diff --git a/app/screens/Budget/translations/da.json b/app/screens/Budget/translations/da.json index 39604584..29fad008 100644 --- a/app/screens/Budget/translations/da.json +++ b/app/screens/Budget/translations/da.json @@ -1,13 +1,12 @@ { - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dage", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Det er en god start! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Det ser ud til at Du ikke har spist kød eller fisk siden du startede med at bruge appen, godt arbejde! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Åh nej, du har næsten lige spist kød eller fisk 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Godt arbejde! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Mad", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Andet", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Totalt", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget til ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Tilføj dit månedlige budget" -} \ No newline at end of file + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dage", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Det er en god start! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Det ser ud til at Du ikke har spist kød eller fisk siden du startede med at bruge appen, godt arbejde! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Åh nej, du har næsten lige spist kød eller fisk 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Godt arbejde! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Mad", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Totalt", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget til ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Tilføj dit månedlige budget" +} diff --git a/app/screens/Budget/translations/de.json b/app/screens/Budget/translations/de.json index 0b4db12f..0041a50f 100644 --- a/app/screens/Budget/translations/de.json +++ b/app/screens/Budget/translations/de.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_TAB_NAME": "Budget", - "BUDGET_SCREEN_TITLE": "Carbon Budget", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Gesamt", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Verkehrsmittel", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Essen", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Anderes", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget für ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Monatliches Budget festlegen", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh nein, du hast letztens Fleisch oder Fisch gegessen 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Das ist ein guter Anfang! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Toll gemacht! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Du hast weder Fleisch, noch Fisch gegessen seit du die App benutzt. Super gemacht! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "Tage", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish." -} \ No newline at end of file + "BUDGET_SCREEN_TAB_NAME": "Budget", + "BUDGET_SCREEN_TITLE": "Carbon Budget", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Gesamt", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Verkehrsmittel", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Essen", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget für ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Monatliches Budget festlegen", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh nein, du hast letztens Fleisch oder Fisch gegessen 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Das ist ein guter Anfang! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Toll gemacht! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Du hast weder Fleisch, noch Fisch gegessen seit du die App benutzt. Super gemacht! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "Tage", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish." +} diff --git a/app/screens/Budget/translations/en.json b/app/screens/Budget/translations/en.json index 21a0a43e..9db0e13f 100644 --- a/app/screens/Budget/translations/en.json +++ b/app/screens/Budget/translations/en.json @@ -1,16 +1,22 @@ { - "BUDGET_SCREEN_TAB_NAME": "Budget", - "BUDGET_SCREEN_TITLE": "Carbon Budget", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Food", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Other", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget for ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Set monthly budget", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh no, you have recently eaten meat or fish 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "That's a nice start! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Well done! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Seems like you haven't eaten any meat nor fish since using the app, good job! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "days", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish." -} \ No newline at end of file + "BUDGET_SCREEN_TAB_NAME": "Budget", + "BUDGET_SCREEN_TITLE": "Carbon Budget", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Food", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_MEAL": "Meal", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_STREAMING": "Streaming", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_PURCHASE": "Purchase", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FASHION": "Fashion", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_ELECTRICITY": "Electricity", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_PRODUCT_SCANNED": "Product Scanned", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_CUSTOM": "Custom", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget for ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Set monthly budget", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh no, you have recently eaten meat or fish 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "That's a nice start! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Well done! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Seems like you haven't eaten any meat nor fish since using the app, good job! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "days", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish." +} diff --git a/app/screens/Budget/translations/es.json b/app/screens/Budget/translations/es.json index b800bd93..746b16ac 100644 --- a/app/screens/Budget/translations/es.json +++ b/app/screens/Budget/translations/es.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_TAB_NAME": "Presupuesto", - "BUDGET_SCREEN_TITLE": "Presupuesto de carbono", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transporte", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Comida", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Otros", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Presupuesto para ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Establecer presupuesto mensual", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh no, recientemente has comido carne o pescado 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "¡Ese es un buen comienzo! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "¡Bien hecho! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Parece que no has comido carne o pescado desde que usas la app, ¡gran trabajo! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "días", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "sin carne o pescado." -} \ No newline at end of file + "BUDGET_SCREEN_TAB_NAME": "Presupuesto", + "BUDGET_SCREEN_TITLE": "Presupuesto de carbono", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transporte", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Comida", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Presupuesto para ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Establecer presupuesto mensual", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh no, recientemente has comido carne o pescado 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "¡Ese es un buen comienzo! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "¡Bien hecho! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Parece que no has comido carne o pescado desde que usas la app, ¡gran trabajo! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "días", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "sin carne o pescado." +} diff --git a/app/screens/Budget/translations/fr.json b/app/screens/Budget/translations/fr.json index 5079b860..0d6de221 100644 --- a/app/screens/Budget/translations/fr.json +++ b/app/screens/Budget/translations/fr.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_TAB_NAME": "Budget", - "BUDGET_SCREEN_TITLE": "Budget Carbone", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Nourriture", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Autre", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget pour ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Choisir le budget mensuel", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh non, vous avez récemment mangé de la viande ou du poisson 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "C'est un bon début ! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Bravo ! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "On dirait que vous n'avez pas mangé de viande ni de poisson depuis que vous utilisé l'application, bien joué! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "jours", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "sans viande ni poisson." -} \ No newline at end of file + "BUDGET_SCREEN_TAB_NAME": "Budget", + "BUDGET_SCREEN_TITLE": "Budget Carbone", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Nourriture", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget pour ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Choisir le budget mensuel", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh non, vous avez récemment mangé de la viande ou du poisson 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "C'est un bon début ! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Bravo ! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "On dirait que vous n'avez pas mangé de viande ni de poisson depuis que vous utilisé l'application, bien joué! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "jours", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "sans viande ni poisson." +} diff --git a/app/screens/Budget/translations/index.ts b/app/screens/Budget/translations/index.ts index b96b5923..bf1fd903 100644 --- a/app/screens/Budget/translations/index.ts +++ b/app/screens/Budget/translations/index.ts @@ -14,9 +14,15 @@ interface TranslationKeys { BUDGET_SCREEN_TAB_NAME: string; BUDGET_SCREEN_TITLE: string; BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL: string; - BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT: string; BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD: string; - BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_MEAL: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_STREAMING: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_PURCHASE: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FASHION: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_ELECTRICITY: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_PRODUCT_SCANNED: string; + BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_CUSTOM: string; BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET: string; BUDGET_SCREEN_SET_MONTHLY_BUDGET: string; BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT: string; diff --git a/app/screens/Budget/translations/ms.json b/app/screens/Budget/translations/ms.json index ddbffe77..e6eee7f5 100644 --- a/app/screens/Budget/translations/ms.json +++ b/app/screens/Budget/translations/ms.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_TAB_NAME": "Anggaran", - "BUDGET_SCREEN_TITLE": "Anggaran Karbon", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Jumlah", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Pengangkutan", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Makanan", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Lain-lain", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Anggaran bagi ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Tetapkan belanjawan bulanan", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Alamak, anda telah termakan daging atau ikan baru-baru ini 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Itulah permulaan yang baik!", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Syabas! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Nampaknya anda sudah tidak makan daging atau ikan sejak guna aplikasi ini, syabas!", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "hari", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "tanpa daging atau ikan." -} \ No newline at end of file + "BUDGET_SCREEN_TAB_NAME": "Anggaran", + "BUDGET_SCREEN_TITLE": "Anggaran Karbon", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Jumlah", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Pengangkutan", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Makanan", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Anggaran bagi ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Tetapkan belanjawan bulanan", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Alamak, anda telah termakan daging atau ikan baru-baru ini 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Itulah permulaan yang baik!", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Syabas! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Nampaknya anda sudah tidak makan daging atau ikan sejak guna aplikasi ini, syabas!", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "hari", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "tanpa daging atau ikan." +} diff --git a/app/screens/Budget/translations/pl.json b/app/screens/Budget/translations/pl.json index 67400996..d12c6b4e 100644 --- a/app/screens/Budget/translations/pl.json +++ b/app/screens/Budget/translations/pl.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dni", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "To dobry początek! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Wygląda na to, że nie jadłaś/eś żadnego mięsa ani ryby, odkąd używasz aplikacji, świetna robota! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "O nie, jadłaś/eś ostatnio mięso lub rybę 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Świetnie! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Żywność", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Inne", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Suma", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budżet na ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Ustaw miesięczny budżet", - "BUDGET_SCREEN_TAB_NAME": "Budżet", - "BUDGET_SCREEN_TITLE": "Budżet węglowy" -} \ No newline at end of file + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dni", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "To dobry początek! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Wygląda na to, że nie jadłaś/eś żadnego mięsa ani ryby, odkąd używasz aplikacji, świetna robota! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "O nie, jadłaś/eś ostatnio mięso lub rybę 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Świetnie! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Żywność", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Suma", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budżet na ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Ustaw miesięczny budżet", + "BUDGET_SCREEN_TAB_NAME": "Budżet", + "BUDGET_SCREEN_TITLE": "Budżet węglowy" +} diff --git a/app/screens/Budget/translations/pt.json b/app/screens/Budget/translations/pt.json index 54c4247a..3ae2b33d 100644 --- a/app/screens/Budget/translations/pt.json +++ b/app/screens/Budget/translations/pt.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dias", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "É um bom começo! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Parece que você não comeu carne ou peixe desde que usou o aplicativo. Muito bem! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh não comeu carne ou peixe recentemente 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Bravo! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "sem carne ou peixe.", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Comida", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Outro", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transporte", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "orçamento para...", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Escolher um orçamento mensal ", - "BUDGET_SCREEN_TAB_NAME": "Orçamento", - "BUDGET_SCREEN_TITLE": "Orçamento de carbono" -} \ No newline at end of file + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dias", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "É um bom começo! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Parece que você não comeu carne ou peixe desde que usou o aplicativo. Muito bem! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Oh não comeu carne ou peixe recentemente 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Bravo! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "sem carne ou peixe.", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Comida", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Total", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transporte", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "orçamento para...", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Escolher um orçamento mensal ", + "BUDGET_SCREEN_TAB_NAME": "Orçamento", + "BUDGET_SCREEN_TITLE": "Orçamento de carbono" +} diff --git a/app/screens/Budget/translations/ru.json b/app/screens/Budget/translations/ru.json index 70f6ea70..a163cad1 100644 --- a/app/screens/Budget/translations/ru.json +++ b/app/screens/Budget/translations/ru.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "дней", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Вот это начало! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Видимо, что вы не едите мясо или рыбу с тех пор, как испоьзуете приложение, отличная работа! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Блинчики, вы съели недавно мясо или рыбу 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Отлично! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Еда", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Другое", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Всего", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Транспорт", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Бюджет для ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Установить месячный бюджет", - "BUDGET_SCREEN_TAB_NAME": "Бюджет", - "BUDGET_SCREEN_TITLE": "Углеродный бюджет" -} \ No newline at end of file + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "дней", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Вот это начало! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Видимо, что вы не едите мясо или рыбу с тех пор, как испоьзуете приложение, отличная работа! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Блинчики, вы съели недавно мясо или рыбу 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Отлично! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Еда", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Всего", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Транспорт", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Бюджет для ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Установить месячный бюджет", + "BUDGET_SCREEN_TAB_NAME": "Бюджет", + "BUDGET_SCREEN_TITLE": "Углеродный бюджет" +} diff --git a/app/screens/Budget/translations/sv.json b/app/screens/Budget/translations/sv.json index 15a66361..16bb6874 100644 --- a/app/screens/Budget/translations/sv.json +++ b/app/screens/Budget/translations/sv.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dagar", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Bra start! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Verkar som du inte ätit något kött eller fisk sedan du började använda appen, bra jobbat! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Å, nej, du har nyligen ätit kött eller fisk 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Bra gjort! 🎉", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Mat", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "Annat", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Totalt", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget för ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Ställ in månadsbudget", - "BUDGET_SCREEN_TAB_NAME": "Budget", - "BUDGET_SCREEN_TITLE": "Koldioxidbudget" -} \ No newline at end of file + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "dagar", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "Bra start! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "Verkar som du inte ätit något kött eller fisk sedan du började använda appen, bra jobbat! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "Å, nej, du har nyligen ätit kött eller fisk 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "without meat or fish.", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "Bra gjort! 🎉", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "Mat", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "Totalt", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "Transport", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "Budget för ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "Ställ in månadsbudget", + "BUDGET_SCREEN_TAB_NAME": "Budget", + "BUDGET_SCREEN_TITLE": "Koldioxidbudget" +} diff --git a/app/screens/Budget/translations/zh.json b/app/screens/Budget/translations/zh.json index 1077d97b..9d51d946 100644 --- a/app/screens/Budget/translations/zh.json +++ b/app/screens/Budget/translations/zh.json @@ -1,16 +1,15 @@ { - "BUDGET_SCREEN_TAB_NAME": "预算", - "BUDGET_SCREEN_TITLE": "碳排放预算", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "总额", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "交通", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "食物", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_OTHER": "其他", - "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "预算: ", - "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "设置每月预算", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "哎呀,您最近食用了鱼或者肉类 🥺", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "这是一个好的开始! 👌", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "非常棒! 🎉", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "自从您使用了这个应用程序之后再也没有食用鱼与肉类了,很好! 🍾", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "天", - "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "没有鱼与肉类。" -} \ No newline at end of file + "BUDGET_SCREEN_TAB_NAME": "预算", + "BUDGET_SCREEN_TITLE": "碳排放预算", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TOTAL": "总额", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_TRANSPORT": "交通", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_ITEM_FOOD": "食物", + "BUDGET_SCREEN_PROGRESS_CHART_LEGEND_PERIOD_BUDGET": "预算: ", + "BUDGET_SCREEN_SET_MONTHLY_BUDGET": "设置每月预算", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_RECENT_MEAT": "哎呀,您最近食用了鱼或者肉类 🥺", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NICE_START": "这是一个好的开始! 👌", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WELL_DONE": "非常棒! 🎉", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_NO_MEAT_SO_FAR": "自从您使用了这个应用程序之后再也没有食用鱼与肉类了,很好! 🍾", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_DAYS": "天", + "BUDGET_SCREEN_NUMBER_OF_DAYS_VEGETARIAN_WITHOUT_MEAT": "没有鱼与肉类。" +} diff --git a/app/screens/MonthlyBudget/MonthlyBudgetScreen.tsx b/app/screens/MonthlyBudget/MonthlyBudgetScreen.tsx index 314cb916..899beead 100644 --- a/app/screens/MonthlyBudget/MonthlyBudgetScreen.tsx +++ b/app/screens/MonthlyBudget/MonthlyBudgetScreen.tsx @@ -16,7 +16,7 @@ import { NavStatelessComponent } from "interfaces"; import styles from "./MonthlyBudgetScreen.styles"; import navigationOptions from "./MonthlyBudgetScreen.navigationOptions"; -const MIN_MONTHLY_CARBON_BUDGET = 0; +const MIN_MONTHLY_CARBON_BUDGET = 10; const MAX_MONTHLY_CARBON_BUDGET = 1000; const translationMontlyBudgetCountries = [ diff --git a/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap b/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap index 49507b81..c4ff4270 100644 --- a/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap +++ b/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap @@ -34,7 +34,7 @@ exports[`MonthlyBudgetScreen renders correctly 1`] = ` maximumTrackTintColor="#CED4DA" maximumValue={1000} minimumTrackTintColor="#4BB377" - minimumValue={0} + minimumValue={10} onChange={null} onRNCSliderSlidingComplete={[Function]} onRNCSliderSlidingStart={null} @@ -198,7 +198,7 @@ exports[`MonthlyBudgetScreen renders correctly 1`] = ` - If you wish to respect the Paris agreement (to keep the rise in global average temperature below 2 degrees), set your monthly budget at + If you wish to respect the Paris agreement (to keep the rise in global average temperature below 2 degrees), set your monthly budget at 167 kgCO2eq