accountPreferences.tsx 2.4 KB

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