Skip to content

Commit 433daff

Browse files
committed
Add reload icon, enhance cache clearing confirmation, and improve user list animation
1 parent 75702bf commit 433daff

File tree

10 files changed

+79
-57
lines changed

10 files changed

+79
-57
lines changed

App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type { ChartParamList } from '@screens/OS/Chart'
1717
import Chart from '@screens/OS/Chart'
1818
import FCFS from '@screens/OS/FCFS'
1919
import SJF from '@screens/OS/SJF'
20+
import Onboarding from '@screens/Onboarding'
2021
import RoutineWelcome from '@screens/Routine/RoutineWelcome'
2122
import GlobalSearch from '@screens/Search/GlobalSearch'
2223
import EditVersion from '@screens/Settings/Admin/EditVersion'
@@ -55,7 +56,6 @@ import { Dimensions, SafeAreaView, useColorScheme } from 'react-native'
5556
import { GestureHandlerRootView } from 'react-native-gesture-handler'
5657
import Animated, { ZoomIn, ZoomOut } from 'react-native-reanimated'
5758
import './global.css'
58-
import Onboarding from '@screens/Onboarding'
5959

6060
function App(): React.JSX.Element {
6161
const scheme = useColorScheme()
@@ -254,7 +254,7 @@ function Navigation() {
254254
<Stack.Screen name='FCFS' component={FCFS} options={GestureEnabled} />
255255
<Stack.Screen name='SJF' component={SJF} options={GestureEnabled} />
256256
<Stack.Screen name='Chart' component={Chart} options={IOS_BOTTOM_STYLE} />
257-
<Stack.Screen name='Onboarding' component={Onboarding} options={NO_ANIMATION}/>
257+
<Stack.Screen name='Onboarding' component={Onboarding} options={NO_ANIMATION} />
258258
</Stack.Navigator>
259259
</>
260260
)

src/assets/icons/icons.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,4 @@ export { default as NewReleasesSolidIcon } from '@icons/new-releases-solid-round
137137
export { default as AngrySolidIcon } from '@icons/angry-solid-rounded.svg'
138138
export { default as SmileSolidIcon } from '@icons/smile-solid-rounded.svg'
139139
export { default as PlaySolidIcon } from '@icons/play-solid-rounded.svg'
140+
export { default as ReloadIcon } from '@icons/reload-solid-rounded.svg'
Lines changed: 4 additions & 0 deletions
Loading

src/screens/DeveloperOptions/MMKVDataList.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useIsFocused } from '@react-navigation/native'
1313
import { Colors } from '@utils/colors'
1414
import { ls, type StorageKeys } from '@utils/storage'
1515
import type { NavProp } from '@utils/types'
16-
import { delayedFadeAnimationSearch, screenDelay } from '@utils/utils'
16+
import { delayedFadeAnimationSearch } from '@utils/utils'
1717
import React, { useEffect } from 'react'
1818
import { View } from 'react-native'
1919
import Animated from 'react-native-reanimated'
@@ -25,8 +25,7 @@ export default function MMKVDataList({ navigation }: NavProp) {
2525
const [searchResults, setSearchResults] = React.useState<string[]>([])
2626

2727
useEffect(() => {
28-
if (state) screenDelay(() => setInitStorage(ls.getAllKeys()), 700)
29-
// setInitStorage([])
28+
if (state) setInitStorage(ls.getAllKeys())
3029
}, [state])
3130

3231
useEffect(() => {

src/screens/Onboarding.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@ import { Lottie } from '@components/Lottie'
44
import { PaddingBottom, PaddingTop } from '@components/SafePadding'
55
import { W } from '@utils/dimensions'
66
import { Bold, F, SemiBold } from '@utils/fonts'
7-
import S from '@utils/storage'
87
import { NavProp } from '@utils/types'
98
import { View } from 'react-native'
109

1110
export default function Onboarding({ navigation }: NavProp) {
1211
function handlePress() {
13-
S.set('isOpenedApp', 'true')
1412
navigation.reset({ index: 0, routes: [{ name: 'Login' }] })
1513
}
1614
return (

src/screens/Settings/Admin/EditVersion.tsx

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ export default function EditVersion({ navigation }: NavProp) {
6464
}
6565

6666
function promptUpdate() {
67-
const isGreater = parseInt(criticalVersionCode, 10) > APP_VERSION_CODE
67+
const criticalVersionCodeNumber = parseInt(criticalVersionCode, 10)
68+
if (isNaN(criticalVersionCodeNumber)) {
69+
return ToastAndroid.show('Critical version code is not a valid number', ToastAndroid.SHORT)
70+
}
71+
const isGreater = criticalVersionCodeNumber > APP_VERSION_CODE
6872
if (!isGreater) return update()
6973

7074
alert(
@@ -206,19 +210,7 @@ export default function EditVersion({ navigation }: NavProp) {
206210
// <Animated.View key={i} entering={FadeIn}>
207211
<Input
208212
key={i}
209-
Icon={
210-
<View
211-
className='flex items-center justify-center'
212-
style={{
213-
height: 28,
214-
width: 28,
215-
borderRadius: 9.5,
216-
backgroundColor: ColorList[i % ColorList.length],
217-
}}
218-
>
219-
<SemiBold className='justify-center pt-0.5 text-center text-xs text-white'>{i + 1}</SemiBold>
220-
</View>
221-
}
213+
Icon={<FeatureLeftIcon i={i} />}
222214
value={item}
223215
multiline
224216
placeholder={`Feature description ${i + 1}`}
@@ -247,6 +239,22 @@ export default function EditVersion({ navigation }: NavProp) {
247239
)
248240
}
249241

242+
function FeatureLeftIcon({ i }: { i: number }) {
243+
return (
244+
<View
245+
className='flex items-center justify-center'
246+
style={{
247+
height: 31,
248+
width: 31,
249+
borderRadius: 10,
250+
backgroundColor: ColorList[i % ColorList.length],
251+
}}
252+
>
253+
<SemiBold className='justify-center pb-0.5 text-center text-sm text-white'>{i + 1}</SemiBold>
254+
</View>
255+
)
256+
}
257+
250258
function generateVersionUpdateMessage(
251259
version: string,
252260
versionCode: string,

src/screens/Settings/Admin/Users/AllUsers.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ import { useQuery } from '@tanstack/react-query'
1212
import { client } from '@utils/client'
1313
import { F, Medium } from '@utils/fonts'
1414
import type { NavProp } from '@utils/types'
15-
import { print } from '@utils/utils'
15+
import { delayedFadeAnimation, print } from '@utils/utils'
1616
import React, { useEffect } from 'react'
1717
import { ToastAndroid, View } from 'react-native'
18+
import Animated from 'react-native-reanimated'
1819

1920
export default function AllUsers({ navigation }: NavProp) {
2021
const [search, setSearch] = React.useState('')
@@ -52,19 +53,19 @@ export default function AllUsers({ navigation }: NavProp) {
5253
<SettGroup title='All users'>
5354
{isPending && <DoubleSkeleton n={12} />}
5455
{data?.data?.map((user, i) => (
55-
// <Animated.View key={user.email} entering={delayedFadeAnimation(i)}>
56-
<SettOption
57-
key={user.email}
58-
title={user.name}
59-
Icon={<RoundedIcon Icon={UserSolidIcon} />}
60-
arrow
61-
onPress={() => navigation.navigate('User', { user })}
62-
>
63-
<Medium className='text-zinc-600 dark:text-zinc-400' style={F.F10_5} numberOfLines={1}>
64-
{user.email}
65-
</Medium>
66-
</SettOption>
67-
// </Animated.View>
56+
<Animated.View key={user.email} entering={delayedFadeAnimation(i)}>
57+
<SettOption
58+
key={user.email}
59+
title={user.name}
60+
Icon={<RoundedIcon Icon={UserSolidIcon} />}
61+
arrow
62+
onPress={() => navigation.navigate('User', { user })}
63+
>
64+
<Medium className='text-zinc-600 dark:text-zinc-400' style={F.F10_5} numberOfLines={1}>
65+
{user.email}
66+
</Medium>
67+
</SettOption>
68+
</Animated.View>
6869
))}
6970
</SettGroup>
7071
</Gap12>

src/screens/Settings/Settings/Settings.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,18 @@ export default function Settings({ navigation }: NavProp) {
8989
}, [])
9090

9191
function clearCache() {
92-
clearStorage(Caches)
93-
setTotalCache(0)
92+
alert('Are you sure?', 'Do you want to clear all cache?', [
93+
{
94+
text: 'Yes',
95+
onPress() {
96+
clearStorage(Caches)
97+
setTotalCache(0)
98+
},
99+
},
100+
{ text: 'No' },
101+
])
94102
}
95103

96-
97104
return (
98105
<View className='flex-1 bg-white dark:bg-zinc-950'>
99106
<PaddingTop />

src/screens/Try/RandomPassword.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Animations from '@assets/animations/animations'
2-
import Btn from '@components/Button'
2+
import { ReloadIcon } from '@assets/icons/icons'
33
import Check from '@components/Check'
44
import { Gap12 } from '@components/Gap'
55
import { Lottie } from '@components/Lottie'
@@ -10,11 +10,12 @@ import SettText from '@components/Settings/SettText'
1010
import SettWrapper from '@components/Settings/SettWrapper'
1111
import { Txt } from '@components/Text'
1212
import Clipboard from '@react-native-clipboard/clipboard'
13+
import { Colors } from '@utils/colors'
1314
import { W } from '@utils/dimensions'
14-
import { Medium } from '@utils/fonts'
15+
import { Medium, SemiBold } from '@utils/fonts'
1516
import type { NavProp } from '@utils/types'
1617
import React, { memo, useCallback, useEffect, useState } from 'react'
17-
import { ToastAndroid, TouchableOpacity } from 'react-native'
18+
import { ToastAndroid, TouchableOpacity, View } from 'react-native'
1819

1920
const MAX = 50
2021
const MIN = 4
@@ -83,26 +84,27 @@ export default function RandomPassword({ navigation }: NavProp) {
8384
</SettGroup>
8485
<SettGroup>
8586
{generatedPassword ? (
86-
<TouchableOpacity
87-
activeOpacity={0.7}
88-
onPress={() => {
89-
Clipboard.setString(generatedPassword)
90-
ToastAndroid.show('Password Copied', ToastAndroid.SHORT)
91-
}}
92-
>
93-
<Medium className='px-5 py-3 text-xs text-accent' numberOfLines={1}>
94-
{generatedPassword}
95-
</Medium>
96-
</TouchableOpacity>
87+
<View className='flex-row justify-between px-5 py-3'>
88+
<TouchableOpacity
89+
activeOpacity={0.7}
90+
onPress={() => {
91+
Clipboard.setString(generatedPassword)
92+
ToastAndroid.show('Password Copied', ToastAndroid.SHORT)
93+
}}
94+
>
95+
<SemiBold className='text-xs text-accent' numberOfLines={1}>
96+
{generatedPassword}
97+
</SemiBold>
98+
</TouchableOpacity>
99+
<TouchableOpacity onPress={generatePassword}>
100+
<ReloadIcon height={22} width={22} color={Colors.accent} />
101+
</TouchableOpacity>
102+
</View>
97103
) : (
98-
<Medium className='px-5 py-3 text-xs text-red-500'>Please select at least one of the above options.</Medium>
104+
<Medium className='px-5 py-3 text-xs text-red-500'>Please select at least one of the options above.</Medium>
99105
)}
100106
</SettGroup>
101107
<SettText className='text-center'>Tap to copy the password</SettText>
102-
103-
<SettGroup className='px-5 py-5'>
104-
<Btn title='Generate Password' onPress={generatePassword} />
105-
</SettGroup>
106108
</Gap12>
107109
</SettWrapper>
108110
)

src/screens/auth/Login.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { useMutation } from '@tanstack/react-query'
1717
import { client, updateClientHeader } from '@utils/client'
1818
import { W } from '@utils/dimensions'
1919
import { Bold, SemiBold } from '@utils/fonts'
20+
import S from '@utils/storage'
2021
import type { NavProp } from '@utils/types'
2122
import { useMemo, useState } from 'react'
2223
import { Platform, ToastAndroid, View } from 'react-native'
@@ -58,6 +59,7 @@ export default function Login({ navigation }: NavProp) {
5859
if (data.data?.token) {
5960
// Navigate to home screen
6061
setToken(data.data.token)
62+
S.set('isOpenedApp', 'true')
6163
updateClientHeader(data.data.token)
6264
navigation.reset({ index: 0, routes: [{ name: 'Home' }] })
6365
return

0 commit comments

Comments
 (0)