@@ -10,7 +10,10 @@ import {
1010 Settings ,
1111} from '@codesandbox/common/lib/types' ;
1212import { notificationState } from '@codesandbox/common/lib/utils/notifications' ;
13- import { NotificationMessage } from '@codesandbox/notifications/lib/state' ;
13+ import {
14+ NotificationMessage ,
15+ NotificationStatus ,
16+ } from '@codesandbox/notifications/lib/state' ;
1417import { Reaction } from 'app/overmind' ;
1518import prettify from 'app/src/app/utils/prettify' ;
1619import { blocker } from 'app/utils/blocker' ;
@@ -845,8 +848,30 @@ export class VSCodeEffect {
845848 } ;
846849
847850 // This is used by the CodesandboxService internally
848- private addNotification ( notification : NotificationMessage ) {
849- notificationState . addNotification ( notification ) ;
851+ private addNotification (
852+ message : string ,
853+ type : 'error' | 'info' | 'warning' | 'success' ,
854+ options : { actions : NotificationMessage [ 'actions' ] ; sticky ?: boolean }
855+ ) {
856+ const getStatus = ( ) => {
857+ switch ( type ) {
858+ case 'error' :
859+ return NotificationStatus . ERROR ;
860+ case 'warning' :
861+ return NotificationStatus . WARNING ;
862+ case 'success' :
863+ return NotificationStatus . SUCCESS ;
864+ default :
865+ return NotificationStatus . NOTICE ;
866+ }
867+ } ;
868+
869+ notificationState . addNotification ( {
870+ message,
871+ status : getStatus ( ) ,
872+ sticky : options . sticky ,
873+ actions : options . actions ,
874+ } ) ;
850875 }
851876}
852877
0 commit comments