This repository has been archived by the owner on Aug 21, 2024. It is now read-only.
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.default
file (link, link)DashboardItems
file toDefaultAdminRoutes
and export an object of default admin routes with name, scope, component, access, and icon properties (link)AllowedAdminRoutesState
that defines a state for the allowed admin routes using Hyperflux library (link)AdminRoutes
file to import and use theAllowedAdminRoutesState
and theDefaultAdminRoutes
to determine the user's access to each admin route based on their scopes (link, link, link)allowedRoutes
file to use the allowed routes state from theAllowedAdminRoutesState
, instead of the props passed from theadminRoutes
file, and to render the matched route using the pathname and the access property of each route (link)Redirect
that 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)DashboardMenuItem
file to use theAllowedAdminRoutesState
to 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)appconfig
file, as they are now defined in the database and the user service (link, link)AdminRoutes
andDashboardMenuItem
files, 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