11import React , { Suspense , useEffect } from 'react' ;
2+ import { ThemeProvider } from '@mui/material/styles' ;
3+ import { lightTheme , darkTheme } from '../component/theme/Themes' ;
24import NeoWelcomeScreenModal from '../modal/WelcomeScreenModal' ;
35import { connect } from 'react-redux' ;
46import {
@@ -101,15 +103,15 @@ const Application = ({
101103 useEffect ( ( ) => {
102104 if ( ! initialized ) {
103105 // Tell Neo4j Desktop to disable capturing right clicking
104- window . neo4jDesktopApi &&
105- window . neo4jDesktopApi . showMenuOnRightClick &&
106- window . neo4jDesktopApi . showMenuOnRightClick ( false ) ;
106+ ( window as any ) . neo4jDesktopApi &&
107+ ( window as any ) . neo4jDesktopApi . showMenuOnRightClick &&
108+ ( window as any ) . neo4jDesktopApi . showMenuOnRightClick ( false ) ;
107109 setInitialized ( true ) ;
108110 initializeApplication ( initialized ) ;
109111 }
110112 } , [ ] ) ;
111113
112- const ref = React . useRef ( ) ;
114+ const ref = React . useRef < HTMLDivElement | null > ( null ) ;
113115
114116 useEffect ( ( ) => {
115117 if ( themeMode === 'dark' ) {
@@ -124,73 +126,77 @@ const Application = ({
124126 } ;
125127
126128 // Only render the dashboard component if we have an active Neo4j connection.
129+ const muiTheme = themeMode === 'dark' ? darkTheme : lightTheme ;
130+
127131 return (
128- < div
129- onContextMenu = { disableContextMenu }
130- ref = { ref }
131- className = { `n-bg-palette-neutral-bg-default n-h-screen n-w-screen n-flex n-flex-col n-overflow-hidden` }
132- >
133- { connected ? (
132+ < ThemeProvider theme = { muiTheme } >
133+ < div
134+ onContextMenu = { disableContextMenu }
135+ ref = { ref }
136+ className = { `n-bg-palette-neutral-bg-default n-h-screen n-w-screen n-flex n-flex-col n-overflow-hidden` }
137+ >
138+ { connected ? (
139+ < Suspense fallback = '' >
140+ < Dashboard
141+ onDownloadDashboardAsImage = { ( _ ) => downloadComponentAsImage ( ref ) }
142+ onAboutModalOpen = { onAboutModalOpen }
143+ resetApplication = { resetApplication }
144+ > </ Dashboard >
145+ </ Suspense >
146+ ) : (
147+ < NeoDashboardPlaceholder > </ NeoDashboardPlaceholder >
148+ ) }
149+ { /* TODO - move all models into a pop-ups (or modals) component. */ }
150+ < Suspense fallback = '' >
151+ < NeoAboutModal open = { aboutModalOpen } handleClose = { onAboutModalClose } getDebugState = { getDebugState } />
152+ </ Suspense >
153+ < NeoConnectionModal
154+ open = { connectionModalOpen }
155+ connected = { connected }
156+ dismissable = { ! standalone }
157+ connection = { connection }
158+ ssoSettings = { ssoSettings }
159+ standalone = { standaloneSettings . standalone }
160+ standaloneSettings = { standaloneSettings }
161+ createConnection = { createConnection }
162+ onSSOAttempt = { onSSOAttempt }
163+ setConnectionProperties = { setConnectionDetails }
164+ onConnectionModalClose = { onConnectionModalClose }
165+ setWelcomeScreenOpen = { setWelcomeScreenOpen }
166+ > </ NeoConnectionModal >
167+ < NeoWelcomeScreenModal
168+ welcomeScreenOpen = { welcomeScreenOpen }
169+ setWelcomeScreenOpen = { setWelcomeScreenOpen }
170+ hasCachedDashboard = { hasCachedDashboard }
171+ hasNeo4jDesktopConnection = { hasNeo4jDesktopConnection }
172+ onConnectionModalOpen = { onConnectionModalOpen }
173+ createConnectionFromDesktopIntegration = { createConnectionFromDesktopIntegration }
174+ onAboutModalOpen = { onAboutModalOpen }
175+ resetDashboard = { resetDashboard }
176+ > </ NeoWelcomeScreenModal >
177+ < Suspense fallback = '' >
178+ < NeoUpgradeOldDashboardModal
179+ open = { oldDashboard }
180+ text = { oldDashboard }
181+ loadDashboard = { loadDashboard }
182+ clearOldDashboard = { clearOldDashboard }
183+ />
184+ </ Suspense >
185+ < Suspense fallback = '' >
186+ < NeoLoadSharedDashboardModal
187+ shareDetails = { shareDetails }
188+ onResetShareDetails = { onResetShareDetails }
189+ onConfirmLoadSharedDashboard = { onConfirmLoadSharedDashboard }
190+ />
191+ </ Suspense >
192+ < Suspense fallback = '' >
193+ < NeoReportHelpModal open = { reportHelpModalOpen } handleClose = { onReportHelpModalClose } />
194+ </ Suspense >
134195 < Suspense fallback = '' >
135- < Dashboard
136- onDownloadDashboardAsImage = { ( _ ) => downloadComponentAsImage ( ref ) }
137- onAboutModalOpen = { onAboutModalOpen }
138- resetApplication = { resetApplication }
139- > </ Dashboard >
196+ < NeoNotificationModal > </ NeoNotificationModal >
140197 </ Suspense >
141- ) : (
142- < NeoDashboardPlaceholder > </ NeoDashboardPlaceholder >
143- ) }
144- { /* TODO - move all models into a pop-ups (or modals) component. */ }
145- < Suspense fallback = '' >
146- < NeoAboutModal open = { aboutModalOpen } handleClose = { onAboutModalClose } getDebugState = { getDebugState } />
147- </ Suspense >
148- < NeoConnectionModal
149- open = { connectionModalOpen }
150- connected = { connected }
151- dismissable = { ! standalone }
152- connection = { connection }
153- ssoSettings = { ssoSettings }
154- standalone = { standaloneSettings . standalone }
155- standaloneSettings = { standaloneSettings }
156- createConnection = { createConnection }
157- onSSOAttempt = { onSSOAttempt }
158- setConnectionProperties = { setConnectionDetails }
159- onConnectionModalClose = { onConnectionModalClose }
160- setWelcomeScreenOpen = { setWelcomeScreenOpen }
161- > </ NeoConnectionModal >
162- < NeoWelcomeScreenModal
163- welcomeScreenOpen = { welcomeScreenOpen }
164- setWelcomeScreenOpen = { setWelcomeScreenOpen }
165- hasCachedDashboard = { hasCachedDashboard }
166- hasNeo4jDesktopConnection = { hasNeo4jDesktopConnection }
167- onConnectionModalOpen = { onConnectionModalOpen }
168- createConnectionFromDesktopIntegration = { createConnectionFromDesktopIntegration }
169- onAboutModalOpen = { onAboutModalOpen }
170- resetDashboard = { resetDashboard }
171- > </ NeoWelcomeScreenModal >
172- < Suspense fallback = '' >
173- < NeoUpgradeOldDashboardModal
174- open = { oldDashboard }
175- text = { oldDashboard }
176- loadDashboard = { loadDashboard }
177- clearOldDashboard = { clearOldDashboard }
178- />
179- </ Suspense >
180- < Suspense fallback = '' >
181- < NeoLoadSharedDashboardModal
182- shareDetails = { shareDetails }
183- onResetShareDetails = { onResetShareDetails }
184- onConfirmLoadSharedDashboard = { onConfirmLoadSharedDashboard }
185- />
186- </ Suspense >
187- < Suspense fallback = '' >
188- < NeoReportHelpModal open = { reportHelpModalOpen } handleClose = { onReportHelpModalClose } />
189- </ Suspense >
190- < Suspense fallback = '' >
191- < NeoNotificationModal > </ NeoNotificationModal >
192- </ Suspense >
193- </ div >
198+ </ div >
199+ </ ThemeProvider >
194200 ) ;
195201} ;
196202
0 commit comments