You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
5.9 KiB

{"ast":null,"code":"import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport View from \"react-native-web/dist/exports/View\";\nimport Text from \"react-native-web/dist/exports/Text\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { TopBar } from \"../components/TopBar\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport React, { useEffect } from \"react\";\nimport { getFavoriteCity } from \"../redux/actions/getFavoriteCity\";\nimport { Details } from \"../components/Details\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nexport default function Home(navigation) {\n var insets = useSafeAreaInsets();\n var statusBarHeight = insets.top;\n var favoriteCity = useSelector(function (state) {\n return state.appReducer.favoriteCity;\n });\n var weather = useSelector(function (state) {\n return state.appReducer.favoriteWeather;\n });\n var dispatch = useDispatch();\n useEffect(function () {\n var loadFavoriteCity = function () {\n var _ref = _asyncToGenerator(function* () {\n yield dispatch(getFavoriteCity());\n });\n return function loadFavoriteCity() {\n return _ref.apply(this, arguments);\n };\n }();\n loadFavoriteCity();\n }, [dispatch]);\n return _jsxs(View, {\n style: {\n alignItems: \"center\",\n width: \"100%\"\n },\n children: [_jsx(TopBar, {}), function () {\n if (weather != null) {\n return _jsx(Details, {\n weather: weather\n });\n } else {\n return _jsx(Text, {\n style: leStyle.text,\n children: \"Vous n'avez pas ajout\\xE9 de ville en favoris\"\n });\n }\n }()]\n });\n}\nvar leStyle = StyleSheet.create({\n container: {\n alignItems: 'center'\n },\n text: {\n fontWeight: \"normal\",\n fontStyle: 'italic',\n fontSize: 10,\n alignSelf: \"center\",\n alignContent: \"center\",\n marginLeft: 7\n }\n});","map":{"version":3,"names":["useSafeAreaInsets","TopBar","useDispatch","useSelector","React","useEffect","getFavoriteCity","Details","Home","navigation","insets","statusBarHeight","top","favoriteCity","state","appReducer","weather","favoriteWeather","dispatch","loadFavoriteCity","alignItems","width","leStyle","text","StyleSheet","create","container","fontWeight","fontStyle","fontSize","alignSelf","alignContent","marginLeft"],"sources":["/Users/thomaschazot/Documents/But2A/LaSuperMeteo/iut-expo-starter/screens/Home.tsx"],"sourcesContent":["import { View, Text, StyleSheet, ImageBackground } from \"react-native\"\nimport { FlatList } from \"react-native-gesture-handler\"\nimport { City, Weather } from \"../data/stub\"\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { VilleCompopo } from \"../components/VilleCompopo\";\nimport { TopBar } from \"../components/TopBar\";\nimport CityDetails from \"./CityDetails\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport React, { useEffect } from \"react\";\nimport { getFavoriteCity } from \"../redux/actions/getFavoriteCity\";\nimport { Details } from \"../components/Details\";\nimport { getWeather } from \"../redux/actions/getWeather\";\n\n\nexport default function Home(navigation){\n\n \n const insets = useSafeAreaInsets();\n const statusBarHeight = insets.top;\n\n const favoriteCity: City | null = useSelector(state => state.appReducer.favoriteCity);\n const weather: Weather | null = useSelector(state => state.appReducer.favoriteWeather);\n\n\n const dispatch = useDispatch();\n \n useEffect(() => {\n const loadFavoriteCity = async () => {\n await dispatch(getFavoriteCity());\n };\n loadFavoriteCity();\n }, [dispatch]);\n\n return (\n <View style={{alignItems: \"center\", width: \"100%\"}}>\n <TopBar/>\n {(() => {\n if (weather != null){\n return (\n <Details weather={weather}/>\n )\n }\n else{\n return(\n <Text style={leStyle.text}>Vous n'avez pas ajouté de ville en favoris</Text>\n )\n }\n })()}\n </View>\n )\n}\n\n\nconst leStyle = StyleSheet.create({\n container: {\n alignItems: 'center',\n },\n text: {\n fontWeight: \"normal\",\n fontStyle: 'italic',\n fontSize: 10,\n alignSelf: \"center\",\n alignContent: \"center\",\n marginLeft: 7\n },\n});"],"mappings":";;;;AAGA,SAASA,iBAAiB,QAAQ,gCAAgC;AAElE,SAASC,MAAM;AAEf,SAASC,WAAW,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