accountPreferences.tsx 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import {JsonFormObject} from 'sentry/components/forms/types';
  2. import languages from 'sentry/data/languages';
  3. import {timezoneOptions} from 'sentry/data/timezones';
  4. import {t} from 'sentry/locale';
  5. import {Organization} from 'sentry/types';
  6. // Export route to make these forms searchable by label/help
  7. export const route = '/settings/account/details/';
  8. // Called before sending API request, these fields need to be sent as an
  9. // `options` object
  10. const transformOptions = (data: object) => ({options: data});
  11. const formGroups: JsonFormObject[] = [
  12. {
  13. // Form "section"/"panel"
  14. title: 'Preferences',
  15. fields: [
  16. {
  17. name: 'theme',
  18. type: 'select',
  19. label: t('Theme'),
  20. help: t(
  21. "Select your theme preference. It can be synced to your system's theme, always light mode, or always dark mode."
  22. ),
  23. options: [
  24. {value: 'light', label: t('Light')},
  25. {value: 'dark', label: t('Dark')},
  26. {value: 'system', label: t('Default to system')},
  27. ],
  28. getData: transformOptions,
  29. },
  30. {
  31. name: 'language',
  32. type: 'select',
  33. label: t('Language'),
  34. options: languages.map(([value, label]) => ({value, label})),
  35. getData: transformOptions,
  36. },
  37. {
  38. name: 'timezone',
  39. type: 'select',
  40. label: t('Timezone'),
  41. options: timezoneOptions,
  42. getData: transformOptions,
  43. },
  44. {
  45. name: 'clock24Hours',
  46. type: 'boolean',
  47. label: t('Use a 24-hour clock'),
  48. getData: transformOptions,
  49. },
  50. {
  51. name: 'stacktraceOrder',
  52. type: 'select',
  53. required: false,
  54. options: [
  55. {value: -1, label: t('Default')},
  56. {value: 1, label: t('Oldest')},
  57. {value: 2, label: t('Newest')},
  58. ],
  59. label: t('Stack Trace Order'),
  60. help: t('Choose the default ordering of frames in stack traces'),
  61. getData: transformOptions,
  62. },
  63. {
  64. name: 'defaultIssueEvent',
  65. type: 'select',
  66. required: false,
  67. options: [
  68. {value: 'recommended', label: t('Recommended')},
  69. {value: 'latest', label: t('Latest')},
  70. {value: 'oldest', label: t('Oldest')},
  71. ],
  72. label: t('Default Issue Event'),
  73. help: t('Choose what event gets displayed by default'),
  74. visible: ({organization}: {organization: Organization}) => {
  75. return organization?.features.includes('issue-details-most-helpful-event-ui');
  76. },
  77. getData: transformOptions,
  78. },
  79. ],
  80. },
  81. ];
  82. export default formGroups;