-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
71 lines (62 loc) · 1.81 KB
/
Copy pathApp.tsx
File metadata and controls
71 lines (62 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
* Java Engineering Masterclass - Main Application
* Production-grade React + TypeScript application
*/
import { NavigationProvider, ConsoleProvider, SearchProvider, useNavigation, isModuleView } from './contexts';
import { Layout, ModuleHub, ModuleTabs } from './components';
import { GCModule, ThreadsModule, JITModule, JMMModule, StaticModule, ArchitectureModule, PlatformModule, JDBCModule, ServletModule, StreamsModule } from './features';
import type { ModuleId } from './types';
/**
* Module Renderer Component
* Renders the appropriate module based on current navigation state
*/
function ModuleRenderer() {
const { currentView } = useNavigation();
if (!isModuleView(currentView)) {
return <ModuleHub />;
}
// Module component mapping (OCP - easily extensible)
const moduleComponents: Record<ModuleId, React.ComponentType> = {
gc: GCModule,
threads: ThreadsModule,
jit: JITModule,
jmm: JMMModule,
static: StaticModule,
architecture: ArchitectureModule,
platform: PlatformModule,
jdbc: JDBCModule,
servlet: ServletModule,
streams: StreamsModule,
};
const ModuleComponent = moduleComponents[currentView];
return <ModuleComponent />;
}
/**
* App Layout Wrapper
* Provides navigation tabs for module views
*/
function AppContent() {
const { currentView } = useNavigation();
const showModuleNav = isModuleView(currentView);
return (
<Layout moduleNav={showModuleNav ? <ModuleTabs /> : undefined}>
<ModuleRenderer />
</Layout>
);
}
/**
* Root Application Component
* Wrapped with all required context providers
*/
function App() {
return (
<NavigationProvider>
<ConsoleProvider>
<SearchProvider>
<AppContent />
</SearchProvider>
</ConsoleProvider>
</NavigationProvider>
);
}
export default App;