@@ -18,6 +18,7 @@ import { HomePageWidgetBlueprint } from '@backstage/plugin-home-react/alpha';
1818import homePlugin from '@backstage/plugin-home/alpha' ;
1919import { compatWrapper } from '@backstage/core-compat-api' ;
2020import { homepageMessages } from '../../translations/ref' ;
21+ import { createTranslatedCardRenderer } from '../../utils/translatedCardRenderer' ;
2122
2223const defaultCardLayout = {
2324 width : {
@@ -63,6 +64,7 @@ export const entitySectionWidget = HomePageWidgetBlueprint.make({
6364 components : ( ) =>
6465 import ( '../../components/EntitySection/EntitySection' ) . then ( m => ( {
6566 Content : m . EntitySectionContent ,
67+ Renderer : createTranslatedCardRenderer ( 'entities.title' ) ,
6668 } ) ) ,
6769 } ,
6870} ) ;
@@ -80,6 +82,7 @@ export const templateSectionWidget = HomePageWidgetBlueprint.make({
8082 components : ( ) =>
8183 import ( '../../components/TemplateSection/TemplateSection' ) . then ( m => ( {
8284 Content : m . TemplateSectionContent ,
85+ Renderer : createTranslatedCardRenderer ( 'templates.title' ) ,
8386 } ) ) ,
8487 } ,
8588} ) ;
@@ -97,6 +100,9 @@ export const quickAccessCardWidget = HomePageWidgetBlueprint.make({
97100 components : ( ) =>
98101 import ( '../../components/QuickAccessCard' ) . then ( m => ( {
99102 Content : m . QuickAccessCardContent ,
103+ Renderer : createTranslatedCardRenderer ( 'quickAccess.title' , {
104+ quickAccessStyle : true ,
105+ } ) ,
100106 } ) ) ,
101107 } ,
102108} ) ;
@@ -128,15 +134,14 @@ export const searchBarWidget = HomePageWidgetBlueprint.make({
128134} ) ;
129135
130136/**
131- * Renders a legacy plugin-home CardExtension directly, skipping the NFS
132- * CardExtension InfoCard shell. Used when upstream only exports full cards
133- * (not Content) from the public API.
137+ * Renders upstream home cards that include their own InfoCard shell.
138+ * @alpha
134139 */
135- const legacyHomeCardRenderer = ( {
140+ const upstreamHomeCardRenderer = ( {
136141 Content,
137142} : {
138143 Content : React . ComponentType ;
139- } ) => compatWrapper ( < Content /> ) ;
144+ } ) => < Content /> ;
140145
141146/**
142147 * NFS widget: FeaturedDocsCard (migrated from mountPoint home.page/cards).
@@ -146,11 +151,12 @@ export const featuredDocsCardWidget = HomePageWidgetBlueprint.make({
146151 name : 'featured-docs-card' ,
147152 params : {
148153 name : 'Featured docs' ,
154+ title : homepageMessages . featuredDocs . title ,
149155 layout : defaultCardLayout ,
150156 components : ( ) =>
151157 import ( '../../components/FeaturedDocsCard' ) . then ( m => ( {
152158 Content : m . FeaturedDocsCard ,
153- Renderer : legacyHomeCardRenderer ,
159+ Renderer : upstreamHomeCardRenderer ,
154160 } ) ) ,
155161 } ,
156162} ) ;
@@ -164,7 +170,14 @@ export const catalogStarredWidget = homePlugin
164170 . override ( {
165171 params : {
166172 name : 'CatalogStarred' ,
167- title : 'Starred catalog entities' ,
173+ title : homepageMessages . starredEntities . title ,
174+ components : ( ) =>
175+ import ( '../../components/legacy/TranslatedUpstreamHomePageCards' ) . then (
176+ m => ( {
177+ Content : m . CatalogStarredEntitiesCard ,
178+ Renderer : upstreamHomeCardRenderer ,
179+ } ) ,
180+ ) ,
168181 } ,
169182 } ) ;
170183
@@ -187,11 +200,14 @@ export const RecentlyVisitedWidget = HomePageWidgetBlueprint.make({
187200 params : {
188201 layout : defaultCardLayout ,
189202 name : 'Recently visited' ,
203+ title : homepageMessages . recentlyVisited . title ,
190204 components : ( ) =>
191- import ( '@backstage/plugin-home' ) . then ( m => ( {
192- Content : m . HomePageRecentlyVisited ,
193- Renderer : legacyHomeCardRenderer ,
194- } ) ) ,
205+ import ( '../../components/legacy/TranslatedUpstreamHomePageCards' ) . then (
206+ m => ( {
207+ Content : m . RecentlyVisitedCard ,
208+ Renderer : upstreamHomeCardRenderer ,
209+ } ) ,
210+ ) ,
195211 } ,
196212} ) ;
197213
@@ -204,10 +220,13 @@ export const TopVisitedWidget = HomePageWidgetBlueprint.make({
204220 params : {
205221 layout : defaultCardLayout ,
206222 name : 'Top visited' ,
223+ title : homepageMessages . topVisited . title ,
207224 components : ( ) =>
208- import ( '@backstage/plugin-home' ) . then ( m => ( {
209- Content : m . HomePageTopVisited ,
210- Renderer : legacyHomeCardRenderer ,
211- } ) ) ,
225+ import ( '../../components/legacy/TranslatedUpstreamHomePageCards' ) . then (
226+ m => ( {
227+ Content : m . TopVisitedCard ,
228+ Renderer : upstreamHomeCardRenderer ,
229+ } ) ,
230+ ) ,
212231 } ,
213232} ) ;
0 commit comments