Skip to content

Commit 2cdf317

Browse files
committed
Refactor navigation to add Update screen
1 parent dc20267 commit 2cdf317

File tree

7 files changed

+84
-6
lines changed

7 files changed

+84
-6
lines changed

App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import Test from '@screens/Test'
2727
import RandomColor from '@screens/Try/RandomColor'
2828
import RandomPassword from '@screens/Try/RandomPassword'
2929
import YourAge from '@screens/Try/YourAge'
30+
import Update from '@screens/Update/Update'
3031
import type { ConfirmCityParamList } from '@screens/Weather/ConfirmCity'
3132
import ConfirmCity from '@screens/Weather/ConfirmCity'
3233
import WeatherScreen from '@screens/Weather/Main/Weather'
@@ -139,6 +140,7 @@ export type RootStackParamList = {
139140
AppLock: undefined
140141
RandomPassword: undefined
141142
GlobalSearch: undefined
143+
Update: undefined
142144
}
143145

144146
const Stack = createStackNavigator<RootStackParamList>()
@@ -212,6 +214,7 @@ function Navigation() {
212214
<Stack.Screen name='AppLock' component={AppLock} options={GestureEnabled} />
213215
<Stack.Screen name='RandomPassword' component={RandomPassword} options={GestureEnabled} />
214216
<Stack.Screen name='GlobalSearch' component={GlobalSearch} options={IOS_BOTTOM_STYLE} />
217+
<Stack.Screen name='Update' component={Update} options={IOS_BOTTOM_STYLE} />
215218
</Stack.Navigator>
216219
</>
217220
)

src/screens/Settings/Extra/About.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@ import AppIcon from '@assets/icons/icon.svg'
77
export default function About() {
88
return (
99
<View className='flex-1 items-center justify-center'>
10-
<View className='my-5 bg-appIconBg p-1' style={{ borderRadius: 35 }}>
11-
<AppIcon width={150} height={150} />
12-
</View>
10+
<AppIconUI />
1311
<SemiBold className='text-base text-black dark:text-white'>Tech Triangle</SemiBold>
1412
<SemiBold className='text-xs text-black/50 dark:text-white'>v{APP_VERSION}</SemiBold>
1513
</View>
1614
)
1715
}
16+
17+
export function AppIconUI() {
18+
return (
19+
<View className='flex-row items-center justify-center'>
20+
<View className='my-5 bg-appIconBg p-1' style={{ borderRadius: 28 }}>
21+
<AppIcon width={100} height={100} />
22+
</View>
23+
</View>
24+
)
25+
}

