-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(): add weather details screen * feat(): small tweaks * chore(): remove catch error in thunk * feat(): Gemfile tweak, cocoapods version bump
- Loading branch information
Showing
11 changed files
with
205 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 8 additions & 4 deletions
12
...s/MapCityListScreen/components/MapCityListBottomSheet/MapCityListItem/MapCityListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 113 additions & 5 deletions
118
app/screens/WeatherDetailsScreen/WeatherDetailsScreen.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,118 @@ | ||
import React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import React, { useMemo } from 'react'; | ||
import { View, Text, Image, ScrollView } from 'react-native'; | ||
|
||
import { RootStackParamList, RouteNames } from '@navigation/MainRouter.tsx'; | ||
import { NativeStackScreenProps } from '@react-navigation/native-stack'; | ||
import { weatherCityListEntitySelectors } from '@state/features/weatherCityList/weatherCityListSelectors.ts'; | ||
import { useAppSelector } from '@state/hooks.ts'; | ||
import { weatherDetailsScreensStyles } from '@screens/WeatherDetailsScreen/weatherDetailsScreensStyles.ts'; | ||
import { getWeatherIconUri } from '@screens/MapCityListScreen/components/MapCityListBottomSheet/MapCityListItem/utils/getWeatherIconUri.ts'; | ||
|
||
export function WeatherDetailsScreen({ | ||
route: { | ||
params: { cityEntityId } | ||
} | ||
}: NativeStackScreenProps<RootStackParamList, RouteNames.WeatherDetails>) { | ||
const { | ||
clouds, | ||
name, | ||
weather: [{ description, icon }], | ||
main: { | ||
feels_like, | ||
grnd_level, | ||
humidity, | ||
pressure, | ||
sea_level, | ||
temp, | ||
temp_min, | ||
temp_max | ||
}, | ||
wind: { deg: windDeg, speed: windSpeed }, | ||
sys: { country } | ||
} = useAppSelector((state) => | ||
weatherCityListEntitySelectors.selectById(state, cityEntityId) | ||
); | ||
|
||
const table = useMemo( | ||
() => [ | ||
{ | ||
name: 'Feels Like', | ||
value: `${feels_like} °C` | ||
}, | ||
{ | ||
name: 'Ground Level Pressure', | ||
value: `${grnd_level} hPa` | ||
}, | ||
{ | ||
name: 'Humidity', | ||
value: `${humidity} %` | ||
}, | ||
{ | ||
name: 'Pressure', | ||
value: `${pressure} hPa` | ||
}, | ||
{ | ||
name: 'Sea Level Pressure', | ||
value: `${sea_level} hPa` | ||
}, | ||
{ | ||
name: 'Temperature', | ||
value: `${temp} °C` | ||
}, | ||
{ | ||
name: 'Maximum Temperature', | ||
value: `${temp_max} °C` | ||
}, | ||
{ | ||
name: 'Minimum Temperature', | ||
value: `${temp_min} °C` | ||
}, | ||
{ | ||
name: 'Wind Direction', | ||
value: `${windDeg} °` | ||
}, | ||
{ | ||
name: 'Wind Speed', | ||
value: `${windSpeed} m/s` | ||
}, | ||
{ | ||
name: 'Country', | ||
value: `${country}` | ||
}, | ||
{ | ||
name: 'Cloudiness', | ||
value: `${clouds.all || clouds.today} %` | ||
} | ||
], | ||
[] | ||
); | ||
|
||
const source = useMemo(() => ({ uri: getWeatherIconUri(icon) }), [icon]); | ||
|
||
export function WeatherDetailsScreen() { | ||
return ( | ||
<View> | ||
<Text>Konichiwa I am Weather Detail Screen</Text> | ||
<View style={weatherDetailsScreensStyles.container}> | ||
<View style={weatherDetailsScreensStyles.titleContainer}> | ||
<View> | ||
<Text style={weatherDetailsScreensStyles.title}>{name}</Text> | ||
<Text style={weatherDetailsScreensStyles.subTitle}> | ||
{description} | ||
</Text> | ||
</View> | ||
<Image style={weatherDetailsScreensStyles.image} source={source} /> | ||
</View> | ||
<ScrollView> | ||
{table.map(({ name: rowName, value }) => ( | ||
<View | ||
style={weatherDetailsScreensStyles.rowNameValue} | ||
key={rowName + value} | ||
> | ||
<Text style={weatherDetailsScreensStyles.textValueName}> | ||
{rowName} | ||
</Text> | ||
<Text style={weatherDetailsScreensStyles.textValue}>{value}</Text> | ||
</View> | ||
))} | ||
</ScrollView> | ||
</View> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
app/screens/WeatherDetailsScreen/weatherDetailsScreensStyles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { StyleSheet } from 'react-native'; | ||
|
||
export const weatherDetailsScreensStyles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
paddingHorizontal: 6, | ||
paddingVertical: 18 | ||
}, | ||
titleContainer: { | ||
flexDirection: 'row', | ||
alignItems: 'center' | ||
}, | ||
rowNameValue: { | ||
height: 60, | ||
padding: 12, | ||
borderBottomWidth: 1, | ||
borderColor: 'grey', | ||
flexDirection: 'row' | ||
}, | ||
title: { | ||
fontSize: 25, | ||
fontWeight: 'bold' | ||
}, | ||
subTitle: { | ||
paddingTop: 4, | ||
fontSize: 16, | ||
color: 'grey' | ||
}, | ||
textValueName: { | ||
fontSize: 18 | ||
}, | ||
textValue: { | ||
fontSize: 18, | ||
fontWeight: 'bold', | ||
marginLeft: 'auto' | ||
}, | ||
image: { | ||
width: 70, | ||
height: 70, | ||
marginLeft: 'auto' | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters