@@ -8,7 +8,9 @@ import { POLL_INTERVAL } from './Constants';
8
8
import { CatalogProvider , useCatalogContext } from './context/CatalogContext' ;
9
9
import { ConfigProvider } from './context/ConfigContext' ;
10
10
import { MCPClientProvider , useMCPClientContext } from './context/MCPClientContext' ;
11
+ import { RequiredImagesProvider , useRequiredImagesContext } from './context/RequiredImageContext' ;
11
12
import ConfigurationModal from './components/tile/Modal' ;
13
+ import LoadingState from './components/LoadingState' ;
12
14
13
15
export const client = createDockerDesktopClient ( ) ;
14
16
@@ -23,16 +25,18 @@ export function App() {
23
25
// Wrap the entire application with our providers
24
26
return (
25
27
< 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 >
36
40
</ ConfigProvider >
37
41
) ;
38
42
}
@@ -44,53 +48,22 @@ interface AppContentProps {
44
48
setConfiguringItem : React . Dispatch < React . SetStateAction < CatalogItemWithName | null > > ;
45
49
}
46
50
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 ( ) ;
53
54
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 ;
57
56
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
- }
88
57
return (
89
58
< >
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
+ ) }
94
67
</ >
95
68
) ;
96
69
}
0 commit comments