Skip to content

Commit 3fa1d3c

Browse files
committed
feat: Refactor Coordinate Notes to Location Notes; update navigation, add new components, and implement location note functionality
1 parent dc9e18f commit 3fa1d3c

File tree

8 files changed

+36
-28
lines changed

8 files changed

+36
-28
lines changed

App.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import { queryClient } from '@query/index'
77
import { NavigationContainer, useNavigation } from '@react-navigation/native'
88
import { CardStyleInterpolators, createStackNavigator, type StackNavigationOptions } from '@react-navigation/stack'
99
import ComputerScienceSettings from '@screens/ComputerScience/ComputerScienceSettings'
10-
import CoordinateNotes from '@screens/CoordinateNotes/CoordinateNotes'
11-
import NewCoordinateNotes from '@screens/CoordinateNotes/NewCoordinateNotes'
10+
import { LocationNoteParamList } from '@screens/CoordinateNotes/LocationNote'
11+
import LocationNotes from '@screens/CoordinateNotes/LocationNotes'
12+
import LocationNote from '@screens/CoordinateNotes/LocationNote'
1213
import LocationTags from '@screens/CoordinateNotes/LocationTags'
1314
import DeveloperOptions from '@screens/DeveloperOptions/DeveloperOptions'
1415
import MMKVDataEditor, { type MMKVDataEditorParamList } from '@screens/DeveloperOptions/MMKVDataEditor'
@@ -61,7 +62,7 @@ import { Dimensions, SafeAreaView, useColorScheme } from 'react-native'
6162
import { GestureHandlerRootView } from 'react-native-gesture-handler'
6263
import Animated, { ZoomIn, ZoomOut } from 'react-native-reanimated'
6364
import './global.css'
64-
import CoordinateNote, { CoordinateNoteParamList } from '@screens/CoordinateNotes/CoordinateNote'
65+
import NewLocationNote from '@screens/CoordinateNotes/NewLocationNotes'
6566

6667
function App(): React.JSX.Element {
6768
const scheme = useColorScheme()
@@ -196,17 +197,19 @@ function Navigation() {
196197
<Stack.Screen name='SJF' component={SJF} options={GestureEnabled} />
197198
<Stack.Screen name='Chart' component={Chart} options={IOS_BOTTOM_STYLE} />
198199
<Stack.Screen name='Onboarding' component={Onboarding} options={NO_ANIMATION} />
199-
<Stack.Screen name='CoordinateNotes' component={CoordinateNotes} options={GestureEnabled} />
200-
<Stack.Screen name='NewCoordinateNotes' component={NewCoordinateNotes} options={GestureEnabled} />
200+
<Stack.Screen name='LocationNotes' component={LocationNotes} options={GestureEnabled} />
201+
<Stack.Screen name='NewLocationNote' component={NewLocationNote} options={GestureEnabled} />
201202
<Stack.Screen name='LocationTags' component={LocationTags} options={IOS_BOTTOM_STYLE} />
202-
<Stack.Screen name='CoordinateNote' component={CoordinateNote} options={GestureEnabled} />
203+
<Stack.Screen name='LocationNote' component={LocationNote} options={GestureEnabled} />
203204
</Stack.Navigator>
204205
</>
205206
)
206207
}
207208

