project-notifications-setting.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { useTranslation } from 'react-i18next'
  2. import RadioButtonSetting, { RadioOption } from '../radio-button-setting'
  3. import {
  4. NotificationLevel,
  5. useProjectNotificationPreferences,
  6. } from '../../../ide-redesign/hooks/use-project-notification-preferences'
  7. export default function ProjectNotificationsSetting() {
  8. const { t } = useTranslation()
  9. const { notificationLevel, setNotificationLevel, isLoading } =
  10. useProjectNotificationPreferences()
  11. const options: Array<RadioOption<NotificationLevel>> = [
  12. {
  13. value: 'all',
  14. label: t('all_project_activity'),
  15. description: t('all_project_activity_description'),
  16. },
  17. {
  18. value: 'replies',
  19. label: t('replies_to_your_activity_only'),
  20. description: t('replies_to_your_activity_only_description'),
  21. },
  22. {
  23. value: 'off',
  24. label: t('off'),
  25. description: t('no_project_notifications_description'),
  26. },
  27. ]
  28. return (
  29. <>
  30. <RadioButtonSetting
  31. id="projectNotifications"
  32. options={options}
  33. value={isLoading ? undefined : notificationLevel}
  34. onChange={setNotificationLevel}
  35. />
  36. <div className="project-notifications-beta-note">
  37. <span className="beta-note-text">
  38. {t('email_notifications_are_currently_in_beta')}{' '}
  39. {t('these_settings_might_change_in_the_future')}{' '}
  40. </span>
  41. {/* TODO: update forms link */}
  42. <a target="_blank" rel="noopener noreferrer" href="https://forms.gle/">
  43. {t('give_feedback')}
  44. </a>
  45. </div>
  46. </>
  47. )
  48. }