@@ -71,6 +71,7 @@ pub struct Layers {
7171pub struct EditorState {
7272 pub hierarchy_depth : usize ,
7373 pub dark_mode : bool ,
74+ pub fatal_error : Option < SharedString > ,
7475 pub solved_cell : Entity < Option < CompileOutputState > > ,
7576 pub hide_external_geometry : bool ,
7677 pub layers : Entity < Layers > ,
@@ -236,11 +237,13 @@ impl EditorState {
236237 {
237238 self . lang_server_client
238239 . show_message ( MessageType :: ERROR , "Open cell is invalid" ) ;
240+ self . fatal_error = Some ( SharedString :: from ( "open cell is invalid" ) ) ;
239241 return ;
240242 }
241243 d
242244 }
243245 _ => {
246+ self . fatal_error = Some ( SharedString :: from ( "static compile errors encountered" ) ) ;
244247 return ;
245248 }
246249 } ;
@@ -307,6 +310,7 @@ impl EditorState {
307310 } ) ;
308311 cx. notify ( ) ;
309312 } ) ;
313+ self . fatal_error = None ;
310314 }
311315}
312316
@@ -327,6 +331,7 @@ impl Editor {
327331 EditorState {
328332 hierarchy_depth : usize:: MAX ,
329333 dark_mode : true ,
334+ fatal_error : None ,
330335 solved_cell,
331336 hide_external_geometry : false ,
332337 tool,
@@ -472,7 +477,45 @@ impl Render for Editor {
472477 . flex_1 ( )
473478 . min_h_0 ( )
474479 . child ( self . hierarchy_sidebar . clone ( ) )
475- . child ( div ( ) . flex_1 ( ) . overflow_hidden ( ) . child ( self . canvas . clone ( ) ) )
480+ . child ( {
481+ let mut d = div ( )
482+ . flex_1 ( )
483+ . relative ( )
484+ . overflow_hidden ( )
485+ . child ( self . canvas . clone ( ) ) ;
486+
487+ if let Some ( fatal_error) = & self . state . read ( cx) . fatal_error {
488+ d = d. child (
489+ div ( )
490+ . id ( "error_modal" )
491+ . bg ( theme. bg )
492+ . border_1 ( )
493+ . border_color ( theme. divider )
494+ . rounded_sm ( )
495+ . absolute ( )
496+ . p_2 ( )
497+ . child (
498+ div ( ) . flex ( ) . flex_row ( ) . text_color ( theme. error ) . child (
499+ div ( ) . flex ( ) . flex_col ( ) . child ( div ( ) . flex_1 ( ) ) . child (
500+ svg ( )
501+ . path ( "icons/circle-exclamation-solid-full.svg" )
502+ . w ( px ( 20. ) )
503+ . h_auto ( )
504+ . mr_1 ( )
505+ . text_color ( theme. error ) ) . child ( div ( ) . flex_1 ( ) )
506+ )
507+ . child ( div ( ) . child ( "Error" ) )
508+ )
509+ . child ( format ! ( "Editing disabled due to error: {fatal_error}." ) )
510+ . whitespace_normal ( )
511+ . top_2 ( )
512+ . left_2 ( )
513+ . right_2 ( )
514+ ) ;
515+ }
516+
517+ d
518+ } )
476519 . child ( self . layer_sidebar . clone ( ) ) ,
477520 )
478521 . child ( self . text_input . clone ( ) )
0 commit comments