Refactor navigation paths to use '/chores' instead of '/my/chores' across multiple components for consistency

This commit is contained in:
Mo Tarbin
2025-08-25 20:21:06 -04:00
parent 77b3430339
commit 6064c88f2c
16 changed files with 103 additions and 105 deletions

View File

@@ -54,13 +54,13 @@ PODS:
- AppCheckCore (~> 11.0) - AppCheckCore (~> 11.0)
- GTMAppAuth (< 5.0, >= 4.1.1) - GTMAppAuth (< 5.0, >= 4.1.1)
- GTMSessionFetcher/Core (~> 3.3) - GTMSessionFetcher/Core (~> 3.3)
- GoogleUtilities/Environment (8.0.2): - GoogleUtilities/Environment (8.1.0):
- GoogleUtilities/Privacy - GoogleUtilities/Privacy
- GoogleUtilities/Logger (8.0.2): - GoogleUtilities/Logger (8.1.0):
- GoogleUtilities/Environment - GoogleUtilities/Environment
- GoogleUtilities/Privacy - GoogleUtilities/Privacy
- GoogleUtilities/Privacy (8.0.2) - GoogleUtilities/Privacy (8.1.0)
- GoogleUtilities/UserDefaults (8.0.2): - GoogleUtilities/UserDefaults (8.1.0):
- GoogleUtilities/Logger - GoogleUtilities/Logger
- GoogleUtilities/Privacy - GoogleUtilities/Privacy
- GTMAppAuth (4.1.1): - GTMAppAuth (4.1.1):
@@ -181,7 +181,7 @@ SPEC CHECKSUMS:
FBSDKCoreKit_Basics: 151b43db8b834d3f0e02f95d36a44ffd36265e45 FBSDKCoreKit_Basics: 151b43db8b834d3f0e02f95d36a44ffd36265e45
FBSDKLoginKit: 5c1cd53c91a2282b3a4fe6e6d3dcf2b8b0d33d55 FBSDKLoginKit: 5c1cd53c91a2282b3a4fe6e6d3dcf2b8b0d33d55
GoogleSignIn: ce8c89bb9b37fb624b92e7514cc67335d1e277e4 GoogleSignIn: ce8c89bb9b37fb624b92e7514cc67335d1e277e4
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47

View File

@@ -1,78 +1,82 @@
import { LocalNotifications } from '@capacitor/local-notifications'; import { App as mobileApp } from '@capacitor/app'
import { App as mobileApp } from '@capacitor/app'; import { Capacitor } from '@capacitor/core'
import { LocalNotifications } from '@capacitor/local-notifications'
import { PushNotifications } from '@capacitor/push-notifications' import { PushNotifications } from '@capacitor/push-notifications'
import { PutNotificationTarget } from './utils/Fetcher'; import { PutNotificationTarget } from './utils/Fetcher'
import { Capacitor } from '@capacitor/core';
const localNotificationListenerRegistration = () => { const localNotificationListenerRegistration = () => {
LocalNotifications.addListener('localNotificationReceived', (notification) => { LocalNotifications.addListener('localNotificationReceived', notification => {
console.log('Notification received', notification); console.log('Notification received', notification)
}); })
LocalNotifications.addListener('localNotificationActionPerformed', (event) => { LocalNotifications.addListener('localNotificationActionPerformed', event => {
console.log('Notification action performed', event)
console.log('Notification action performed', event); if (event.actionId === 'tap') {
if (event.actionId === 'tap') { console.log(
console.log('Notification opened, navigate to chore', event.notification.extra.choreId); 'Notification opened, navigate to chore',
window.location.href = `/chores/${event.notification.extra.choreId}` event.notification.extra.choreId,
} )
}); window.location.href = `/chores/${event.notification.extra.choreId}`
} }
const pushNotificationListenerRegistration = () => { })
PushNotifications.register(); }
PushNotifications.addListener('registration', (token) => { const pushNotificationListenerRegistration = () => {
if (Capacitor.isNativePlatform()) { PushNotifications.register()
const type = Capacitor.getPlatform() === 'android' ? 1 : 2; // 1 for android, 2 for ios PushNotifications.addListener('registration', token => {
PutNotificationTarget(type, token.value).then((response) => { if (Capacitor.isNativePlatform()) {
console.log('Notification target updated', response); const type = Capacitor.getPlatform() === 'android' ? 1 : 2 // 1 for android, 2 for ios
} PutNotificationTarget(type, token.value)
).catch((error) => { .then(response => {
console.error('Error updating notification target', error); console.log('Notification target updated', response)
} })
); .catch(error => {
console.error('Error updating notification target', error)
})
// TODO save the token in preferences and only send it if it has changed: // TODO save the token in preferences and only send it if it has changed:
console.log('Push registration success, token: ' + token.value); console.log('Push registration success, token: ' + token.value)
}
})
PushNotifications.addListener('registrationError', error => {
console.error('Error on registration: ' + JSON.stringify(error))
})
PushNotifications.addListener('pushNotificationActionPerformed', fcmEvent => {
if (fcmEvent.actionId === 'tap') {
if (fcmEvent.notification.data.type === 'chore_due') {
window.location.href = `/chores/${fcmEvent.notification.data.choreId}`
} else {
window.location.href = `/chores`
} }
} }
); })
PushNotifications.addListener('registrationError', (error) => { PushNotifications.addListener('registrationError', error => {
console.error('Error on registration: ' + JSON.stringify(error)); console.error('Error on registration: ' + JSON.stringify(error))
})
PushNotifications.addListener('pushNotificationActionPerformed', fcmEvent => {
if (fcmEvent.actionId === 'tap') {
if (fcmEvent.notification.data.type === 'chore_due') {
window.location.href = `/chores/${fcmEvent.notification.data.choreId}`
} else {
window.location.href = `/chores`
}
} }
); })
PushNotifications.addListener('pushNotificationActionPerformed', fcmEvent => { }
if(fcmEvent.actionId === 'tap') { const registerCapacitorListeners = () => {
if (fcmEvent.notification.data.type === 'chore_due') { if (!Capacitor.isNativePlatform()) {
window.location.href = `/chores/${fcmEvent.notification.data.choreId}` console.log(
} 'Not a native platform, skipping registration of native listeners',
else { )
window.location.href = `/my/chores` return
} }
localNotificationListenerRegistration()
pushNotificationListenerRegistration()
mobileApp.addListener('backButton', ({ canGoBack }) => {
if (canGoBack) {
window.history.back()
} else {
mobileApp.exitApp()
} }
} })
); }
}
export { registerCapacitorListeners }
const registerCapacitorListeners = () => {
if(!Capacitor.isNativePlatform()) {
console.log('Not a native platform, skipping registration of native listeners');
return
}
localNotificationListenerRegistration();
pushNotificationListenerRegistration();
mobileApp.addListener('backButton', ({ canGoBack }) => {
if (canGoBack) {
window.history.back();
} else {
mobileApp.exitApp();
}
});
}
export { registerCapacitorListeners }

