Closed Omri-Levy closed 1 week ago
Latest commit: 9a948c4e724a198ac33475389f5bb6d6cada15df
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The updates involve a significant refactor of the URL generation logic across several components, replacing the useLocale
hook with the newly created useRedirectToRootUrl
hook. This change centralizes and conditionally manages the root URL redirections based on user information and locale settings. Additionally, there are updates to the authentication and error handling mechanisms, such as adjusting the AuthProvider
settings and adding loading states.
File Path | Change Summary |
---|---|
apps/backoffice-v2/src/common/components/organisms/Header/Header.Logo.tsx |
Replaced useLocale with useRedirectToRootUrl for determining the destination URL. |
apps/backoffice-v2/src/common/components/templates/Providers/Providers.tsx |
Removed useLocation and useLocale hooks; simplified AuthProvider configuration. |
apps/backoffice-v2/src/common/hooks/useRedirectToRootUrl/useRedirectToRootUrl.tsx |
Introduced a new hook useRedirectToRootUrl that uses useLocale and useCustomerQuery to manage root URL redirection. |
apps/backoffice-v2/src/domains/auth/context/AuthProvider/AuthProvider.tsx |
Updated AuthProvider to use useRedirectToRootUrl , removed unnecessary props, and introduced new declarations for redirection and locale settings. |
apps/backoffice-v2/src/pages/Home/Home.page.tsx |
Added conditional rendering of FullScreenLoader based on the isLoadingCustomer state. |
apps/backoffice-v2/src/pages/NotFound/NotFound.tsx |
Replaced useLocale with useRedirectToRootUrl to determine redirection URLs. |
apps/backoffice-v2/src/pages/Root/Root.error.tsx |
Updated error handling to use useRedirectToRootUrl for determining redirect URLs, removing locale . |
In the land of code so swift,
URL roots now seamlessly drift.
Hooks align, locales now share,
Redirects managed with greater care.
As loaders dance, ensuring grace,
Navigation finds its place.
🐇✨ Elegance sets the pace.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
useRedirectToRootUrl
for more flexible URL redirections based on user locale and customer configurations.Enhancements
Logo
,NotFoundRedirect
, andAuthProvider
components to use the newuseRedirectToRootUrl
hook.AuthProvider
.User Experience
FullScreenLoader
component to the Home page for better loading state handling.