This repository was archived by the owner on Aug 21, 2024. It is now read-only.
Admin Route Extensibility #9043
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Projects can take advantage of the webappInjection API in xrengine.config.ts to add new routes
🤖 Generated by Copilot at cfbf771
This pull request improves the admin dashboard functionality by using a new state for the allowed admin routes, refactoring the admin routes logic, and removing unused or outdated code. It also enhances the performance and readability of the admin dashboard components by using code splitting, simplifying the rendering logic, and using a new Redirect component. The main files affected are
.env.local.default,appconfig.ts,adminRoutes.tsx,allowedRoutes.tsx,AllowedAdminRoutesState.tsx,DefaultAdminRoutes.tsx,DashboardMenuItem/index.tsx, andRedirect.tsx.References
closes #insert number here
Explanation
🤖 Generated by Copilot at cfbf771
.env.local.defaultfile (link, link)DashboardItemsfile toDefaultAdminRoutesand export an object of default admin routes with name, scope, component, access, and icon properties (link)AllowedAdminRoutesStatethat defines a state for the allowed admin routes using Hyperflux library (link)AdminRoutesfile to import and use theAllowedAdminRoutesStateand theDefaultAdminRoutesto determine the user's access to each admin route based on their scopes (link, link, link)allowedRoutesfile to use the allowed routes state from theAllowedAdminRoutesState, instead of the props passed from theadminRoutesfile, and to render the matched route using the pathname and the access property of each route (link)Redirectthat defines a Redirect component using the RouterState from the RouterService, and use it to redirect the user to a different route if the current route has a redirect property in theAllowedAdminRoutesState(link)DashboardMenuItemfile to use theAllowedAdminRoutesStateto render the sidebar items, instead of the useState and useEffect hooks, and to filter and map the sidebar items using the Object.entries and the access property of each route (link, link)appconfigfile, as they are now defined in the database and the user service (link, link)AdminRoutesandDashboardMenuItemfiles, as it is no longer a separate component (link, link, link, link)🤖 Generated by Copilot at cfbf771
QA Steps
List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.
Checklist