View File

@@ -36,7 +36,7 @@ const AuthenticationLoading = () => {
Cookies.remove('ca_redirect') Cookies.remove('ca_redirect')
Navigate(redirectUrl) Navigate(redirectUrl)
} else { } else {
Navigate('/my/chores') Navigate('/chores')
} }
}) })
}) })

View File

@@ -110,7 +110,7 @@ const LoginView = () => {
Navigate(redirectUrl) Navigate(redirectUrl)
} else { } else {
Cookies.remove('ca_redirect') Cookies.remove('ca_redirect')
Navigate('/my/chores') Navigate('/chores')
} }
}) })
} else if (response.status === 401) { } else if (response.status === 401) {
@@ -206,7 +206,7 @@ const LoginView = () => {
Cookies.remove('ca_redirect') Cookies.remove('ca_redirect')
Navigate(redirectUrl) Navigate(redirectUrl)
} else { } else {
Navigate('/my/chores') Navigate('/chores')
} }
}) })
} }
@@ -225,7 +225,7 @@ const LoginView = () => {
Cookies.remove('ca_redirect') Cookies.remove('ca_redirect')
Navigate(redirectUrl) Navigate(redirectUrl)
} else { } else {
Navigate('/my/chores') Navigate('/chores')
} }
} }

View File

@@ -35,7 +35,7 @@ const SignupView = () => {
setTimeout(() => { setTimeout(() => {
// TODO: not sure if there is a race condition here // TODO: not sure if there is a race condition here
// but on first sign up it renavigates to login. // but on first sign up it renavigates to login.
Navigate('/my/chores') Navigate('/chores')
}, 500) }, 500)
}) })
} else { } else {

View File

@@ -252,7 +252,7 @@ const ChoreEdit = () => {
title: 'Chore Saved', title: 'Chore Saved',
message: 'Your task has been saved successfully!', message: 'Your task has been saved successfully!',
}) })
Navigate('/my/chores/') Navigate('/chores/')
}) })
.catch(error => { .catch(error => {
console.error('Failed to save chore:', error) console.error('Failed to save chore:', error)
@@ -390,7 +390,7 @@ const ChoreEdit = () => {
if (isConfirmed === true) { if (isConfirmed === true) {
DeleteChore(choreId).then(response => { DeleteChore(choreId).then(response => {
if (response.status === 200) { if (response.status === 200) {
Navigate('/my/chores') Navigate('/chores')
} else { } else {
alert('Failed to delete chore') alert('Failed to delete chore')
} }

View File

@@ -85,14 +85,14 @@ const JoinCircleView = () => {
alert( alert(
'Joined circle successfully, wait for the circle owner to accept your request.', 'Joined circle successfully, wait for the circle owner to accept your request.',
) )
navigate('/my/chores') navigate('/chores')
} else { } else {
if (resp.status === 409) { if (resp.status === 409) {
alert('You are already a member of this circle') alert('You are already a member of this circle')
} else { } else {
alert('Failed to join circle') alert('Failed to join circle')
} }
navigate('/my/chores') navigate('/chores')
} }
}) })
}} }}
@@ -111,7 +111,7 @@ const JoinCircleView = () => {
borderRadius: '8px', borderRadius: '8px',
}} }}
onClick={() => { onClick={() => {
navigate('/my/chores') navigate('/chores')
}} }}
> >
Cancel Cancel

