@@ -6,6 +6,9 @@ import type { MainMenu as MainMenuType } from '@atyrode/excalidraw';
6
6
import { LogOut , SquarePlus , LayoutDashboard , User , Text , Settings , Terminal , FileText , FlaskConical } from 'lucide-react' ;
7
7
import md5 from 'crypto-js/md5' ;
8
8
9
+ // Components
10
+ import SettingsDialog from './SettingsDialog' ; // Added import
11
+
9
12
import { useLogout } from '../hooks/useLogout' ;
10
13
import { useAuthStatus } from '../hooks/useAuthStatus' ;
11
14
@@ -25,19 +28,15 @@ const getGravatarUrl = (email: string, size = 32) => {
25
28
interface MainMenuConfigProps {
26
29
MainMenu : typeof MainMenuType ;
27
30
excalidrawAPI : ExcalidrawImperativeAPI | null ;
28
- showPadsModal : boolean ;
29
- setShowPadsModal : ( show : boolean ) => void ;
30
- showSettingsModal ?: boolean ;
31
- setShowSettingsModal ?: ( show : boolean ) => void ;
32
31
}
33
32
34
33
export const MainMenuConfig : React . FC < MainMenuConfigProps > = ( {
35
34
MainMenu,
36
35
excalidrawAPI,
37
- setShowPadsModal,
38
- setShowSettingsModal = ( show : boolean ) => { } ,
39
36
} ) => {
40
37
const [ showAccountModal , setShowAccountModal ] = useState ( false ) ;
38
+ const [ showSettingsModal , setShowSettingsModal ] = useState ( false ) ;
39
+
41
40
const { mutate : logoutMutation , isPending : isLoggingOut } = useLogout ( ) ;
42
41
const { user, isLoading, isError } = useAuthStatus ( ) ;
43
42
@@ -132,13 +131,13 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
132
131
} ) ;
133
132
} ;
134
133
135
- const handleManagePadsClick = ( ) => {
136
- setShowPadsModal ( true ) ;
137
- } ;
138
-
139
134
const handleSettingsClick = ( ) => {
140
135
setShowSettingsModal ( true ) ;
141
136
} ;
137
+
138
+ const handleCloseSettingsModal = ( ) => { // Added handler to close settings modal
139
+ setShowSettingsModal ( false ) ;
140
+ } ;
142
141
143
142
const handleAccountClick = ( ) => {
144
143
setShowAccountModal ( true ) ;
@@ -205,6 +204,12 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
205
204
onClose = { ( ) => setShowAccountModal ( false ) }
206
205
/>
207
206
) }
207
+ { showSettingsModal && ( // Added conditional rendering for SettingsDialog
208
+ < SettingsDialog
209
+ excalidrawAPI = { excalidrawAPI }
210
+ onClose = { handleCloseSettingsModal }
211
+ />
212
+ ) }
208
213
< MainMenu >
209
214
< div className = "main-menu__top-row" >
210
215
< span className = "main-menu__label" style = { { gap : 0.2 } } >
@@ -227,12 +232,6 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
227
232
< MainMenu . DefaultItems . LoadScene />
228
233
< MainMenu . DefaultItems . Export />
229
234
< MainMenu . DefaultItems . SaveAsImage />
230
- < MainMenu . Item
231
- icon = { < FileText /> }
232
- onClick = { handleManagePadsClick }
233
- >
234
- Manage pads...
235
- </ MainMenu . Item >
236
235
< MainMenu . DefaultItems . ClearCanvas />
237
236
</ MainMenu . Group >
238
237
0 commit comments