@@ -6,7 +6,7 @@ import { Close } from '@mui/icons-material';
6
6
import { CatalogGrid } from './components/CatalogGrid' ;
7
7
import { POLL_INTERVAL } from './Constants' ;
8
8
import { CatalogProvider , useCatalogContext } from './context/CatalogContext' ;
9
- import { MCPClientProvider } from './context/MCPClientContext' ;
9
+ import { MCPClientProvider , useMCPClientContext } from './context/MCPClientContext' ;
10
10
import ConfigurationModal from './components/ConfigurationModal' ;
11
11
import { Settings as SettingsIcon } from '@mui/icons-material' ;
12
12
@@ -63,35 +63,51 @@ interface AppContentProps {
63
63
}
64
64
65
65
function AppContent ( { settings, setSettings, configuringItem, setConfiguringItem } : AppContentProps ) {
66
- const { imagesLoadingResults , loadImagesIfNeeded , secrets , catalogItems , registryItems , } = useCatalogContext ( ) ;
67
- if ( ! imagesLoadingResults || imagesLoadingResults . stderr ) {
68
- return < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
69
- { ! imagesLoadingResults && < CircularProgress sx = { { marginBottom : 2 } } /> }
70
- { ! imagesLoadingResults && < Typography > Loading images... </ Typography > }
71
- { imagesLoadingResults && < Alert sx = { { fontSize : '1.5em' } } action = { < Button variant = 'outlined' color = 'secondary' onClick = { ( ) => loadImagesIfNeeded ( ) } > Retry </ Button > } title = "Error loading images" severity = "error" > { imagesLoadingResults . stderr } </ Alert > }
72
- < Typography > { imagesLoadingResults ?. stdout } </ Typography >
73
- </ Paper >
74
- }
66
+ const {
67
+ imagesLoadingResults,
68
+ loadImagesIfNeeded ,
69
+ catalogItems ,
70
+ secretsLoading ,
71
+ catalogLoading ,
72
+ registryLoading ,
73
+ imagesIsFetching
74
+ } = useCatalogContext ( ) ;
75
75
76
- if ( ! secrets ) {
77
- return < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
78
- < CircularProgress />
79
- < Typography > Loading secrets...</ Typography >
80
- </ Paper >
81
- }
76
+ const { isFetching : mcpFetching } = useMCPClientContext ( ) ;
77
+
78
+ // Instead of showing full-page loading states for each resource, let's implement a more unified approach
79
+ // Only show full-page loading during initial load, not during background refetching
80
+ const isInitialLoading = ! catalogItems ;
82
81
83
- if ( ! catalogItems ) {
84
- return < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
85
- < CircularProgress />
86
- < Typography > Loading catalog...</ Typography >
87
- </ Paper >
82
+ // Critical error check - only for images as they're required for the app to function
83
+ if ( imagesLoadingResults ?. stderr ) {
84
+ return (
85
+ < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
86
+ < Alert
87
+ sx = { { fontSize : '1.5em' } }
88
+ action = {
89
+ < Button variant = 'outlined' color = 'secondary' onClick = { ( ) => loadImagesIfNeeded ( ) } >
90
+ Retry
91
+ </ Button >
92
+ }
93
+ title = "Error loading images"
94
+ severity = "error"
95
+ >
96
+ { imagesLoadingResults . stderr }
97
+ </ Alert >
98
+ < Typography > { imagesLoadingResults ?. stdout } </ Typography >
99
+ </ Paper >
100
+ ) ;
88
101
}
89
102
90
- if ( ! registryItems ) {
91
- return < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
92
- < CircularProgress />
93
- < Typography > Loading registry...</ Typography >
94
- </ Paper >
103
+ // Show one unified loading screen during initial load
104
+ if ( isInitialLoading ) {
105
+ return (
106
+ < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
107
+ < CircularProgress sx = { { marginBottom : 2 } } />
108
+ < Typography > Loading application...</ Typography >
109
+ </ Paper >
110
+ ) ;
95
111
}
96
112
97
113
return (
@@ -119,7 +135,6 @@ function AppContent({ settings, setSettings, configuringItem, setConfiguringItem
119
135
</ Dialog >
120
136
) }
121
137
122
- { /* Replace the old PromptConfig dialog with our new ConfigurationModal */ }
123
138
{ configuringItem && (
124
139
< ConfigurationModal
125
140
open = { configuringItem !== null }
@@ -129,6 +144,27 @@ function AppContent({ settings, setSettings, configuringItem, setConfiguringItem
129
144
/>
130
145
) }
131
146
147
+ { /* Show a small loading indicator in the corner during background refetching */ }
148
+ { ( imagesIsFetching || secretsLoading || catalogLoading || registryLoading || mcpFetching ) && (
149
+ < Box
150
+ sx = { {
151
+ position : 'fixed' ,
152
+ bottom : 16 ,
153
+ right : 16 ,
154
+ zIndex : 9999 ,
155
+ display : 'flex' ,
156
+ alignItems : 'center' ,
157
+ backgroundColor : 'background.paper' ,
158
+ borderRadius : 2 ,
159
+ padding : 1 ,
160
+ boxShadow : 3
161
+ } }
162
+ >
163
+ < CircularProgress size = { 20 } sx = { { mr : 1 } } />
164
+ < Typography variant = "caption" > Refreshing data...</ Typography >
165
+ </ Box >
166
+ ) }
167
+
132
168
< Stack direction = "column" spacing = { 1 } justifyContent = 'center' alignItems = 'center' >
133
169
< Stack direction = "row" spacing = { 1 } justifyContent = 'space-evenly' alignItems = 'center' sx = { { width : '100%' , maxWidth : '1000px' } } >
134
170
< Logo />
0 commit comments