accountPreferences.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import {JsonFormObject} from 'sentry/components/forms/types';
  2. import languages from 'sentry/data/languages';
  3. import timezones 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: timezones.map(([value, label]) => ({value, label})),
  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 (let Sentry decide)')},
  55. {value: 1, label: t('Most recent call last')},
  56. {value: 2, label: t('Most recent call first')},
  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. },
  64. ];
  65. export default formGroups;