@@ -4,6 +4,7 @@ import { readSpaceConfig, saveSpaceConfig } from '@/lib/api/spaces';
44import { refreshRegistry } from '@/lib/api/registry' ;
55import Editor , { type Monaco } from '@monaco-editor/react' ;
66import type { editor } from 'monaco-editor' ;
7+ import { useToast , ToastContainer } from '@mcpmux/ui' ;
78import USER_SPACE_CONFIG_SCHEMA from '../../../../schemas/user-space.schema.json' ;
89
910interface ConfigEditorModalProps {
@@ -23,6 +24,7 @@ export function ConfigEditorModal({ spaceId, spaceName, onClose, onSaved }: Conf
2324 const [ editorReady , setEditorReady ] = useState ( false ) ;
2425 const editorRef = useRef < editor . IStandaloneCodeEditor | null > ( null ) ;
2526 const monacoRef = useRef < Monaco | null > ( null ) ;
27+ const { toasts, success, error : showError } = useToast ( ) ;
2628
2729 // Delay editor mount to avoid glitch during modal open
2830 useEffect ( ( ) => {
@@ -61,6 +63,7 @@ export function ConfigEditorModal({ spaceId, spaceName, onClose, onSaved }: Conf
6163 } catch ( e ) {
6264 setIsValidJson ( false ) ;
6365 setError ( `Invalid JSON: ${ ( e as Error ) . message } ` ) ;
66+ showError ( 'Invalid JSON' , ( e as Error ) . message ) ;
6467 return ;
6568 }
6669
@@ -69,10 +72,14 @@ export function ConfigEditorModal({ spaceId, spaceName, onClose, onSaved }: Conf
6972 await saveSpaceConfig ( spaceId , content ) ;
7073 // Refresh server discovery to pick up new/changed servers
7174 await refreshRegistry ( ) ;
75+
76+ success ( 'Configuration saved' , 'Space configuration updated successfully' ) ;
7277 onSaved ( ) ;
7378 onClose ( ) ;
7479 } catch ( e ) {
75- setError ( String ( e ) ) ;
80+ const errorMsg = e instanceof Error ? e . message : String ( e ) ;
81+ setError ( errorMsg ) ;
82+ showError ( 'Failed to save configuration' , errorMsg ) ;
7683 } finally {
7784 setIsSaving ( false ) ;
7885 }
@@ -150,7 +157,9 @@ export function ConfigEditorModal({ spaceId, spaceName, onClose, onSaved }: Conf
150157 } , [ handleFormat , onClose ] ) ;
151158
152159 return (
153- < div className = "fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4" >
160+ < >
161+ < ToastContainer toasts = { toasts } onClose = { ( id ) => toasts . find ( t => t . id === id ) ?. onClose ( id ) } />
162+ < div className = "fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4" >
154163 < div className = "bg-[rgb(var(--surface))] w-full max-w-4xl h-[80vh] rounded-xl shadow-2xl flex flex-col border border-[rgb(var(--border))]" >
155164 { /* Header */ }
156165 < div className = "flex items-center justify-between p-4 border-b border-[rgb(var(--border))]" >
@@ -256,5 +265,6 @@ export function ConfigEditorModal({ spaceId, spaceName, onClose, onSaved }: Conf
256265 ) }
257266 </ div >
258267 </ div >
268+ </ >
259269 ) ;
260270}
0 commit comments