@@ -22,29 +22,21 @@ const sidebarBreakpoints = { xl: 1250, lg: 1100, md: 800, sm: 500 };
2222const documentationLink =
2323 'https://docs.redhat.com/en/documentation/red_hat_hybrid_cloud_console/1-latest/html-single/getting_started_with_the_red_hat_hybrid_cloud_console/index#customizing-main-page_navigating-the-console' ;
2424
25- const LayoutEmptyState = ( ) => {
26- const setDrawerExpanded = useSetAtom ( drawerExpandedAtom ) ;
27-
28- useEffect ( ( ) => {
29- setDrawerExpanded ( true ) ;
30- } , [ ] ) ;
31-
32- return (
33- < PageSection hasBodyWrapper = { false } className = "empty-layout pf-v6-u-p-0" >
34- < EmptyState headingLevel = "h2" icon = { PlusCircleIcon } titleText = "No dashboard content" variant = { EmptyStateVariant . lg } className = "pf-v6-u-p-sm" >
35- < EmptyStateBody >
36- You don't have any widgets on your dashboard. To populate your dashboard, drag < GripVerticalIcon /> items from the blue widget bank to
37- this dashboard body here.
38- </ EmptyStateBody >
39- < EmptyStateActions >
40- < Button variant = "link" icon = { < ExternalLinkAltIcon /> } iconPosition = "end" component = "a" href = { documentationLink } >
41- Learn about your widget dashboard
42- </ Button >
43- </ EmptyStateActions >
44- </ EmptyState >
45- </ PageSection >
46- ) ;
47- } ;
25+ const LayoutEmptyState = ( ) => (
26+ < PageSection hasBodyWrapper = { false } className = "empty-layout pf-v6-u-p-0" >
27+ < EmptyState headingLevel = "h2" icon = { PlusCircleIcon } titleText = "No dashboard content" variant = { EmptyStateVariant . lg } className = "pf-v6-u-p-sm" >
28+ < EmptyStateBody >
29+ You don't have any widgets on your dashboard. To populate your dashboard, drag < GripVerticalIcon /> items from the blue widget bank to
30+ this dashboard body here.
31+ </ EmptyStateBody >
32+ < EmptyStateActions >
33+ < Button variant = "link" icon = { < ExternalLinkAltIcon /> } iconPosition = "end" component = "a" href = { documentationLink } >
34+ Learn about your widget dashboard
35+ </ Button >
36+ </ EmptyStateActions >
37+ </ EmptyState >
38+ </ PageSection >
39+ ) ;
4840
4941const getResizeHandle = ( resizeHandleAxis : string , ref : React . Ref < HTMLDivElement > ) => (
5042 < div ref = { ref } className = { `react-resizable-handle react-resizable-handle-${ resizeHandleAxis } ` } >
@@ -95,6 +87,10 @@ const GridLayout = ({ template, saveTemplate, isLoaded, isLayoutLocked = false,
9587 const activeLayout = newTemplate [ layoutVariant ] || [ ] ;
9688 setCurrentlyUsedWidgets ( activeLayout . map ( ( item ) => item . widgetType ) ) ;
9789
90+ if ( activeLayout . length === 0 ) {
91+ setDrawerExpanded ( true ) ;
92+ }
93+
9894 await saveTemplate ( newTemplate as LocalExtendedTemplateConfig ) ;
9995 } ;
10096
@@ -108,6 +104,12 @@ const GridLayout = ({ template, saveTemplate, isLoaded, isLayoutLocked = false,
108104
109105 const activeLayout = patternFlyTemplate [ layoutVariant ] || [ ] ;
110106
107+ useEffect ( ( ) => {
108+ if ( isLoaded && activeLayout . length === 0 ) {
109+ setDrawerExpanded ( true ) ;
110+ }
111+ } , [ isLoaded ] ) ;
112+
111113 return (
112114 < div id = "widget-layout-container" style = { { position : 'relative' } } ref = { layoutRef } >
113115 { activeLayout . length === 0 && isLoaded && < LayoutEmptyState /> }
0 commit comments