Refactor navigation components and enhance return context handling
Deploy Development / deploy (push) Failing after 24s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 7s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Failing after 24s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 7s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m22s
- Replaced `PageReturnLink` with `PageReturnButton` for consistent back navigation across various pages. - Updated multiple components, including `ExercisePeekModal`, `PageFormEditorChrome`, and `ExerciseDetailPage`, to utilize the new return context features. - Enhanced CSS styles for the new return button to improve visual consistency. - Improved navigation logic in `TrainingFrameworkProgramEditPage` and `TrainingModuleEditPage` to ensure seamless user experience when navigating back to previous locations.
This commit is contained in:
1 parent
6e6270b717
commit
4588ef4c7e
28 files changed
+497
-190
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { useCallback, useMemo } from 'react'
|
||||
import { useLocation, useNavigate } from 'react-router-dom'
|
||||
import { goNavReturn, resolveNavReturnTarget } from '../utils/navReturnContext'
|
||||
|
||||
/**
|
||||
* @param {{ path: string, label: string } | null | undefined} fallback
|
||||
*/
|
||||
export function useNavReturn(fallback) {
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
const target = useMemo(
|
||||
() => resolveNavReturnTarget(location, fallback),
|
||||
[location, fallback]
|
||||
)
|
||||
const goBack = useCallback(() => {
|
||||
goNavReturn(navigate, location, fallback)
|
||||
}, [navigate, location, fallback])
|
||||
return { goBack, target }
|
||||
}
|
||||
Reference in new issue
Block a user