How to use the @codesandbox/notifications/lib/state.NotificationStatus.ERROR function in @codesandbox/notifications

To help you get started, we’ve selected a few @codesandbox/notifications examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codesandbox / codesandbox-client / packages / app / src / app / overmind / effects / notificationToast.ts View on Github external
error(message: string) {
    notificationState.addNotification({
      message,
      status: NotificationStatus.ERROR,
    });
  },
  success(message: string) {
github codesandbox / codesandbox-client / packages / app / src / app / overmind / namespaces / server / actions.ts View on Github external
server.ports = newPorts;

      break;
    }
    case 'sandbox:error': {
      const { message: error, unrecoverable } = data;

      server.hasUnrecoverableError = unrecoverable;
      server.error = error;

      if (unrecoverable) {
        effects.notificationToast.add({
          title: `Container Error`,
          message: error,
          status: NotificationStatus.ERROR,
        });
        effects.executor.closeExecutor();
      } else {
        effects.notificationToast.add({
          title: `Container Warning`,
          message: error,
          status: NotificationStatus.WARNING,
        });
      }

      break;
    }
    case 'shell:exit':
      effects.codesandboxApi.exitShell(data);
      break;
    case 'shell:out':
github codesandbox / codesandbox-client / packages / app / src / app / overmind / effects / vscode / index.ts View on Github external
const getStatus = () => {
      switch (type) {
        case 'error':
          return NotificationStatus.ERROR;
        case 'warning':
          return NotificationStatus.WARNING;
        case 'success':
          return NotificationStatus.SUCCESS;
        default:
          return NotificationStatus.NOTICE;
      }
    };
github codesandbox / codesandbox-client / packages / app / src / app / overmind / namespaces / live / liveMessageOperators.ts View on Github external
({ state, effects }) => {
    if (!state.live.reconnecting) {
      effects.notificationToast.add({
        message: 'We lost connection with the live server, reconnecting...',
        status: NotificationStatus.ERROR,
      });
      state.live.reconnecting = true;
    }
  }
);