How to use the @codesandbox/notifications/lib/state.NotificationStatus.NOTICE 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 / vscode / index.ts View on Github external
run: () => {
        if (document.fullscreenElement) {
          document.exitFullscreen();
        } else {
          document.documentElement.requestFullscreen();

          this.addNotification({
            title: 'Fullscreen',
            message:
              'You are now in fullscreen mode. Press and hold ESC to exit',
            status: NotificationStatus.NOTICE,
            timeAlive: 5000,
          });

          if ('keyboard' in navigator) {
            // @ts-ignore - keyboard locking is experimental api
            navigator.keyboard.lock([
              'Escape',
              'KeyW',
              'KeyN',
              'KeyT',
              'ArrowLeft',
              'ArrowRight',
            ]);
          }
        }
      },
github codesandbox / codesandbox-client / packages / app / src / app / overmind / namespaces / live / liveMessageOperators.ts View on Github external
// TODO: What happening here? Is it not an array of users?
  // Check the running code and fix the type
  state.live.roomInfo.users = users as any;
  state.live.roomInfo.editorIds = data.editor_ids;
  state.live.roomInfo.ownerIds = data.owner_ids;

  if (data.joined_user_id === state.live.liveUserId) {
    return;
  }

  const user = data.users.find(u => u.id === data.joined_user_id);

  if (!state.live.notificationsHidden) {
    effects.notificationToast.add({
      message: `${user.username} joined the live session.`,
      status: NotificationStatus.NOTICE,
    });
  }
});
github codesandbox / codesandbox-client / packages / app / src / app / overmind / effects / notificationToast.ts View on Github external
notice(message: string) {
    notificationState.addNotification({
      message,
      status: NotificationStatus.NOTICE,
    });
  },
};
github codesandbox / codesandbox-client / packages / app / src / app / overmind / namespaces / server / actions.ts View on Github external
);
      const addedPorts = newPorts.filter(
        port => !currentPorts.find(p => p.port === port.port)
      );
      const openedPorts = [];

      if (removedPorts.length > 0) {
        effects.notificationToast.add({
          title: `Server Ports Closed`,
          message:
            removedPorts.length === 1
              ? `Port ${removedPorts[0].port} closed`
              : `The following ports closed: ${removedPorts
                  .map(p => p.port)
                  .join(', ')}`,
          status: NotificationStatus.NOTICE,
        });
      }

      editor.devToolTabs.forEach(view => {
        view.views.forEach(tab => {
          if (
            tab.id === 'codesandbox.browser' &&
            tab.options &&
            tab.options.port
          ) {
            openedPorts.push(tab.options.port);
          }
        });
      });

      addedPorts.forEach(port => {
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 / files / internalActions.ts View on Github external
return false;
    })
    .filter(Boolean);
  const numRecoveredFiles = recoveredList.length;

  if (numRecoveredFiles > 0) {
    effects.analytics.track('Files Recovered', {
      fileCount: numRecoveredFiles,
    });

    effects.notificationToast.add({
      message: `We recovered ${numRecoveredFiles} unsaved ${
        numRecoveredFiles > 1 ? 'files' : 'file'
      } from a previous session`,
      status: NotificationStatus.NOTICE,
    });
  }
};