{"ast":null,"code":"import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport React from \"react\";\nimport View from \"react-native-web/dist/exports/View\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport Text from \"react-native-web/dist/exports/Text\";\nimport TouchableHighlight from \"react-native-web/dist/exports/TouchableHighlight\";\nimport Image from \"react-native-web/dist/exports/Image\";\nimport { useDispatch } from \"react-redux\";\nimport { addFavoriteCity } from \"../redux/actions/addFavoriteCity\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function VilleCompopo(props) {\n var dispatch = useDispatch();\n function changeFavoriteCity(_x, _x2) {\n return _changeFavoriteCity.apply(this, arguments);\n }\n function _changeFavoriteCity() {\n _changeFavoriteCity = _asyncToGenerator(function* (city, already) {\n if (already) {\n city = null;\n }\n dispatch(addFavoriteCity(city));\n });\n return _changeFavoriteCity.apply(this, arguments);\n }\n var isFavorite = props.fav != null && props.weather.city.longitude === props.fav.longitude && props.weather.city.latitude === props.fav.latitude;\n return _jsx(View, {\n style: styles.container,\n children: _jsxs(View, {\n style: {\n flex: 1,\n flexDirection: \"row\",\n justifyContent: \"space-between\"\n },\n children: [_jsxs(View, {\n style: styles.bothtext,\n children: [_jsx(Text, {\n style: styles.title,\n children: props.weather.city.name\n }), _jsxs(Text, {\n children: [props.weather.city.latitude, \" - \", props.weather.city.longitude]\n })]\n }), _jsxs(View, {\n style: {\n flexDirection: \"row\",\n alignItems: \"center\"\n },\n children: [_jsx(Text, {\n style: styles.title,\n children: props.weather.temperature\n }), _jsx(TouchableHighlight, {\n onPress: function onPress() {\n return changeFavoriteCity(props.weather.city, isFavorite);\n },\n children: _jsx(Image, {\n source: isFavorite ? require(\"../assets/yellowstar.png\") : require(\"../assets/blackstar.png\"),\n style: styles.button\n })\n })]\n })]\n })\n });\n}\nvar styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: \"darksalmon\",\n marginVertical: 5,\n borderRadius: 15,\n width: \"90%\",\n alignSelf: 'center'\n },\n title: {\n fontWeight: \"bold\",\n fontSize: 18\n },\n bothtext: {\n margin: 10\n },\n temperature: {\n marginTop: 20,\n fontSize: 18,\n fontWeight: \"bold\"\n },\n button: {\n height: 30,\n width: 30,\n alignSelf: \"flex-end\",\n marginRight: \"5%\",\n marginLeft: \"10%\"\n }\n});","map":{"version":3,"names":["React","useDispatch","addFavoriteCity","VilleCompopo","props","dispatch","changeFavoriteCity","city","already","isFavorite","fav","weather","longitude","latitude","styles","container","flex","flexDirection","justifyContent","bothtext","title","name","alignItems","temperature","require","button","StyleSheet","create","backgroundColor","marginVertical","borderRadius","width","alignSelf","fontWeight","fontSize","margin","marginTop","height","marginRight","marginLeft"],"sources":["/Users/thomaschazot/Documents/But2A/LaSuperMeteo/iut-expo-starter/components/VilleCompopo.tsx"],"sourcesContent":["import React, { useEffect, useState, useSyncExternalStore } from \"react\";\nimport { View, StyleSheet, Text, Button, TouchableHighlight, Image } from \"react-native\";\nimport { useDispatch } from \"react-redux\";\nimport { City, FAVORITE_CITY_DATA, getCurrentWeather, Weather } from \"../data/stub\";\nimport { addFavoriteCity } from \"../redux/actions/addFavoriteCity\";\n\n\ntype VilleProps = {\n weather: Weather,\n fav: City | null\n}\n\n\nexport function VilleCompopo(props: VilleProps){\n const dispatch = useDispatch();\n\n\n async function changeFavoriteCity(city: City | null, already: boolean) {\n if (already){\n city = null\n }\n dispatch(addFavoriteCity(city))\n }\n\n const isFavorite = props.fav != null && props.weather.city.longitude===props.fav.longitude && props.weather.city.latitude===props.fav.latitude\n\n return (\n \n \n \n {props.weather.city.name}\n {props.weather.city.latitude} - {props.weather.city.longitude}\n \n \n {props.weather.temperature}\n changeFavoriteCity(props.weather.city, isFavorite)}>\n \n \n \n \n \n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n backgroundColor: \"darksalmon\",\n marginVertical: 5,\n borderRadius: 15,\n width: \"90%\",\n alignSelf: 'center'\n },\n title: {\n fontWeight: \"bold\",\n fontSize: 18\n },\n bothtext: {\n margin: 10\n },\n temperature: {\n marginTop: 20,\n fontSize: 18,\n fontWeight: \"bold\"\n },\n button: {\n height: 30,\n width: 30,\n alignSelf: \"flex-end\",\n marginRight: \"5%\",\n marginLeft: \"10%\"\n },\n\n});"],"mappings":";AAAA,OAAOA,KAAK,MAAqD,OAAO;AAAC;AAAA;AAAA;AAAA;AAAA;AAEzE,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,eAAe;AAA2C;AAAA;AASnE,OAAO,SAASC,YAAY,CAACC,KAAiB,EAAC;EAC7C,IAAMC,QAAQ,GAAGJ,WAAW,EAAE;EAAC,SAGhBK,kBAAkB;IAAA;EAAA;EAAA;IAAA,wCAAjC,WAAkCC,IAAiB,EAAEC,OAAgB,EAAE;MACrE,IAAIA,OAAO,EAAC;QACVD,IAAI,GAAG,IAAI;MACb;MACAF,QAAQ,CAACH,eAAe,CAACK,IAAI,CAAC,CAAC;IACjC,CAAC;IAAA;EAAA;EAED,IAAME,UAAU,GAAGL,KAAK,CAACM,GAAG,IAAI,IAAI,IAAIN,KAAK,CAACO,OAAO,CAACJ,IAAI,CAACK,SAAS,KAAGR,KAAK,CAACM,GAAG,CAACE,SAAS,IAAIR,KAAK,CAACO,OAAO,CAACJ,IAAI,CAACM,QAAQ,KAAGT,KAAK,CAACM,GAAG,CAACG,QAAQ;EAE9I,OACI,KAAC,IAAI;IAAC,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAA,UAC5B,MAAC,IAAI;MAAC,KAAK,EAAE;QAACC,IAAI,EAAE,CAAC;QAAEC,aAAa,EAAE,KAAK;QAAEC,cAAc,EAAE;MAAe,CAAE;MAAA,WAC5E,MAAC,IAAI;QAAC,KAAK,EAAEJ,MAAM,CAACK,QAAS;QAAA,WAC3B,KAAC,IAAI;UAAC,KAAK,EAAEL,MAAM,CAACM,KAAM;UAAA,UAAEhB,KAAK,CAACO,OAAO,CAACJ,IAAI,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