闭社主体 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.

109 lines
5.5 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. });
  26. const mapStateToProps = state => ({
  27. me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
  28. columns: state.getIn(['settings', 'columns']),
  29. });
  30. @connect(mapStateToProps)
  31. @injectIntl
  32. export default class GettingStarted extends ImmutablePureComponent {
  33. static propTypes = {
  34. intl: PropTypes.object.isRequired,
  35. me: ImmutablePropTypes.map.isRequired,
  36. columns: ImmutablePropTypes.list,
  37. multiColumn: PropTypes.bool,
  38. };
  39. render () {
  40. const { intl, me, columns, multiColumn } = this.props;
  41. let navItems = [];
  42. if (multiColumn) {
  43. if (!columns.find(item => item.get('id') === 'HOME')) {
  44. navItems.push(<ColumnLink key='0' icon='home' text={intl.formatMessage(messages.home_timeline)} to='/timelines/home' />);
  45. }
  46. if (!columns.find(item => item.get('id') === 'NOTIFICATIONS')) {
  47. navItems.push(<ColumnLink key='1' icon='bell' text={intl.formatMessage(messages.notifications)} to='/notifications' />);
  48. }
  49. if (!columns.find(item => item.get('id') === 'COMMUNITY')) {
  50. navItems.push(<ColumnLink key='2' icon='users' text={intl.formatMessage(messages.community_timeline)} to='/timelines/public/local' />);
  51. }
  52. if (!columns.find(item => item.get('id') === 'PUBLIC')) {
  53. navItems.push(<ColumnLink key='3' icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/timelines/public' />);
  54. }
  55. }
  56. navItems = navItems.concat([
  57. <ColumnLink key='4' icon='star' text={intl.formatMessage(messages.favourites)} to='/favourites' />,
  58. ]);
  59. if (me.get('locked')) {
  60. navItems.push(<ColumnLink key='5' icon='users' text={intl.formatMessage(messages.follow_requests)} to='/follow_requests' />);
  61. }
  62. navItems = navItems.concat([
  63. <ColumnLink key='6' icon='volume-off' text={intl.formatMessage(messages.mutes)} to='/mutes' />,
  64. <ColumnLink key='7' icon='ban' text={intl.formatMessage(messages.blocks)} to='/blocks' />,
  65. ]);
  66. return (
  67. <Column icon='asterisk' heading={intl.formatMessage(messages.heading)} hideHeadingOnMobile>
  68. <div className='getting-started__wrapper'>
  69. <ColumnSubheading text={intl.formatMessage(messages.navigation_subheading)} />
  70. {navItems}
  71. <ColumnSubheading text={intl.formatMessage(messages.settings_subheading)} />
  72. <ColumnLink icon='book' text={intl.formatMessage(messages.info)} href='/about/more' />
  73. <ColumnLink icon='cog' text={intl.formatMessage(messages.preferences)} href='/settings/preferences' />
  74. <ColumnLink icon='sign-out' text={intl.formatMessage(messages.sign_out)} href='/auth/sign_out' method='delete' />
  75. </div>
  76. <div className='getting-started__footer scrollable optionally-scrollable'>
  77. <div className='static-content getting-started'>
  78. <p>
  79. <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>
  80. </p>
  81. <p>
  82. <FormattedMessage
  83. id='getting_started.open_source_notice'
  84. defaultMessage='Mastodon is open source software. You can contribute or report issues on GitHub at {github}.'
  85. values={{ github: <a href='https://github.com/tootsuite/mastodon' rel='noopener' target='_blank'>tootsuite/mastodon</a> }}
  86. />
  87. </p>
  88. </div>
  89. </div>
  90. </Column>
  91. );
  92. }
  93. }