You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.8 KiB

  1. // Package imports
  2. import React from 'react';
  3. import PropTypes from 'prop-types';
  4. import { injectIntl, defineMessages } from 'react-intl';
  5. // Our imports
  6. import LocalSettingsNavigationItem from './item';
  7. import { preferencesLink } from 'flavours/glitch/util/backend_links';
  8. // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  9. const messages = defineMessages({
  10. general: { id: 'settings.general', defaultMessage: 'General' },
  11. compose: { id: 'settings.compose_box_opts', defaultMessage: 'Compose box options' },
  12. content_warnings: { id: 'settings.content_warnings', defaultMessage: 'Content Warnings' },
  13. collapsed: { id: 'settings.collapsed_statuses', defaultMessage: 'Collapsed toots' },
  14. media: { id: 'settings.media', defaultMessage: 'Media' },
  15. preferences: { id: 'settings.preferences', defaultMessage: 'Preferences' },
  16. close: { id: 'settings.close', defaultMessage: 'Close' },
  17. });
  18. @injectIntl
  19. export default class LocalSettingsNavigation extends React.PureComponent {
  20. static propTypes = {
  21. index : PropTypes.number,
  22. intl : PropTypes.object.isRequired,
  23. onClose : PropTypes.func.isRequired,
  24. onNavigate : PropTypes.func.isRequired,
  25. };
  26. render () {
  27. const { index, intl, onClose, onNavigate } = this.props;
  28. return (
  29. <nav className='glitch local-settings__navigation'>
  30. <LocalSettingsNavigationItem
  31. active={index === 0}
  32. index={0}
  33. onNavigate={onNavigate}
  34. icon='cogs'
  35. title={intl.formatMessage(messages.general)}
  36. />
  37. <LocalSettingsNavigationItem
  38. active={index === 1}
  39. index={1}
  40. onNavigate={onNavigate}
  41. icon='pencil'
  42. title={intl.formatMessage(messages.compose)}
  43. />
  44. <LocalSettingsNavigationItem
  45. active={index === 2}
  46. index={2}
  47. onNavigate={onNavigate}
  48. textIcon='CW'
  49. title={intl.formatMessage(messages.content_warnings)}
  50. />
  51. <LocalSettingsNavigationItem
  52. active={index === 3}
  53. index={3}
  54. onNavigate={onNavigate}
  55. icon='angle-double-up'
  56. title={intl.formatMessage(messages.collapsed)}
  57. />
  58. <LocalSettingsNavigationItem
  59. active={index === 4}
  60. index={4}
  61. onNavigate={onNavigate}
  62. icon='image'
  63. title={intl.formatMessage(messages.media)}
  64. />
  65. <LocalSettingsNavigationItem
  66. active={index === 5}
  67. href={ preferencesLink }
  68. index={5}
  69. icon='sliders'
  70. title={intl.formatMessage(messages.preferences)}
  71. />
  72. <LocalSettingsNavigationItem
  73. active={index === 6}
  74. className='close'
  75. index={6}
  76. onNavigate={onClose}
  77. icon='times'
  78. title={intl.formatMessage(messages.close)}
  79. />
  80. </nav>
  81. );
  82. }
  83. }