208209
export type RootStackParamList = {
209-
CoordinateNote: CoordinateNoteParamList
210+
NewLocationNote: undefined
211+
LocationNote: LocationNoteParamList
212+
LocationNotes: undefined
210213
LocationTags: undefined
211214
Home: undefined
212215
Location: undefined
@@ -271,8 +274,6 @@ export type RootStackParamList = {
271274
Chart: ChartParamList
272275
Onboarding: undefined
273276
Skia: undefined
274-
CoordinateNotes: undefined
275-
NewCoordinateNotes: undefined
276277
}
277278

278279
const FabButton = () => {

src/screens/CoordinateNotes/CoordinateNote.tsx renamed to src/screens/CoordinateNotes/LocationNote.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ import { SettOption } from '@components/Settings/SettOption'
99
import SettText from '@components/Settings/SettText'
1010
import SettWrapper from '@components/Settings/SettWrapper'
1111
import { RouteProp } from '@react-navigation/native'
12-
import { coordinateNotesStore, LocationNote } from '@screens/CoordinateNotes/coordinateNotesStore'
12+
import { coordinateNotesStore, type LocationNote } from '@screens/CoordinateNotes/locationNotesStore'
1313
import type { StackNav } from '@utils/types'
1414
import { useCallback, useEffect, useState } from 'react'
1515
import { BackHandler, View } from 'react-native'
1616
import LocationDetails from './LocationDetails'
1717

1818
type ParamList = {
19-
CoordinateNote: CoordinateNoteParamList
19+
LocationNote: LocationNoteParamList
2020
}
2121

22-
export type CoordinateNoteParamList = {
22+
export type LocationNoteParamList = {
2323
data: LocationNote
2424
}
2525

26-
type CoordinateNoteProps = {
27-
route: RouteProp<ParamList, 'CoordinateNote'>
26+
type LocationNoteProps = {
27+
route: RouteProp<ParamList, 'LocationNote'>
2828
navigation: StackNav
2929
}
3030

31-
export default function CoordinateNote({ navigation, route }: CoordinateNoteProps) {
31+
export default function LocationNote({ navigation, route }: LocationNoteProps) {
3232
const alert = popupStore((store) => store.alert)
3333
const data = route.params.data
3434
const [name, setName] = useState<string>(data.title || '')
@@ -108,7 +108,7 @@ export default function CoordinateNote({ navigation, route }: CoordinateNoteProp
108108
</SettGroup>
109109
<LocationDetails data={data.location} />
110110
<SettText>
111-
Deleting this note will remove it from the list of coordinate notes. This action cannot be undone.
111+
Deleting this note will remove it from the list of location notes.
112112
</SettText>
113113
<View className='mt-5 px-5'>
114114
<Btn title={'Delete Note'} className='bg-red-500' onPress={handleRemove} />

src/screens/CoordinateNotes/CoordinateNotes.tsx renamed to src/screens/CoordinateNotes/LocationNotes.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import { SettOption } from '@components/Settings/SettOption'
77
import SettText from '@components/Settings/SettText'
88
import SettWrapper from '@components/Settings/SettWrapper'
99
import { useNavigation } from '@react-navigation/native'
10-
import { coordinateNotesStore, LocationNote } from '@screens/CoordinateNotes/coordinateNotesStore'
10+
import { coordinateNotesStore, LocationNote } from '@screens/CoordinateNotes/locationNotesStore'
1111
import fabStyles from '@screens/Home/styles/fabStyles'
12+
import { F, Medium } from '@utils/fonts'
1213
import type { NavProp, StackNav } from '@utils/types'
1314
import Animated, { ZoomIn, ZoomOut } from 'react-native-reanimated'
1415
import { useSafeAreaInsets } from 'react-native-safe-area-context'
15-
import NoNotes from './NoCoordinateNotes'
16+
import NoNotes from './NoLocationNotes'
1617

17-
export default function CoordinateNotes({ navigation }: NavProp) {
18+
export default function LocationNotes({ navigation }: NavProp) {
1819
const notes = coordinateNotesStore((state) => state.notes)
1920
return (
2021
<>
@@ -44,8 +45,14 @@ function NotesList({ notes }: { notes: LocationNote[] }) {
4445
title={item.title}
4546
Icon={<RoundedIcon Icon={Location01Icon} />}
4647
arrow
47-
onPress={() => navigation.navigate('CoordinateNote', { data: item })}
48-
/>
48+
onPress={() => navigation.navigate('LocationNote', { data: item })}
49+
>
50+
{item.description && (
51+
<Medium className='text-zinc-600 dark:text-zinc-400' style={F.F10_5} numberOfLines={1}>
52+
{item.description}
53+
</Medium>
54+
)}
55+
</SettOption>
4956
))}
5057
</SettGroup>
5158
</Gap12>
@@ -65,7 +72,7 @@ export const FabButton = () => {
6572
>
6673
<Press
6774
style={fabStyles.fabShadow}
68-
onPress={() => navigation.navigate('NewCoordinateNotes')}
75+
onPress={() => navigation.navigate('NewLocationNote')}
6976
activeOpacity={0.9}
7077
activeScale={0.95}
7178
className='items-center justify-center rounded-full bg-accent'

src/screens/CoordinateNotes/NewCoordinateNotes.tsx renamed to src/screens/CoordinateNotes/NewLocationNotes.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import RoundedIcon from '@components/RoundedIcon'
66
import SettGroup from '@components/Settings/SettGroup'
77
import { SettOption } from '@components/Settings/SettOption'
88
import SettWrapper from '@components/Settings/SettWrapper'
9-
import { coordinateNotesStore } from '@screens/CoordinateNotes/coordinateNotesStore'
9+
import { coordinateNotesStore } from '@screens/CoordinateNotes/locationNotesStore'
1010
import { fetchLocation } from '@screens/CoordinateNotes/lib'
1111
import { useQuery } from '@tanstack/react-query'
1212
import { NavProp } from '@utils/types'
@@ -15,7 +15,7 @@ import { BackHandler, View } from 'react-native'
1515
import { GeoPosition } from 'react-native-geolocation-service'
1616
import LocationDetails from './LocationDetails'
1717

18-
export default function NewCoordinateNotes({ navigation }: NavProp) {
18+
export default function NewLocationNote({ navigation }: NavProp) {
1919
const [name, setName] = useState<string>('')
2020
const [description, setDescription] = useState<string>('')
2121
const updateNote = coordinateNotesStore((state) => state.updateNote)

src/screens/CoordinateNotes/NoCoordinateNotes.tsx renamed to src/screens/CoordinateNotes/NoLocationNotes.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Lottie } from '@components/Lottie'
33
import { W } from '@utils/dimensions'
44
import { Regular } from '@utils/fonts'
55
import { View } from 'react-native'
6-
import { LocationNote } from './coordinateNotesStore'
6+
import { LocationNote } from './locationNotesStore'
77

88
export default function CoordinateNotes({ notes }: { notes: LocationNote[] }) {
99
if (notes.length > 0) return null

src/screens/Home/HomeScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ function Shortcuts({ navigation }: { navigation: StackNav }) {
107107
<Bold className='my-2 px-5 text-base text-gray-800 dark:text-gray-300'>Shortcuts</Bold>
108108
<View className='w-full flex-row flex-wrap' style={{ gap: 12, paddingHorizontal: 18 }}>
109109
<TouchableOpacity
110-
onPress={() => navigation.navigate('CoordinateNotes')}
110+
onPress={() => navigation.navigate('LocationNotes')}
111111
style={[hw, styles.shadow, styles.center]}
112112
className='w-1/2 rounded-2xl bg-white dark:bg-zinc-900'
113113
>
114-
<Medium className='text-xs text-gray-700 dark:text-gray-300'>Shortcut 1</Medium>
114+
<Medium className='text-xs text-gray-700 dark:text-gray-300'>Location Notes</Medium>
115115
</TouchableOpacity>
116116
<TouchableOpacity
117117
onPress={() => navigation.navigate('Test')}

src/screens/Try/TyrItOut.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const tools: Group[] = [
6161
{ title: 'Random Color', Icon: PaintBoardSolidIcon, to: 'RandomColor', className: 'bg-orange-500' },
6262
{ title: 'Gradient Colors', Icon: ColorsSolidIcon, className: 'bg-green-500' },
6363
{ title: 'Location Speed Meter', Icon: DashboardSpeed01SolidIcon, className: 'bg-yellow-500' },
64-
{ title: 'Coordinate Notes', Icon: MapsLocation02SolidIcon, className: 'bg-blue-500', to: 'CoordinateNotes' },
64+
{ title: 'Coordinate Notes', Icon: MapsLocation02SolidIcon, className: 'bg-accent', to: 'LocationNotes' },
6565
{ title: 'Random Password', Icon: LockPasswordSolidIcon, className: 'bg-slate-500', to: 'RandomPassword' },
6666
],
6767
},

0 commit comments

Comments
 (0)