1717import { HomePageWidgetBlueprint } from '@backstage/plugin-home-react/alpha' ;
1818import homePlugin from '@backstage/plugin-home/alpha' ;
1919import { compatWrapper } from '@backstage/core-compat-api' ;
20+ import { InfoCard } from '@backstage/core-components' ;
2021import { homepageMessages } from '../../translations/ref' ;
2122import { createTranslatedCardRenderer } from '../../utils/translatedCardRenderer' ;
2223
@@ -33,6 +34,28 @@ const defaultCardLayout = {
3334 } ,
3435} as const ;
3536
37+ /**
38+ * Renders widget content without an InfoCard shell (used by Search).
39+ * @alpha
40+ */
41+ const headlessCardRenderer = ( { Content } : { Content : React . ComponentType } ) =>
42+ compatWrapper ( < Content /> ) ;
43+
44+ /**
45+ * Renders widget content inside an InfoCard without a title header.
46+ * @alpha
47+ */
48+ const untitledInfoCardRenderer = ( {
49+ Content,
50+ } : {
51+ Content : React . ComponentType ;
52+ } ) =>
53+ compatWrapper (
54+ < InfoCard divider = { false } >
55+ < Content />
56+ </ InfoCard > ,
57+ ) ;
58+
3659/**
3760 * NFS widget: OnboardingSection (migrated from mountPoint home.page/cards).
3861 * @alpha
@@ -41,11 +64,13 @@ export const onboardingSectionWidget = HomePageWidgetBlueprint.make({
4164 name : 'rhdh-onboarding-section' ,
4265 params : {
4366 name : 'Red Hat Developer Hub - Onboarding' ,
67+ title : homepageMessages . onboarding . title ,
4468 layout : defaultCardLayout ,
4569 components : ( ) =>
4670 import ( '../../components/OnboardingSection/OnboardingSection' ) . then (
4771 m => ( {
4872 Content : m . OnboardingSectionContent ,
73+ Renderer : untitledInfoCardRenderer ,
4974 } ) ,
5075 ) ,
5176 } ,
@@ -115,6 +140,7 @@ export const searchBarWidget = HomePageWidgetBlueprint.make({
115140 name : 'search-bar' ,
116141 params : {
117142 name : 'Search' ,
143+ title : homepageMessages . search . title ,
118144 layout : {
119145 ...defaultCardLayout ,
120146 height : {
@@ -127,8 +153,7 @@ export const searchBarWidget = HomePageWidgetBlueprint.make({
127153 components : ( ) =>
128154 import ( '../../components/SearchBar' ) . then ( m => ( {
129155 Content : m . SearchBar ,
130- Renderer : ( { Content } : { Content : React . ComponentType } ) =>
131- compatWrapper ( < Content /> ) ,
156+ Renderer : headlessCardRenderer ,
132157 } ) ) ,
133158 } ,
134159} ) ;
@@ -201,6 +226,7 @@ export const RecentlyVisitedWidget = HomePageWidgetBlueprint.make({
201226 layout : defaultCardLayout ,
202227 name : 'Recently visited' ,
203228 title : homepageMessages . recentlyVisited . title ,
229+ description : homepageMessages . recentlyVisited . description ,
204230 components : ( ) =>
205231 import ( '../../components/legacy/TranslatedUpstreamHomePageCards' ) . then (
206232 m => ( {
@@ -221,6 +247,7 @@ export const TopVisitedWidget = HomePageWidgetBlueprint.make({
221247 layout : defaultCardLayout ,
222248 name : 'Top visited' ,
223249 title : homepageMessages . topVisited . title ,
250+ description : homepageMessages . topVisited . description ,
224251 components : ( ) =>
225252 import ( '../../components/legacy/TranslatedUpstreamHomePageCards' ) . then (
226253 m => ( {
@@ -230,3 +257,24 @@ export const TopVisitedWidget = HomePageWidgetBlueprint.make({
230257 ) ,
231258 } ,
232259} ) ;
260+
261+ /**
262+ * NFS widget: RandomJoke (overrides upstream home plugin widget).
263+ * @alpha
264+ */
265+ export const randomJokeWidget = homePlugin
266+ . getExtension ( 'home-page-widget:home/random-joke' )
267+ . override ( {
268+ params : {
269+ name : 'HomePageRandomJoke' ,
270+ title : homepageMessages . randomJoke . title ,
271+ description : homepageMessages . randomJoke . description ,
272+ components : ( ) =>
273+ import ( '../../components/legacy/TranslatedUpstreamHomePageCards' ) . then (
274+ m => ( {
275+ Content : m . JokeCard ,
276+ Renderer : upstreamHomeCardRenderer ,
277+ } ) ,
278+ ) ,
279+ } ,
280+ } ) ;
0 commit comments