src/screens/Settings/Settings.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
FolderFileStorageSolidIcon,
1212
InformationCircleSolidIcon,
1313
PolicySolidIcon,
14+
Setting07SolidIcon,
1415
ShieldUserSolidIcon,
1516
SquareLock02SolidIcon,
1617
SunCloudAngledRainZap01SolidIcon,
@@ -27,7 +28,7 @@ import { TxtAcc } from '@components/Text'
2728
import { useIsFocused } from '@react-navigation/native'
2829
import { Colors } from '@utils/colors'
2930
import { APP_VERSION, APP_VERSION_CODE, ask_a_question, join_telegram_channel } from '@utils/data'
30-
import { Bold } from '@utils/fonts'
31+
import { Bold, SemiBold } from '@utils/fonts'
3132
import { Caches, clearStorage, getStartWithSize, getStorageSize } from '@utils/storage'
3233
import type { NavProp } from '@utils/types'
3334
import { screenDelay, toReadableSize } from '@utils/utils'
@@ -89,6 +90,22 @@ export default function Settings({ navigation }: NavProp) {
8990
Go to each section to customize your experience. All settings are saved automatically.
9091
</SettText>
9192
<SettGroup title='General'>
93+
<SettOption
94+
title='App Update'
95+
Icon={<RoundedIcon Icon={Setting07SolidIcon} className='bg-slate-500' />}
96+
arrow
97+
Right={
98+
<View
99+
className='items-center justify-center rounded-full bg-red-500'
100+
style={{ height: 22, width: 22 }}
101+
>
102+
<SemiBold className='text-xs text-white' style={{ paddingTop: 2 }}>
103+
1
104+
</SemiBold>
105+
</View>
106+
}
107+
onPress={() => navigation.navigate('Update')}
108+
/>
92109
<SettOption
93110
title='Your Profile'
94111
Icon={<RoundedIcon Icon={UserSolidIcon} className='bg-green-500' />}

src/screens/Update/Update.tsx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import AppIcon from '@assets/icons/icon.svg'
2+
import Btn from '@components/Button'
3+
import { PaddingBottom } from '@components/SafePadding'
4+
import StackHeader from '@components/StackHeader'
5+
import { GITHUB_REPO } from '@utils/constants'
6+
import { Medium, Regular, SemiBold } from '@utils/fonts'
7+
import type { NavProp } from '@utils/types'
8+
import React from 'react'
9+
import { Linking, StatusBar, View } from 'react-native'
10+
11+
export default function Update({ navigation }: NavProp) {
12+
return (
13+
<View className='flex-1 p-5'>
14+
<View>
15+
<StatusBar barStyle='default' />
16+
<StackHeader title='App Update' navigation={navigation} left='Cancel' right='Done' />
17+
</View>
18+
<View className='mt-3 flex-1 justify-between'>
19+
<View className='flex-1 rounded-3xl bg-appIconBg p-8'>
20+
<AppIcon width={80} height={80} className='mt-8' />
21+
<SemiBold style={{ fontSize: 24 }} className='mt-5 text-white'>
22+
Update Available
23+
</SemiBold>
24+
<Medium style={{ fontSize: 14 }} className='mt-1 text-white opacity-70'>
25+
v1.0.0 15MB
26+
</Medium>
27+
<Regular className='mt-5 text-white opacity-80' style={{ fontSize: 12 }}>
28+
We bring you the latest features and improvements. Update now to enjoy the best experience.
29+
</Regular>
30+
<Regular className='mt-5 text-white opacity-80' style={{ fontSize: 12 }}>
31+
Download size may vary. The Download Now button will redirect you to the GitHub and you can download the
32+
latest.
33+
</Regular>
34+
</View>
35+
36+
<View className='mt-5 px-5'>
37+
<Btn
38+
title='Download Update'
39+
onPress={() => {
40+
Linking.openURL(GITHUB_REPO)
41+
}}
42+
/>
43+
<PaddingBottom />
44+
</View>
45+
</View>
46+
</View>
47+
)
48+
}

src/screens/Weather/Main/Weather.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function Boxes({ w, theme }: { w: Weather; theme: Theme }) {
170170
phase={w?.daily[0]?.moon_phase}
171171
/>
172172
<View className='w-full items-center justify-center'>
173-
<SemiBold className='mt-5 text-center opacity-50' style={F.F10}>
173+
<SemiBold className='mt-5 text-center opacity-50' style={[F.F10, theme.color]}>
174174
Powered by OpenWeatherMap
175175
</SemiBold>
176176
</View>

src/screens/Weather/Main/components/SunRiseSet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function SunRiseSet({ theme, now, sunrise, sunset }: SunRiseSetPr
2727
label={isDay === null ? 'Daylight' : isDay ? 'Sunset' : 'Sunrise'}
2828
/>
2929
<View className='flex-1 justify-between px-5 pb-4 pt-0'>
30-
<Medium style={[{ fontSize: 28 }, theme.color]}>
30+
<Medium style={[{ fontSize: 30 }, theme.color]}>
3131
{isDay === null
3232
? '__:__'
3333
: isDay

src/utils/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export const ANIM_DUR = 150
22
export const SCREEN_TRANSITION = 300
33
export const WEATHER_CACHE_TIME = 1000 * 60 * 10 // 10 minutes
4+
5+
export const GITHUB_REPO = 'https://github.com/codeAbinash/tech-triangle'

0 commit comments

Comments
 (0)