View File

@@ -1,12 +1,5 @@
import { HomeRounded, Login } from '@mui/icons-material' import { HomeRounded, Login } from '@mui/icons-material'
import { import { Box, Button, CircularProgress, Container, Typography } from '@mui/joy'
Box,
Button,
CircularProgress,
Container,
Textarea,
Typography,
} from '@mui/joy'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import Logo from '../Logo' // Adjust the import path as necessary import Logo from '../Logo' // Adjust the import path as necessary
@@ -50,7 +43,7 @@ const Error = () => {
<Button <Button
component={Link} component={Link}
to='/my/chores' to='/chores'
variant='outlined' variant='outlined'
color='primary' color='primary'
sx={{ mt: 4 }} sx={{ mt: 4 }}

View File

@@ -179,7 +179,7 @@ const ChoreHistory = () => {
they'll show up here. they'll show up here.
</Typography> </Typography>
<Button variant='soft' sx={{ mt: 2 }}> <Button variant='soft' sx={{ mt: 2 }}>
<Link to='/my/chores'>Go back to chores</Link> <Link to='/chores'>Go back to chores</Link>
</Button> </Button>
</Container> </Container>
) )

View File

@@ -33,7 +33,7 @@ const Home = () => {
<Button <Button
sx={{ mt: 1 }} sx={{ mt: 1 }}
onClick={() => { onClick={() => {
Navigate('/my/chores') Navigate('/chores')
}} }}
> >
Get Started! Get Started!

View File

@@ -79,7 +79,7 @@ const GettingStarted = () => {
fullWidth fullWidth
startDecorator={<AutoAwesome />} startDecorator={<AutoAwesome />}
onClick={() => { onClick={() => {
navigate('/my/chores') navigate('/chores')
}} }}
> >
Start Now! Start Now!

View File

@@ -97,12 +97,12 @@ const HomeHero = () => {
}} }}
className='hover:scale-105' className='hover:scale-105'
onClick={() => { onClick={() => {
// if the url is donetick.com then navigate to app.donetick.com/my/chores // if the url is donetick.com then navigate to app.donetick.com/chores
// else navigate to /my/chores // else navigate to /chores
if (window.location.hostname === 'donetick.com') { if (window.location.hostname === 'donetick.com') {
window.location.href = 'https://app.donetick.com/my/chores' window.location.href = 'https://app.donetick.com/chores'
} else { } else {
navigate('/my/chores') navigate('/chores')
} }
}} }}
> >

View File

@@ -8,7 +8,7 @@ const PaymentCancelledView = () => {
useEffect(() => { useEffect(() => {
const timer = setTimeout(() => { const timer = setTimeout(() => {
navigate('/my/chores') navigate('/chores')
}, 5000) }, 5000)
return () => clearTimeout(timer) return () => clearTimeout(timer)
}, [navigate]) }, [navigate])

View File

@@ -811,7 +811,7 @@ const UserActivites = () => {
You have no activities for the selected period. You have no activities for the selected period.
</Typography> </Typography>
<Button variant='soft' sx={{ mt: 2 }}> <Button variant='soft' sx={{ mt: 2 }}>
<Link to='/my/chores'>Go back to chores</Link> <Link to='/chores'>Go back to chores</Link>
</Button> </Button>
</Container> </Container>
) )

View File

@@ -179,8 +179,9 @@ const NavBar = () => {
position: 'fixed', position: 'fixed',
pt: 'calc(env(safe-area-inset-top, 0px))', pt: 'calc(env(safe-area-inset-top, 0px))',
left: 0, left: 0,
height: pb: 'calc(env(safe-area-inset-bottom, 0px))',
'calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))', // height:
// 'calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))',
overflow: 'auto', overflow: 'auto',
zIndex: Z_INDEX.DRAWER, zIndex: Z_INDEX.DRAWER,
}, },

View File

@@ -35,7 +35,7 @@ const NotFound = () => {
</Typography> </Typography>
<Button <Button
component={Link} component={Link}
to='/my/chores' to='/chores'
variant='outlined' variant='outlined'
color='primary' color='primary'
sx={{ mt: 4 }} sx={{ mt: 4 }}