How to use the @codesandbox/notifications.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 / store / actions.js View on Github external
export function showUserSurveyIfNeeded({ state, controller, api }) {
  if (state.get('user.sendSurvey')) {
    // Let the server know that we've seen the survey
    api.post('/users/survey-seen', {});

    notificationState.addNotification({
      title: 'Help improve CodeSandbox',
      message:
        "We'd love to hear your thoughts, it's 7 questions and will only take 2 minutes.",
      status: NotificationStatus.NOTICE,
      sticky: true,
      actions: {
        primary: [
          {
            label: 'Open Survey',
            run: () => {
              controller.getSignal('modalOpened')({
                modal: 'userSurvey',
              });
            },
          },
        ],
      },
    });
  }
}
github nscozzaro / physics-is-beautiful / courses / static / courses / js / containers / StudioViews / EditorsViews / containers / LessonWorkSpace / Codesandbox / app / store / actions.js View on Github external
export function showUserSurveyIfNeeded ({ state, controller, api }) {
  if (state.get('user.sendSurvey')) {
    // Let the server know that we've seen the survey
    api.post('/users/survey-seen', {})

    notificationState.addNotification({
      title: 'Help improve CodeSandbox',
      message:
        "We'd love to hear your thoughts, it's 7 questions and will only take 2 minutes.",
      status: NotificationStatus.NOTICE,
      sticky: true,
      actions: {
        primary: [
          {
            label: 'Open Survey',
            run: () => {
              controller.getSignal('modalOpened')({
                modal: 'userSurvey'
              })
            }
          }
        ]
      }
    })
  }
}
github codesandbox / codesandbox-client / packages / app / src / app / overmind / internalActions.ts View on Github external
export const showUserSurveyIfNeeded: Action = ({ state, effects, actions }) => {
  if (state.user.sendSurvey) {
    // Let the server know that we've seen the survey
    effects.api.markSurveySeen();

    effects.notificationToast.add({
      title: 'Help improve CodeSandbox',
      message:
        "We'd love to hear your thoughts, it's 7 questions and will only take 2 minutes.",
      status: NotificationStatus.NOTICE,
      sticky: true,
      actions: {
        primary: [
          {
            label: 'Open Survey',
            run: () => {
              actions.modalOpened({
                modal: 'userSurvey',
              });
            },
          },
        ],
      },
    });
  }
};
github codesandbox / codesandbox-client / packages / app / src / app / store / modules / files / actions.js View on Github external
return true;
      }

      return false;
    })
    .filter(Boolean);
  const numRecoveredFiles = recoveredList.length;

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

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

  return {};
}
github codesandbox / codesandbox-client / packages / common / src / utils / notifications.ts View on Github external
export function convertTypeToStatus(
  type: NotificationType
): NotificationStatus {
  switch (type) {
    case 'notice':
      return NotificationStatus.NOTICE;
    case 'warning':
      return NotificationStatus.WARNING;
    case 'error':
      return NotificationStatus.ERROR;
    case 'success':
      return NotificationStatus.SUCCESS;
    default:
      return NotificationStatus.NOTICE;
  }
}
github codesandbox / codesandbox-client / packages / app / src / app / store / modules / server / actions.js View on Github external
const getClosedMessage = () => {
    if (removedPorts.length === 1) {
      return `Port ${removedPorts[0].port} closed`;
    }

    return `The following ports closed: ${removedPorts
      .map(p => p.port)
      .join(', ')}`;
  };

  if (removedPorts.length > 0) {
    notificationState.addNotification({
      title: `Server Ports Closed`,
      message: getClosedMessage(),
      status: NotificationStatus.NOTICE,
    });
  }
}
github codesandbox / codesandbox-client / packages / app / src / app / pages / index.tsx View on Github external
if (process.env.NODE_ENV === 'production') {
            routeDebugger(
              `Sending '${location.pathname + location.search}' to analytics.`
            );
            if (!DNT) {
              trackPageview();
            }
          }
          return null;
        }}
      />
      
      
        <content>
          </content>