@@ -8,7 +8,9 @@ import { POLL_INTERVAL } from './Constants';
88import { CatalogProvider , useCatalogContext } from './context/CatalogContext' ;
99import { ConfigProvider } from './context/ConfigContext' ;
1010import { MCPClientProvider , useMCPClientContext } from './context/MCPClientContext' ;
11+ import { RequiredImagesProvider , useRequiredImagesContext } from './context/RequiredImageContext' ;
1112import ConfigurationModal from './components/tile/Modal' ;
13+ import LoadingState from './components/LoadingState' ;
1214
1315export const client = createDockerDesktopClient ( ) ;
1416
@@ -23,16 +25,18 @@ export function App() {
2325 // Wrap the entire application with our providers
2426 return (
2527 < ConfigProvider client = { client } >
26- < CatalogProvider client = { client } >
27- < MCPClientProvider client = { client } >
28- < AppContent
29- settings = { settings }
30- setSettings = { setSettings }
31- configuringItem = { configuringItem }
32- setConfiguringItem = { setConfiguringItem }
33- />
34- </ MCPClientProvider >
35- </ CatalogProvider >
28+ < RequiredImagesProvider client = { client } >
29+ < CatalogProvider client = { client } >
30+ < MCPClientProvider client = { client } >
31+ < AppContent
32+ settings = { settings }
33+ setSettings = { setSettings }
34+ configuringItem = { configuringItem }
35+ setConfiguringItem = { setConfiguringItem }
36+ />
37+ </ MCPClientProvider >
38+ </ CatalogProvider >
39+ </ RequiredImagesProvider >
3640 </ ConfigProvider >
3741 ) ;
3842}
@@ -44,53 +48,22 @@ interface AppContentProps {
4448 setConfiguringItem : React . Dispatch < React . SetStateAction < CatalogItemWithName | null > > ;
4549}
4650
47- function AppContent ( { settings, setSettings, configuringItem, setConfiguringItem } : AppContentProps ) {
48- const {
49- imagesLoadingResults,
50- loadImagesIfNeeded,
51- catalogItems,
52- } = useCatalogContext ( ) ;
51+ function AppContent ( { settings, setSettings, setConfiguringItem } : AppContentProps ) {
52+ const { secretsLoading, catalogLoading, registryLoading } = useCatalogContext ( ) ;
53+ const { isLoading : imagesLoading } = useRequiredImagesContext ( ) ;
5354
54- // Instead of showing full-page loading states for each resource, let's implement a more unified approach
55- // Only show full-page loading during initial load, not during background refetching
56- const isInitialLoading = ! catalogItems ;
55+ const isLoading = secretsLoading || catalogLoading || registryLoading || imagesLoading ;
5756
58- // Critical error check - only for images as they're required for the app to function
59- if ( imagesLoadingResults ?. stderr ) {
60- return (
61- < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
62- < Alert
63- sx = { { fontSize : '1.5em' } }
64- action = {
65- < Button variant = 'outlined' color = 'secondary' onClick = { ( ) => loadImagesIfNeeded ( ) } >
66- Retry
67- </ Button >
68- }
69- title = "Error loading images"
70- severity = "error"
71- >
72- { imagesLoadingResults . stderr }
73- </ Alert >
74- < Typography > { imagesLoadingResults ?. stdout } </ Typography >
75- </ Paper >
76- ) ;
77- }
78-
79- // Show one unified loading screen during initial load
80- if ( isInitialLoading ) {
81- return (
82- < Paper sx = { { padding : 2 , height : '90vh' , display : 'flex' , flexDirection : 'column' , justifyContent : 'center' , alignItems : 'center' } } >
83- < CircularProgress sx = { { marginBottom : 2 } } />
84- < Typography > Loading application...</ Typography >
85- </ Paper >
86- ) ;
87- }
8857 return (
8958 < >
90- < CatalogGrid
91- setConfiguringItem = { setConfiguringItem }
92- showSettings = { ( ) => setSettings ( { ...settings , showModal : true } ) }
93- />
59+ { isLoading ? (
60+ < LoadingState />
61+ ) : (
62+ < CatalogGrid
63+ setConfiguringItem = { setConfiguringItem }
64+ showSettings = { ( ) => setSettings ( { ...settings , showModal : true } ) }
65+ />
66+ ) }
9467 </ >
9568 ) ;
9669}
0 commit comments