|
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | | -import { Navigate, Route } from 'react-router-dom'; |
| 16 | +import { Route } from 'react-router-dom'; |
17 | 17 | import { apiDocsPlugin, ApiExplorerPage } from '@backstage/plugin-api-docs'; |
18 | 18 | import { |
19 | 19 | CatalogEntityPage, |
@@ -54,13 +54,59 @@ import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/ |
54 | 54 | import { scorecardTranslations } from '@red-hat-developer-hub/backstage-plugin-scorecard/alpha'; |
55 | 55 | import { githubAuthApiRef } from '@backstage/core-plugin-api'; |
56 | 56 | import { getThemes } from '@red-hat-developer-hub/backstage-plugin-theme'; |
| 57 | +import { ScorecardHomepageSection } from '@red-hat-developer-hub/backstage-plugin-scorecard'; |
| 58 | + |
| 59 | +import { ScalprumContext, ScalprumState } from '@scalprum/react-core'; |
| 60 | +import { PluginStore } from '@openshift/dynamic-plugin-sdk'; |
| 61 | +import { |
| 62 | + DynamicCustomizableHomePage, |
| 63 | + OnboardingSection, |
| 64 | + defaultLayouts, |
| 65 | + HomePageCardMountPoint, |
| 66 | + homepageTranslations, |
| 67 | +} from '@red-hat-developer-hub/backstage-plugin-dynamic-home-page'; |
| 68 | + |
| 69 | +const mountPoints: HomePageCardMountPoint[] = [ |
| 70 | + { |
| 71 | + Component: OnboardingSection, |
| 72 | + config: { |
| 73 | + layouts: defaultLayouts.onboarding, |
| 74 | + }, |
| 75 | + }, |
| 76 | + { |
| 77 | + Component: ScorecardHomepageSection, |
| 78 | + config: { |
| 79 | + layouts: { |
| 80 | + xl: { w: 12, h: 6 }, |
| 81 | + lg: { w: 12, h: 6 }, |
| 82 | + md: { w: 12, h: 7 }, |
| 83 | + sm: { w: 12, h: 8 }, |
| 84 | + xs: { w: 12, h: 9 }, |
| 85 | + xxs: { w: 12, h: 10 }, |
| 86 | + }, |
| 87 | + }, |
| 88 | + }, |
| 89 | +]; |
| 90 | + |
| 91 | +const scalprumState: ScalprumState = { |
| 92 | + initialized: true, |
| 93 | + api: { |
| 94 | + dynamicRootConfig: { |
| 95 | + mountPoints: { |
| 96 | + 'home.page/cards': mountPoints, |
| 97 | + }, |
| 98 | + }, |
| 99 | + }, |
| 100 | + config: {}, |
| 101 | + pluginStore: new PluginStore(), |
| 102 | +}; |
57 | 103 |
|
58 | 104 | const app = createApp({ |
59 | 105 | apis, |
60 | 106 | themes: getThemes(), |
61 | 107 | __experimentalTranslations: { |
62 | 108 | availableLanguages: ['en', 'de', 'fr', 'es'], |
63 | | - resources: [scorecardTranslations], |
| 109 | + resources: [scorecardTranslations, homepageTranslations], |
64 | 110 | }, |
65 | 111 | bindRoutes({ bind }) { |
66 | 112 | bind(catalogPlugin.externalRoutes, { |
@@ -100,7 +146,14 @@ const app = createApp({ |
100 | 146 |
|
101 | 147 | const routes = ( |
102 | 148 | <FlatRoutes> |
103 | | - <Route path="/" element={<Navigate to="catalog" />} /> |
| 149 | + <Route |
| 150 | + path="/" |
| 151 | + element={ |
| 152 | + <ScalprumContext.Provider value={scalprumState}> |
| 153 | + <DynamicCustomizableHomePage /> |
| 154 | + </ScalprumContext.Provider> |
| 155 | + } |
| 156 | + /> |
104 | 157 | <Route path="/catalog" element={<CatalogIndexPage />} /> |
105 | 158 | <Route |
106 | 159 | path="/catalog/:namespace/:kind/:name" |
|
0 commit comments