diff --git a/.vscode/settings.json b/.vscode/settings.json index 63ec24df..5bde7840 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" } } \ No newline at end of file diff --git a/app/components/Accordion/Accordion.tsx b/app/components/Accordion/Accordion.tsx index 74168ee7..6a3941e7 100644 --- a/app/components/Accordion/Accordion.tsx +++ b/app/components/Accordion/Accordion.tsx @@ -20,7 +20,7 @@ interface AccordionProps { const Item: FC = ({ title, children, isFirst, isOpen, onTitlePress }) => ( - + {title} diff --git a/app/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap b/app/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap index e2044555..a62741a1 100644 --- a/app/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap +++ b/app/components/Accordion/__tests__/__snapshots__/Accordion.test.tsx.snap @@ -70,6 +70,7 @@ exports[`Accordion renders correctly 1`] = ` "color": "#3957D0", } } + suppressHighlighting={true} /> (props) => { if (icon) { iconItem = ( `; @@ -287,6 +288,7 @@ exports[`renders correctly fullwidth Primary Button with icon 1`] = ` "marginHorizontal": 10, } } + suppressHighlighting={true} /> `; @@ -380,6 +382,7 @@ exports[`renders correctly fullwidth Secondary Button with icon 1`] = ` "marginHorizontal": 10, } } + suppressHighlighting={true} /> `; diff --git a/app/components/EmissionListItem/EmissionListItem.tsx b/app/components/EmissionListItem/EmissionListItem.tsx index 63171fdd..ac228ee4 100644 --- a/app/components/EmissionListItem/EmissionListItem.tsx +++ b/app/components/EmissionListItem/EmissionListItem.tsx @@ -29,7 +29,7 @@ interface EmissionListItemProps extends Partial { const EmissionListItem: React.FC = ({ isMitigated, name = "", - iconName = "md-car", + iconName = "car", title = "", co2value = 0, onPress, @@ -45,6 +45,7 @@ const EmissionListItem: React.FC = ({ = ({ @@ -147,13 +149,14 @@ exports[`EmissionListItem renders correctly with audio icon 1`] = ` /> @@ -244,13 +248,14 @@ exports[`EmissionListItem renders correctly with boat icon 1`] = ` /> @@ -341,13 +347,14 @@ exports[`EmissionListItem renders correctly with bus icon 1`] = ` /> @@ -438,13 +446,14 @@ exports[`EmissionListItem renders correctly with car icon 1`] = ` /> @@ -535,13 +545,14 @@ exports[`EmissionListItem renders correctly with card icon 1`] = ` /> @@ -632,13 +644,14 @@ exports[`EmissionListItem renders correctly with chocolate icon 1`] = ` /> @@ -729,13 +743,14 @@ exports[`EmissionListItem renders correctly with coffee icon 1`] = ` /> @@ -826,13 +842,14 @@ exports[`EmissionListItem renders correctly with electricity icon 1`] = ` /> @@ -923,13 +941,14 @@ exports[`EmissionListItem renders correctly with fish icon 1`] = ` /> @@ -1020,13 +1040,14 @@ exports[`EmissionListItem renders correctly with full hd video icon 1`] = ` /> @@ -1117,13 +1139,14 @@ exports[`EmissionListItem renders correctly with hd video icon 1`] = ` /> @@ -1214,13 +1238,14 @@ exports[`EmissionListItem renders correctly with longHaulFlight icon 1`] = ` /> @@ -1311,13 +1337,14 @@ exports[`EmissionListItem renders correctly with meal icon 1`] = ` /> @@ -1408,13 +1436,14 @@ exports[`EmissionListItem renders correctly with mediumHaulFlight icon 1`] = ` /> @@ -1505,13 +1535,14 @@ exports[`EmissionListItem renders correctly with motorbike icon 1`] = ` /> @@ -1602,13 +1634,14 @@ exports[`EmissionListItem renders correctly with redMeat icon 1`] = ` /> @@ -1699,13 +1733,14 @@ exports[`EmissionListItem renders correctly with shirt icon 1`] = ` /> @@ -1796,13 +1832,14 @@ exports[`EmissionListItem renders correctly with shortHaulFlight icon 1`] = ` /> @@ -1893,13 +1931,14 @@ exports[`EmissionListItem renders correctly with train icon 1`] = ` /> @@ -1990,13 +2030,14 @@ exports[`EmissionListItem renders correctly with ultra hd video icon 1`] = ` /> @@ -2087,13 +2129,14 @@ exports[`EmissionListItem renders correctly with whiteMeat icon 1`] = ` /> diff --git a/app/components/InfoButton/InfoButton.tsx b/app/components/InfoButton/InfoButton.tsx index 23c7a400..55f2d84e 100644 --- a/app/components/InfoButton/InfoButton.tsx +++ b/app/components/InfoButton/InfoButton.tsx @@ -21,7 +21,8 @@ const InfoButton: React.FC = () => { return ( navigator.openInfoModal({ emissionModelType })} diff --git a/app/components/InfoButton/__tests__/__snapshots__/InfoButton.test.tsx.snap b/app/components/InfoButton/__tests__/__snapshots__/InfoButton.test.tsx.snap index 1590bcfc..8369f9b9 100644 --- a/app/components/InfoButton/__tests__/__snapshots__/InfoButton.test.tsx.snap +++ b/app/components/InfoButton/__tests__/__snapshots__/InfoButton.test.tsx.snap @@ -2,7 +2,7 @@ exports[`renders correctly 1`] = ` `; diff --git a/app/components/ListItem/ListItem.tsx b/app/components/ListItem/ListItem.tsx index 739a1c20..6b5290e3 100644 --- a/app/components/ListItem/ListItem.tsx +++ b/app/components/ListItem/ListItem.tsx @@ -28,7 +28,7 @@ const ListItem: React.FC = ({ title, onPress, showTopLine, showBottomLine return ( {title} - + ); }; diff --git a/app/components/ListItem/__tests__/__snapshots__/ListItem.test.tsx.snap b/app/components/ListItem/__tests__/__snapshots__/ListItem.test.tsx.snap index a7317278..f37ff2f3 100644 --- a/app/components/ListItem/__tests__/__snapshots__/ListItem.test.tsx.snap +++ b/app/components/ListItem/__tests__/__snapshots__/ListItem.test.tsx.snap @@ -30,8 +30,9 @@ exports[` ListItem renders correctly both topLine and bottomLine 1`] `; @@ -62,8 +63,9 @@ exports[` ListItem renders correctly wtesth bottomLine 1`] = ` `; @@ -94,8 +96,9 @@ exports[` ListItem renders correctly wtesth topLine 1`] = ` `; @@ -122,8 +125,9 @@ exports[` render 1`] = ` `; diff --git a/app/components/SelectableListItem/SelectableListItem.tsx b/app/components/SelectableListItem/SelectableListItem.tsx index f311e8d4..36143ca6 100644 --- a/app/components/SelectableListItem/SelectableListItem.tsx +++ b/app/components/SelectableListItem/SelectableListItem.tsx @@ -20,7 +20,7 @@ const SelectableListItem: React.FC = ({ selected, title, onPress }) => { {title} {selected && ( - + )} ); diff --git a/app/components/SelectableListItem/__tests__/__snapshots__/SelectableListItem.test.tsx.snap b/app/components/SelectableListItem/__tests__/__snapshots__/SelectableListItem.test.tsx.snap index dd0e8aa0..5a7fcb98 100644 --- a/app/components/SelectableListItem/__tests__/__snapshots__/SelectableListItem.test.tsx.snap +++ b/app/components/SelectableListItem/__tests__/__snapshots__/SelectableListItem.test.tsx.snap @@ -24,13 +24,14 @@ exports[` render 1`] = ` `; @@ -59,13 +60,14 @@ exports[` render if not selected 1`] = ` `; diff --git a/app/components/TabBarIcon/TabBarIcon.tsx b/app/components/TabBarIcon/TabBarIcon.tsx index 8da5a732..c6d1c0af 100644 --- a/app/components/TabBarIcon/TabBarIcon.tsx +++ b/app/components/TabBarIcon/TabBarIcon.tsx @@ -11,6 +11,7 @@ interface Props { export default function TabBarIcon(props: Props): ReactElement { return ( `; diff --git a/app/components/Tag/Tag.tsx b/app/components/Tag/Tag.tsx index 42003557..7354a989 100644 --- a/app/components/Tag/Tag.tsx +++ b/app/components/Tag/Tag.tsx @@ -19,6 +19,7 @@ const Tag: React.FC = ({ text, onPress, icon }) => { if (icon) { iconItem = ( = ({ text, onPress, icon }) => { {text} - + ); }; diff --git a/app/components/Tag/__stories__/Tag.story.tsx b/app/components/Tag/__stories__/Tag.story.tsx index af2e4bad..7752cb81 100644 --- a/app/components/Tag/__stories__/Tag.story.tsx +++ b/app/components/Tag/__stories__/Tag.story.tsx @@ -11,11 +11,11 @@ // }; // const iconOptions = { -// airplane: "md-airplane", -// restaurant: "md-restaurant", -// build: "md-build", -// circle: "md-play-circle", -// flash: "md-flash", +// airplane: "airplane", +// restaurant: "restaurant", +// build: "build", +// circle: "play-circle", +// flash: "flash", // }; // const container: ViewStyle = { flexDirection: "row", margin: 20 }; @@ -31,7 +31,7 @@ // // // ); diff --git a/app/components/Tag/__tests__/Tag.test.tsx b/app/components/Tag/__tests__/Tag.test.tsx index 9fdddfd8..9bc3cba5 100644 --- a/app/components/Tag/__tests__/Tag.test.tsx +++ b/app/components/Tag/__tests__/Tag.test.tsx @@ -26,6 +26,6 @@ it("Tag renders correctly with no icon", () => { /* WITH ICON */ it("Tag renders correctly with airplane icon", () => { - const tree = create().toJSON(); + const tree = create().toJSON(); expect(tree).toMatchSnapshot(); }); diff --git a/app/components/Tag/__tests__/__snapshots__/Tag.test.tsx.snap b/app/components/Tag/__tests__/__snapshots__/Tag.test.tsx.snap index edad9228..cf8f7590 100644 --- a/app/components/Tag/__tests__/__snapshots__/Tag.test.tsx.snap +++ b/app/components/Tag/__tests__/__snapshots__/Tag.test.tsx.snap @@ -21,13 +21,14 @@ exports[`Tag renders correctly with airplane icon 1`] = ` > `; @@ -94,6 +96,7 @@ exports[`Tag renders correctly with no icon 1`] = ` color="#0F853B" name="chevron-forward" size={20} + suppressHighlighting={true} /> `; diff --git a/app/components/TextButton/TextButton.tsx b/app/components/TextButton/TextButton.tsx index 3413a2cd..d6d0d160 100644 --- a/app/components/TextButton/TextButton.tsx +++ b/app/components/TextButton/TextButton.tsx @@ -19,7 +19,7 @@ const TextButton: React.FC = ({ onPress, iconLeft, text }) => { return ( - + @@ -27,7 +27,7 @@ const TextButton: React.FC = ({ onPress, iconLeft, text }) => { - + ); diff --git a/app/components/TextButton/__tests__/__snapshots__/TextButton.test.tsx.snap b/app/components/TextButton/__tests__/__snapshots__/TextButton.test.tsx.snap index cd8e74a7..f697208e 100644 --- a/app/components/TextButton/__tests__/__snapshots__/TextButton.test.tsx.snap +++ b/app/components/TextButton/__tests__/__snapshots__/TextButton.test.tsx.snap @@ -23,6 +23,7 @@ exports[`TextButton renders correctly with camera icon 1`] = ` color="#3957D0" name="camera" size={20} + suppressHighlighting={true} /> @@ -82,6 +84,7 @@ exports[`TextButton renders correctly with repeat icon 1`] = ` color="#3957D0" name="repeat" size={20} + suppressHighlighting={true} /> diff --git a/app/components/TextInput/TextInput.tsx b/app/components/TextInput/TextInput.tsx index fbc8c9d1..3997a0f9 100644 --- a/app/components/TextInput/TextInput.tsx +++ b/app/components/TextInput/TextInput.tsx @@ -25,7 +25,7 @@ const TextInput: React.FC = ({ isOptional, onChangeText, value, placehold style={styles.containerOptionalTitle} > {isOptional && ( - + )} {title} diff --git a/app/navigation/Navigator/BottomTabNavigator.tsx b/app/navigation/Navigator/BottomTabNavigator.tsx index 3579f465..b258654c 100644 --- a/app/navigation/Navigator/BottomTabNavigator.tsx +++ b/app/navigation/Navigator/BottomTabNavigator.tsx @@ -16,28 +16,28 @@ const BottomTab = createBottomTabNavigator(); const BudgetOptions = { tabBarLabel: t("BUDGET_SCREEN_TAB_NAME"), - tabBarIcon: ({ focused }) => , + tabBarIcon: ({ focused }) => , }; const EmissionsOptions = { tabBarLabel: t("EMISSIONS_SCREEN_TAB_NAME"), - tabBarIcon: ({ focused }) => , + tabBarIcon: ({ focused }) => , }; const ActOptions = { tabBarLabel: t("ACT_SCREEN_TAB_NAME"), - tabBarIcon: ({ focused }) => , + tabBarIcon: ({ focused }) => , }; const SettingsOptions = { tabBarLabel: t("SETTINGS_SCREEN_TAB_NAME"), - tabBarIcon: ({ focused }) => , + tabBarIcon: ({ focused }) => , }; const AddEmissionOptions = { showLabel: false, tabBarLabel: t("ADD_EMISSION_SCREEN_TAB_NAME"), - tabBarIcon: ({ focused }) => , + tabBarIcon: ({ focused }) => , }; const BottomTabNavigator = (): React.ReactElement => { diff --git a/app/screens/CategorySelection/__tests__/__snapshots__/CategorySelectionScreen.tests.tsx.snap b/app/screens/CategorySelection/__tests__/__snapshots__/CategorySelectionScreen.tests.tsx.snap index 923e74e6..bd264c01 100644 --- a/app/screens/CategorySelection/__tests__/__snapshots__/CategorySelectionScreen.tests.tsx.snap +++ b/app/screens/CategorySelection/__tests__/__snapshots__/CategorySelectionScreen.tests.tsx.snap @@ -22,12 +22,12 @@ exports[`CategorySelectionScreen renders correctly 1`] = ` Select a category @@ -37,32 +37,32 @@ exports[`CategorySelectionScreen renders correctly 1`] = ` text="Scan product" /> diff --git a/app/screens/CategorySelection/categoryList.tsx b/app/screens/CategorySelection/categoryList.tsx index ec036018..d0ce7ef1 100644 --- a/app/screens/CategorySelection/categoryList.tsx +++ b/app/screens/CategorySelection/categoryList.tsx @@ -2,11 +2,11 @@ import { EmissionType } from "interfaces"; const categories = [ { - icon: "md-restaurant", + icon: "restaurant", emissionType: EmissionType.meal, }, { - icon: "md-airplane", + icon: "airplane", emissionType: EmissionType.transport, }, { @@ -14,27 +14,27 @@ const categories = [ emissionType: EmissionType.productScanned, }, { - icon: "md-play-circle", + icon: "play-circle", emissionType: EmissionType.streaming, }, { - icon: "md-card", + icon: "card", emissionType: EmissionType.purchase, }, { - icon: "md-shirt", + icon: "shirt", emissionType: EmissionType.fashion, }, { - icon: "md-nutrition", + icon: "nutrition", emissionType: EmissionType.food, }, { - icon: "md-flash", + icon: "flash", emissionType: EmissionType.electricity, }, { - icon: "md-build", + icon: "build", emissionType: EmissionType.custom, }, ]; diff --git a/app/screens/ComingSoon/ComingSoonScreen.navigationOptions.tsx b/app/screens/ComingSoon/ComingSoonScreen.navigationOptions.tsx index 38c95ab4..7541baba 100644 --- a/app/screens/ComingSoon/ComingSoonScreen.navigationOptions.tsx +++ b/app/screens/ComingSoon/ComingSoonScreen.navigationOptions.tsx @@ -29,7 +29,8 @@ const navigationOptionsIOS = ({ navigation }): StackNavigationOptions => ({ headerRight: () => ( { diff --git a/app/screens/Emissions/__tests__/__snapshots__/EmissionsScreen.test.tsx.snap b/app/screens/Emissions/__tests__/__snapshots__/EmissionsScreen.test.tsx.snap index f9f7660f..f9e1e556 100644 --- a/app/screens/Emissions/__tests__/__snapshots__/EmissionsScreen.test.tsx.snap +++ b/app/screens/Emissions/__tests__/__snapshots__/EmissionsScreen.test.tsx.snap @@ -12,7 +12,7 @@ exports[`EmissionsScreen renders correctly 1`] = ` "creationDate": "2020-03-01T12:08:16.623Z", "emissionModelType": "boat", "emissionType": "transport", - "iconName": "md-boat", + "iconName": "boat", "id": "4", "onPress": [Function], "periodType": "monthly", @@ -31,7 +31,7 @@ exports[`EmissionsScreen renders correctly 1`] = ` "creationDate": "2020-03-01T12:08:16.623Z", "emissionModelType": "beans", "emissionType": "food", - "iconName": "md-nutrition", + "iconName": "nutrition", "id": "2", "isMitigated": false, "onPress": [Function], @@ -43,7 +43,7 @@ exports[`EmissionsScreen renders correctly 1`] = ` "creationDate": "2020-03-01T12:08:16.623Z", "emissionModelType": "boat", "emissionType": "transport", - "iconName": "md-boat", + "iconName": "boat", "id": "3", "isMitigated": true, "onPress": [Function], @@ -60,7 +60,7 @@ exports[`EmissionsScreen renders correctly 1`] = ` "creationDate": "2020-01-01T12:08:16.623Z", "emissionModelType": "beans", "emissionType": "food", - "iconName": "md-nutrition", + "iconName": "nutrition", "id": "1", "isMitigated": false, "onPress": [Function], @@ -116,7 +116,7 @@ exports[`EmissionsScreen renders correctly 1`] = ` = ({ {headerText} `; @@ -77,9 +78,10 @@ exports[`SectionHeader should render when title 1`] = ` `; diff --git a/app/screens/Faq/__tests__/__snapshots__/FaqScreen.test.tsx.snap b/app/screens/Faq/__tests__/__snapshots__/FaqScreen.test.tsx.snap index 32f6c3c1..e4334a01 100644 --- a/app/screens/Faq/__tests__/__snapshots__/FaqScreen.test.tsx.snap +++ b/app/screens/Faq/__tests__/__snapshots__/FaqScreen.test.tsx.snap @@ -80,6 +80,7 @@ exports[`FaqScreen renders correctly 1`] = ` "color": "#3957D0", } } + suppressHighlighting={true} /> headerRight: () => ( { diff --git a/app/screens/Languages/__tests__/__snapshots__/LanguagesScreen.tests.tsx.snap b/app/screens/Languages/__tests__/__snapshots__/LanguagesScreen.tests.tsx.snap index 2e3ca816..ad1100a8 100644 --- a/app/screens/Languages/__tests__/__snapshots__/LanguagesScreen.tests.tsx.snap +++ b/app/screens/Languages/__tests__/__snapshots__/LanguagesScreen.tests.tsx.snap @@ -35,13 +35,14 @@ exports[`LanguageScreen renders correctly 1`] = ` { {t("MONTHLY_BUDGET_SCREEN_CARBON_EMISSIONS_WORLD")} { {Math.round(getDisplayUnitsValue(167, useMetricUnits))}{" "} {getDisplayUnits(167, useMetricUnits) + "CO2eq"} diff --git a/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap b/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap index f0a3eeb9..e48cfdec 100644 --- a/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap +++ b/app/screens/MonthlyBudget/__tests__/__snapshots__/MonthlyBudgetScreen.test.tsx.snap @@ -90,9 +90,10 @@ exports[`MonthlyBudgetScreen renders correctly 1`] = ` Average monthly emissions per capita in a sample of countries @@ -257,10 +258,12 @@ exports[`MonthlyBudgetScreen renders correctly 1`] = ` lbCO2eq diff --git a/app/screens/MonthlyEmissions/__tests__/__snapshots__/MonthlyEmissionsScreen.test.tsx.snap b/app/screens/MonthlyEmissions/__tests__/__snapshots__/MonthlyEmissionsScreen.test.tsx.snap index e841cc2d..cf140811 100644 --- a/app/screens/MonthlyEmissions/__tests__/__snapshots__/MonthlyEmissionsScreen.test.tsx.snap +++ b/app/screens/MonthlyEmissions/__tests__/__snapshots__/MonthlyEmissionsScreen.test.tsx.snap @@ -44,7 +44,7 @@ exports[` render 1`] = ` "creationDate": "2020-03-01T12:08:16.623Z", "emissionModelType": "beans", "emissionType": "food", - "iconName": "md-nutrition", + "iconName": "nutrition", "id": "1", "isMitigated": false, "onPress": [Function], @@ -56,7 +56,7 @@ exports[` render 1`] = ` "creationDate": "2020-03-01T12:08:16.623Z", "emissionModelType": "boat", "emissionType": "transport", - "iconName": "md-boat", + "iconName": "boat", "id": "12", "isMitigated": true, "onPress": [Function], @@ -133,7 +133,7 @@ exports[` render 1`] = ` render 1`] = ` ({ headerRight: () => ( { - navigate(navigation).goBack(); - }} + onPress={() => navigate(navigation).goBack()} /> ), diff --git a/app/utils/ui/__tests__/ui.test.ts b/app/utils/ui/__tests__/ui.test.ts index ee3f0de0..4910f2e2 100644 --- a/app/utils/ui/__tests__/ui.test.ts +++ b/app/utils/ui/__tests__/ui.test.ts @@ -160,16 +160,16 @@ describe("tests for ui.isDarkModeEnabled", () => { describe("tests for ui.getIconFromModelType", () => { describe("electricity type emissions", () => { - it("returns md-flash if electricity Emission model", () => { + it("returns flash if electricity Emission model", () => { const emissionModelType = ElectricityType.argentina; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-flash"); + expect(icon).toBe("flash"); }); }); describe("custom type emissions", () => { - it("returns md-build if custom Emission model", () => { + it("returns build if custom Emission model", () => { // arrange const emissionModelType = EmissionType.custom; @@ -177,12 +177,12 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-build"); + expect(icon).toBe("build"); }); }); describe("food type emissions", () => { - it("returns md-nutrition if it is food of type redMeat", () => { + it("returns nutrition if it is food of type redMeat", () => { // arrange const emissionModelType = FoodType.redMeat; @@ -190,10 +190,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-nutrition"); + expect(icon).toBe("nutrition"); }); - it("returns md-nutrition if it is food of type whiteMeat", () => { + it("returns nutrition if it is food of type whiteMeat", () => { // arrange const emissionModelType = FoodType.whiteMeat; @@ -201,10 +201,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-nutrition"); + expect(icon).toBe("nutrition"); }); - it("returns md-nutrition if it is food of type chocolate", () => { + it("returns nutrition if it is food of type chocolate", () => { // arrange const emissionModelType = FoodType.chocolate; @@ -212,10 +212,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-nutrition"); + expect(icon).toBe("nutrition"); }); - it("returns md-cafe if it is food of type coffee", () => { + it("returns cafe if it is food of type coffee", () => { // arrange const emissionModelType = FoodType.coffee; @@ -223,12 +223,12 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-cafe"); + expect(icon).toBe("cafe"); }); }); describe("transport type emissions", () => { - it("returns md-airplane if it is transport of type shortHaulFlight", () => { + it("returns airplane if it is transport of type shortHaulFlight", () => { // arrange const emissionModelType = TransportType.shortHaulFlight; @@ -236,10 +236,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-airplane"); + expect(icon).toBe("airplane"); }); - it("returns md-airplane if it is transport of type mediumHaulFlight", () => { + it("returns airplane if it is transport of type mediumHaulFlight", () => { // arrange const emissionModelType = TransportType.mediumHaulFlight; @@ -247,10 +247,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-airplane"); + expect(icon).toBe("airplane"); }); - it("returns md-airplane if it is transport of type longHaulFlight", () => { + it("returns airplane if it is transport of type longHaulFlight", () => { // arrange const emissionModelType = TransportType.longHaulFlight; @@ -258,10 +258,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-airplane"); + expect(icon).toBe("airplane"); }); - it("returns md-train if it is transport of type train", () => { + it("returns train if it is transport of type train", () => { // arrange const emissionModelType = TransportType.train; @@ -269,10 +269,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-train"); + expect(icon).toBe("train"); }); - it("returns md-car if it is transport of type car", () => { + it("returns car if it is transport of type car", () => { // arrange const emissionModelType = TransportType.car; @@ -280,10 +280,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-car"); + expect(icon).toBe("car"); }); - it("returns md-boat if it is transport of type boat", () => { + it("returns boat if it is transport of type boat", () => { // arrange const emissionModelType = TransportType.boat; @@ -291,10 +291,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-boat"); + expect(icon).toBe("boat"); }); - it("returns md-motorbike if it is transport of type motorbike", () => { + it("returns motorbike if it is transport of type motorbike", () => { // arrange const emissionModelType = TransportType.motorbike; @@ -302,10 +302,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-bicycle"); + expect(icon).toBe("bicycle"); }); - it("returns md-bus if it is transport of type bus", () => { + it("returns bus if it is transport of type bus", () => { // arrange const emissionModelType = TransportType.bus; @@ -313,12 +313,12 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-bus"); + expect(icon).toBe("bus"); }); }); describe("streaming emission type", () => { - it("returns md-film for HDVideo", () => { + it("returns film for HDVideo", () => { // arrange const emissionModelType = StreamingType.HDVideo; @@ -326,10 +326,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-film"); + expect(icon).toBe("film"); }); - it("returns md-film for fullHDVideo", () => { + it("returns film for fullHDVideo", () => { // arrange const emissionModelType = StreamingType.fullHDVideo; @@ -337,10 +337,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-film"); + expect(icon).toBe("film"); }); - it("returns md-film for ultraHDVideo", () => { + it("returns film for ultraHDVideo", () => { // arrange const emissionModelType = StreamingType.ultraHDVideo; @@ -348,10 +348,10 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-film"); + expect(icon).toBe("film"); }); - it("returns md-musical-note for audioMP3", () => { + it("returns musical-note for audioMP3", () => { // arrange const emissionModelType = StreamingType.audioMP3; @@ -359,127 +359,127 @@ describe("tests for ui.getIconFromModelType", () => { const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-musical-note"); + expect(icon).toBe("musical-note"); }); }); describe("purchase emission type", () => { - it("returns md-card for computer", () => { + it("returns card for computer", () => { const emissionModelType = PurchaseType.computer; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); - it("returns md-card for eletricCar", () => { + it("returns card for eletricCar", () => { const emissionModelType = PurchaseType.eletricCar; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); - it("returns md-card for fossilFuelCar", () => { + it("returns card for fossilFuelCar", () => { const emissionModelType = PurchaseType.fossilFuelCar; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); - it("returns md-card for hybridCar", () => { + it("returns card for hybridCar", () => { const emissionModelType = PurchaseType.hybridCar; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); - it("returns md-card for laptop", () => { + it("returns card for laptop", () => { const emissionModelType = PurchaseType.laptop; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); - it("returns md-card for smartphone", () => { + it("returns card for smartphone", () => { const emissionModelType = PurchaseType.smartphone; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); - it("returns md-card for tablet", () => { + it("returns card for tablet", () => { const emissionModelType = PurchaseType.tablet; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); - it("returns md-card for tv", () => { + it("returns card for tv", () => { const emissionModelType = PurchaseType.tv; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-card"); + expect(icon).toBe("card"); }); }); describe("fashion emission type", () => { - it("returns md-shirt for coat", () => { + it("returns shirt for coat", () => { const emissionModelType = FashionType.coat; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-shirt"); + expect(icon).toBe("shirt"); }); - it("returns md-shirt for dress", () => { + it("returns shirt for dress", () => { const emissionModelType = FashionType.dress; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-shirt"); + expect(icon).toBe("shirt"); }); - it("returns md-shirt for jeans", () => { + it("returns shirt for jeans", () => { const emissionModelType = FashionType.jeans; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-shirt"); + expect(icon).toBe("shirt"); }); - it("returns md-shirt for shirt", () => { + it("returns shirt for shirt", () => { const emissionModelType = FashionType.shirt; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-shirt"); + expect(icon).toBe("shirt"); }); - it("returns md-shirt for shoes", () => { + it("returns shirt for shoes", () => { const emissionModelType = FashionType.shoes; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-shirt"); + expect(icon).toBe("shirt"); }); - it("returns md-shirt for sweater", () => { + it("returns shirt for sweater", () => { const emissionModelType = FashionType.sweater; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-shirt"); + expect(icon).toBe("shirt"); }); - it("returns md-shirt for tshirt", () => { + it("returns shirt for tshirt", () => { const emissionModelType = FashionType.tshirt; const icon = ui.getIconFromModelType(emissionModelType); - expect(icon).toBe("md-shirt"); + expect(icon).toBe("shirt"); }); }); - it("returns md-build for any random emission type", () => { + it("returns build for any random emission type", () => { const emissionModelType = "someRandomString"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const icon = ui.getIconFromModelType(emissionModelType); // assert - expect(icon).toBe("md-build"); + expect(icon).toBe("build"); }); }); diff --git a/app/utils/ui/ui.ts b/app/utils/ui/ui.ts index 6080ba6f..820ffa43 100644 --- a/app/utils/ui/ui.ts +++ b/app/utils/ui/ui.ts @@ -176,54 +176,54 @@ const getTranslationEmissionModelType = (emissionModelType: EmissionModelType): const getIconFromModelType = (emissionModelType: EmissionModelType): string => { switch (emissionModelType) { case EmissionType.custom: - return "md-build"; + return "build"; case EmissionType.productScanned: return "barcode-sharp"; case FoodType.coffee: - return "md-cafe"; + return "cafe"; case TransportType.shortHaulFlight: case TransportType.mediumHaulFlight: case TransportType.longHaulFlight: - return "md-airplane"; + return "airplane"; case TransportType.train: - return "md-train"; + return "train"; case TransportType.car: - return "md-car"; + return "car"; case TransportType.boat: - return "md-boat"; + return "boat"; case TransportType.motorbike: - return "md-bicycle"; + return "bicycle"; case TransportType.bus: - return "md-bus"; + return "bus"; case StreamingType.audioMP3: - return "md-musical-note"; + return "musical-note"; case StreamingType.HDVideo: case StreamingType.fullHDVideo: case StreamingType.ultraHDVideo: - return "md-film"; + return "film"; } if (isFoodEmission(emissionModelType)) { - return "md-nutrition"; + return "nutrition"; } if (isElectricityEmission(emissionModelType)) { - return "md-flash"; + return "flash"; } if (isMealEmission(emissionModelType)) { - return "md-restaurant"; + return "restaurant"; } if (isPurchaseEmission(emissionModelType)) { - return "md-card"; + return "card"; } if (isFashionEmission(emissionModelType)) { - return "md-shirt"; + return "shirt"; } - return "md-build"; + return "build"; }; const isDarkModeEnabled = (): boolean => Appearance.getColorScheme() === "dark"; diff --git a/package.json b/package.json index a4df2fef..55436d03 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "globalSetup": "./global-setup.js" }, "dependencies": { - "@expo/vector-icons": "13.0.0", + "@expo/vector-icons": "14.0.0", "@react-native-async-storage/async-storage": "1.18.2", "@react-native-community/datetimepicker": "7.2.0", "@react-native-community/slider": "4.4.2",