闭社主体 forked from https://github.com/tootsuite/mastodon
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.

111 lines
5.7 KiB

  1. import React from 'react';
  2. import Column from '../ui/components/column';
  3. import ColumnLink from '../ui/components/column_link';
  4. import ColumnSubheading from '../ui/components/column_subheading';
  5. import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
  6. import { connect } from 'react-redux';
  7. import PropTypes from 'prop-types';
  8. import ImmutablePropTypes from 'react-immutable-proptypes';
  9. import ImmutablePureComponent from 'react-immutable-pure-component';
  10. const messages = defineMessages({
  11. heading: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
  12. home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
  13. notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
  14. public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
  15. navigation_subheading: { id: 'column_subheading.navigation', defaultMessage: 'Navigation' },
  16. settings_subheading: { id: 'column_subheading.settings', defaultMessage: 'Settings' },
  17. community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
  18. preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
  19. follow_requests: { id: 'navigation_bar.follow_requests', defaultMessage: 'Follow requests' },
  20. sign_out: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
  21. favourites: { id: 'navigation_bar.favourites', defaultMessage: 'Favourites' },
  22. blocks: { id: 'navigation_bar.blocks', defaultMessage: 'Blocked users' },
  23. mutes: { id: 'navigation_bar.mutes', defaultMessage: 'Muted users' },
  24. info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' },
  25. pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' },
  26. });
  27. const mapStateToProps = state => ({
  28. me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
  29. columns: state.getIn(['settings', 'columns']),
  30. });
  31. @connect(mapStateToProps)
  32. @injectIntl
  33. export default class GettingStarted extends ImmutablePureComponent {
  34. static propTypes = {
  35. intl: PropTypes.object.isRequired,
  36. me: ImmutablePropTypes.map.isRequired,
  37. columns: ImmutablePropTypes.list,
  38. multiColumn: PropTypes.bool,
  39. };
  40. render () {
  41. const { intl, me, columns, multiColumn } = this.props;
  42. let navItems = [];
  43. if (multiColumn) {
  44. if (!columns.find(item => item.get('id') === 'HOME')) {
  45. navItems.push(<ColumnLink key='0' icon='home' text={intl.formatMessage(messages.home_timeline)} to='/timelines/home' />);
  46. }
  47. if (!columns.find(item => item.get('id') === 'NOTIFICATIONS')) {
  48. navItems.push(<ColumnLink key='1' icon='bell' text={intl.formatMessage(messages.notifications)} to='/notifications' />);
  49. }
  50. if (!columns.find(item => item.get('id') === 'COMMUNITY')) {
  51. navItems.push(<ColumnLink key='2' icon='users' text={intl.formatMessage(messages.community_timeline)} to='/timelines/public/local' />);
  52. }
  53. if (!columns.find(item => item.get('id') === 'PUBLIC')) {
  54. navItems.push(<ColumnLink key='3' icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/timelines/public' />);
  55. }
  56. }
  57. navItems = navItems.concat([
  58. <ColumnLink key='4' icon='star' text={intl.formatMessage(messages.favourites)} to='/favourites' />,
  59. <ColumnLink key='5' icon='thumb-tack' text={intl.formatMessage(messages.pins)} to='/pinned' />,
  60. ]);
  61. if (me.get('locked')) {
  62. navItems.push(<ColumnLink key='6' icon='users' text={intl.formatMessage(messages.follow_requests)} to='/follow_requests' />);
  63. }
  64. navItems = navItems.concat([
  65. <ColumnLink key='7' icon='volume-off' text={intl.formatMessage(messages.mutes)} to='/mutes' />,
  66. <ColumnLink key='8' icon='ban' text={intl.formatMessage(messages.blocks)} to='/blocks' />,
  67. ]);
  68. return (
  69. <Column icon='asterisk' heading={intl.formatMessage(messages.heading)} hideHeadingOnMobile>
  70. <div className='getting-started__wrapper'>
  71. <ColumnSubheading text={intl.formatMessage(messages.navigation_subheading)} />
  72. {navItems}
  73. <ColumnSubheading text={intl.formatMessage(messages.settings_subheading)} />
  74. <ColumnLink icon='book' text={intl.formatMessage(messages.info)} href='/about/more' />
  75. <ColumnLink icon='cog' text={intl.formatMessage(messages.preferences)} href='/settings/preferences' />
  76. <ColumnLink icon='sign-out' text={intl.formatMessage(messages.sign_out)} href='/auth/sign_out' method='delete' />
  77. </div>
  78. <div className='getting-started__footer scrollable optionally-scrollable'>
  79. <div className='static-content getting-started'>
  80. <p>
  81. <a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/FAQ.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.faq' defaultMessage='FAQ' /></a> • <a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/User-guide.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.userguide' defaultMessage='User Guide' /></a> • <a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md' rel='noopener' target='_blank'><FormattedMessage id='getting_started.appsshort' defaultMessage='Apps' /></a>
  82. </p>
  83. <p>
  84. <FormattedMessage
  85. id='getting_started.open_source_notice'
  86. defaultMessage='Mastodon is open source software. You can contribute or report issues on GitHub at {github}.'
  87. values={{ github: <a href='https://github.com/tootsuite/mastodon' rel='noopener' target='_blank'>tootsuite/mastodon</a> }}
  88. />
  89. </p>
  90. </div>
  91. </div>
  92. </Column>
  93. );
  94. }
  95. }