Skip to content

Commit 84f3400

Browse files
arbrandesclaude
andcommitted
feat: add homeApp to redirect / to the dashboard
Adds an inline app that redirects the root route to the learner dashboard via getUrlByRouteRole, shared across dev and build configs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5133932 commit 84f3400

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

site.config.build.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';
22
import { authnApp } from '@openedx/frontend-app-authn';
33
import { learnerDashboardApp } from '@openedx/frontend-app-learner-dashboard';
4+
import homeApp from './src/homeApp';
45

56
import './src/site.scss';
67

@@ -19,6 +20,7 @@ const siteConfig: SiteConfig = {
1920
footerApp,
2021
authnApp,
2122
learnerDashboardApp,
23+
homeApp,
2224
],
2325
externalRoutes: [
2426
{

site.config.dev.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { EnvironmentTypes, SiteConfig, footerApp, headerApp, shellApp } from '@openedx/frontend-base';
22
import { authnApp } from '@openedx/frontend-app-authn';
33
import { learnerDashboardApp } from '@openedx/frontend-app-learner-dashboard';
4+
import homeApp from './src/homeApp';
45

56
import './src/site.scss';
67

@@ -19,6 +20,7 @@ const siteConfig: SiteConfig = {
1920
footerApp,
2021
authnApp,
2122
learnerDashboardApp,
23+
homeApp,
2224
],
2325
externalRoutes: [
2426
{

src/homeApp.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { App } from '@openedx/frontend-base';
2+
import { getUrlByRouteRole } from '@openedx/frontend-base';
3+
import { Navigate } from 'react-router';
4+
5+
const homeApp: App = {
6+
appId: 'home',
7+
routes: [{
8+
path: '/',
9+
Component: () => {
10+
const dashboardUrl = getUrlByRouteRole('org.openedx.frontend.role.dashboard');
11+
if (dashboardUrl) {
12+
return <Navigate to={dashboardUrl} replace />;
13+
}
14+
return null;
15+
},
16+
}],
17+
};
18+
19+
export default homeApp;

0 commit comments

Comments
 (0)