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.

326 lines
12 KiB

Repair most egregious mistakes in onboarding modal (#1964) * Repair most egregious mistakes The deployed changes broke the pedagogy and curriculum built into the design of the onboarding modals, which had been reviewed and approved by various other contributors. While the changed layouts of the pages make some of the original decisions impossible to re-implement without substantial work, these changes should at least make the modals not outright terrible. The empty confusing description of Mastodon was replaced with an actual basic explanation of federation. The language was modified to be friendly and conversational again. Grammatical errors were fixed. The explanations of local and federated timelines were re-ordered to be in the direct that the menus go, top to bottom, and the sentence was re-added which explains that they are what "public timelines" refers to (since this phrasing is used elsewhere in the UI) and suggests the user use them to discover who to follow. A figure of the profile picture that lives above the compose box was padded to page two to serve as a landmark for less technically literate users to easily find the compose box and understand that the next page is moving upwards, so that they can find the search bar. Ideally, the elephant artwork should be either removed or replaced with something less depressing. Room should be made to point users at the notifications column's settings icon because "how do I turn off the notification noise" is one of the most asked questions of new users and those icons are not easily noticeable. This last part may be made obsolete if the settings UI is later re-worked. * Change copy This commit addresses copy change suggestions made in the PR discussion * Add periods to ends of sentences missing periods * Made "Home" "Federated" "Local" and "Notifications" lowercase * Separate explanation of "connecting" and the word "instance" into two sentences, to make the sentence less dense.
7 years ago
Repair most egregious mistakes in onboarding modal (#1964) * Repair most egregious mistakes The deployed changes broke the pedagogy and curriculum built into the design of the onboarding modals, which had been reviewed and approved by various other contributors. While the changed layouts of the pages make some of the original decisions impossible to re-implement without substantial work, these changes should at least make the modals not outright terrible. The empty confusing description of Mastodon was replaced with an actual basic explanation of federation. The language was modified to be friendly and conversational again. Grammatical errors were fixed. The explanations of local and federated timelines were re-ordered to be in the direct that the menus go, top to bottom, and the sentence was re-added which explains that they are what "public timelines" refers to (since this phrasing is used elsewhere in the UI) and suggests the user use them to discover who to follow. A figure of the profile picture that lives above the compose box was padded to page two to serve as a landmark for less technically literate users to easily find the compose box and understand that the next page is moving upwards, so that they can find the search bar. Ideally, the elephant artwork should be either removed or replaced with something less depressing. Room should be made to point users at the notifications column's settings icon because "how do I turn off the notification noise" is one of the most asked questions of new users and those icons are not easily noticeable. This last part may be made obsolete if the settings UI is later re-worked. * Change copy This commit addresses copy change suggestions made in the PR discussion * Add periods to ends of sentences missing periods * Made "Home" "Federated" "Local" and "Notifications" lowercase * Separate explanation of "connecting" and the word "instance" into two sentences, to make the sentence less dense.
7 years ago
Repair most egregious mistakes in onboarding modal (#1964) * Repair most egregious mistakes The deployed changes broke the pedagogy and curriculum built into the design of the onboarding modals, which had been reviewed and approved by various other contributors. While the changed layouts of the pages make some of the original decisions impossible to re-implement without substantial work, these changes should at least make the modals not outright terrible. The empty confusing description of Mastodon was replaced with an actual basic explanation of federation. The language was modified to be friendly and conversational again. Grammatical errors were fixed. The explanations of local and federated timelines were re-ordered to be in the direct that the menus go, top to bottom, and the sentence was re-added which explains that they are what "public timelines" refers to (since this phrasing is used elsewhere in the UI) and suggests the user use them to discover who to follow. A figure of the profile picture that lives above the compose box was padded to page two to serve as a landmark for less technically literate users to easily find the compose box and understand that the next page is moving upwards, so that they can find the search bar. Ideally, the elephant artwork should be either removed or replaced with something less depressing. Room should be made to point users at the notifications column's settings icon because "how do I turn off the notification noise" is one of the most asked questions of new users and those icons are not easily noticeable. This last part may be made obsolete if the settings UI is later re-worked. * Change copy This commit addresses copy change suggestions made in the PR discussion * Add periods to ends of sentences missing periods * Made "Home" "Federated" "Local" and "Notifications" lowercase * Separate explanation of "connecting" and the word "instance" into two sentences, to make the sentence less dense.
7 years ago
Repair most egregious mistakes in onboarding modal (#1964) * Repair most egregious mistakes The deployed changes broke the pedagogy and curriculum built into the design of the onboarding modals, which had been reviewed and approved by various other contributors. While the changed layouts of the pages make some of the original decisions impossible to re-implement without substantial work, these changes should at least make the modals not outright terrible. The empty confusing description of Mastodon was replaced with an actual basic explanation of federation. The language was modified to be friendly and conversational again. Grammatical errors were fixed. The explanations of local and federated timelines were re-ordered to be in the direct that the menus go, top to bottom, and the sentence was re-added which explains that they are what "public timelines" refers to (since this phrasing is used elsewhere in the UI) and suggests the user use them to discover who to follow. A figure of the profile picture that lives above the compose box was padded to page two to serve as a landmark for less technically literate users to easily find the compose box and understand that the next page is moving upwards, so that they can find the search bar. Ideally, the elephant artwork should be either removed or replaced with something less depressing. Room should be made to point users at the notifications column's settings icon because "how do I turn off the notification noise" is one of the most asked questions of new users and those icons are not easily noticeable. This last part may be made obsolete if the settings UI is later re-worked. * Change copy This commit addresses copy change suggestions made in the PR discussion * Add periods to ends of sentences missing periods * Made "Home" "Federated" "Local" and "Notifications" lowercase * Separate explanation of "connecting" and the word "instance" into two sentences, to make the sentence less dense.
7 years ago
Repair most egregious mistakes in onboarding modal (#1964) * Repair most egregious mistakes The deployed changes broke the pedagogy and curriculum built into the design of the onboarding modals, which had been reviewed and approved by various other contributors. While the changed layouts of the pages make some of the original decisions impossible to re-implement without substantial work, these changes should at least make the modals not outright terrible. The empty confusing description of Mastodon was replaced with an actual basic explanation of federation. The language was modified to be friendly and conversational again. Grammatical errors were fixed. The explanations of local and federated timelines were re-ordered to be in the direct that the menus go, top to bottom, and the sentence was re-added which explains that they are what "public timelines" refers to (since this phrasing is used elsewhere in the UI) and suggests the user use them to discover who to follow. A figure of the profile picture that lives above the compose box was padded to page two to serve as a landmark for less technically literate users to easily find the compose box and understand that the next page is moving upwards, so that they can find the search bar. Ideally, the elephant artwork should be either removed or replaced with something less depressing. Room should be made to point users at the notifications column's settings icon because "how do I turn off the notification noise" is one of the most asked questions of new users and those icons are not easily noticeable. This last part may be made obsolete if the settings UI is later re-worked. * Change copy This commit addresses copy change suggestions made in the PR discussion * Add periods to ends of sentences missing periods * Made "Home" "Federated" "Local" and "Notifications" lowercase * Separate explanation of "connecting" and the word "instance" into two sentences, to make the sentence less dense.
7 years ago
Repair most egregious mistakes in onboarding modal (#1964) * Repair most egregious mistakes The deployed changes broke the pedagogy and curriculum built into the design of the onboarding modals, which had been reviewed and approved by various other contributors. While the changed layouts of the pages make some of the original decisions impossible to re-implement without substantial work, these changes should at least make the modals not outright terrible. The empty confusing description of Mastodon was replaced with an actual basic explanation of federation. The language was modified to be friendly and conversational again. Grammatical errors were fixed. The explanations of local and federated timelines were re-ordered to be in the direct that the menus go, top to bottom, and the sentence was re-added which explains that they are what "public timelines" refers to (since this phrasing is used elsewhere in the UI) and suggests the user use them to discover who to follow. A figure of the profile picture that lives above the compose box was padded to page two to serve as a landmark for less technically literate users to easily find the compose box and understand that the next page is moving upwards, so that they can find the search bar. Ideally, the elephant artwork should be either removed or replaced with something less depressing. Room should be made to point users at the notifications column's settings icon because "how do I turn off the notification noise" is one of the most asked questions of new users and those icons are not easily noticeable. This last part may be made obsolete if the settings UI is later re-worked. * Change copy This commit addresses copy change suggestions made in the PR discussion * Add periods to ends of sentences missing periods * Made "Home" "Federated" "Local" and "Notifications" lowercase * Separate explanation of "connecting" and the word "instance" into two sentences, to make the sentence less dense.
7 years ago
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import PropTypes from 'prop-types';
  4. import ImmutablePropTypes from 'react-immutable-proptypes';
  5. import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
  6. import classNames from 'classnames';
  7. import Permalink from '../../../components/permalink';
  8. import TransitionMotion from 'react-motion/lib/TransitionMotion';
  9. import spring from 'react-motion/lib/spring';
  10. import ComposeForm from '../../compose/components/compose_form';
  11. import Search from '../../compose/components/search';
  12. import NavigationBar from '../../compose/components/navigation_bar';
  13. import ColumnHeader from './column_header';
  14. import Immutable from 'immutable';
  15. const noop = () => { };
  16. const messages = defineMessages({
  17. home_title: { id: 'column.home', defaultMessage: 'Home' },
  18. notifications_title: { id: 'column.notifications', defaultMessage: 'Notifications' },
  19. local_title: { id: 'column.community', defaultMessage: 'Local timeline' },
  20. federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' },
  21. });
  22. const PageOne = ({ acct, domain }) => (
  23. <div className='onboarding-modal__page onboarding-modal__page-one'>
  24. <div style={{ flex: '0 0 auto' }}>
  25. <div className='onboarding-modal__page-one__elephant-friend' />
  26. </div>
  27. <div>
  28. <h1><FormattedMessage id='onboarding.page_one.welcome' defaultMessage='Welcome to Mastodon!' /></h1>
  29. <p><FormattedMessage id='onboarding.page_one.federation' defaultMessage='Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.' /></p>
  30. <p><FormattedMessage id='onboarding.page_one.handle' defaultMessage='You are on {domain}, so your full handle is {handle}' values={{ domain, handle: <strong>{acct}@{domain}</strong> }} /></p>
  31. </div>
  32. </div>
  33. );
  34. PageOne.propTypes = {
  35. acct: PropTypes.string.isRequired,
  36. domain: PropTypes.string.isRequired,
  37. };
  38. const PageTwo = ({ me }) => (
  39. <div className='onboarding-modal__page onboarding-modal__page-two'>
  40. <div className='figure non-interactive'>
  41. <div className='pseudo-drawer'>
  42. <NavigationBar account={me} />
  43. </div>
  44. <ComposeForm
  45. text='Awoo! #introductions'
  46. suggestions={Immutable.List()}
  47. mentionedDomains={[]}
  48. spoiler={false}
  49. onChange={noop}
  50. onSubmit={noop}
  51. onPaste={noop}
  52. onPickEmoji={noop}
  53. onChangeSpoilerText={noop}
  54. onClearSuggestions={noop}
  55. onFetchSuggestions={noop}
  56. onSuggestionSelected={noop}
  57. showSearch
  58. />
  59. </div>
  60. <p><FormattedMessage id='onboarding.page_two.compose' defaultMessage='Write posts from the compose column. You can upload images, change privacy settings, and add content warnings with the icons below.' /></p>
  61. </div>
  62. );
  63. PageTwo.propTypes = {
  64. me: ImmutablePropTypes.map.isRequired,
  65. };
  66. const PageThree = ({ me }) => (
  67. <div className='onboarding-modal__page onboarding-modal__page-three'>
  68. <div className='figure non-interactive'>
  69. <Search
  70. value=''
  71. onChange={noop}
  72. onSubmit={noop}
  73. onClear={noop}
  74. onShow={noop}
  75. />
  76. <div className='pseudo-drawer'>
  77. <NavigationBar account={me} />
  78. </div>
  79. </div>
  80. <p><FormattedMessage id='onboarding.page_three.search' defaultMessage='Use the search bar to find people and look at hashtags, such as {illustration} and {introductions}. To look for a person who is not on this instance, use their full handle.' values={{ illustration: <Permalink to='/timelines/tag/illustration' href='/tags/illustration'>#illustration</Permalink>, introductions: <Permalink to='/timelines/tag/introductions' href='/tags/introductions'>#introductions</Permalink> }} /></p>
  81. <p><FormattedMessage id='onboarding.page_three.profile' defaultMessage='Edit your profile to change your avatar, bio, and display name. There, you will also find other preferences.' /></p>
  82. </div>
  83. );
  84. PageThree.propTypes = {
  85. me: ImmutablePropTypes.map.isRequired,
  86. };
  87. const PageFour = ({ domain, intl }) => (
  88. <div className='onboarding-modal__page onboarding-modal__page-four'>
  89. <div className='onboarding-modal__page-four__columns'>
  90. <div className='row'>
  91. <div>
  92. <div className='figure non-interactive'><ColumnHeader icon='home' type={intl.formatMessage(messages.home_title)} /></div>
  93. <p><FormattedMessage id='onboarding.page_four.home' defaultMessage='The home timeline shows posts from people you follow.' /></p>
  94. </div>
  95. <div>
  96. <div className='figure non-interactive'><ColumnHeader icon='bell' type={intl.formatMessage(messages.notifications_title)} /></div>
  97. <p><FormattedMessage id='onboarding.page_four.notifications' defaultMessage='The notifications column shows when someone interacts with you.' /></p>
  98. </div>
  99. </div>
  100. <div className='row'>
  101. <div>
  102. <div className='figure non-interactive' style={{ marginBottom: 0 }}><ColumnHeader icon='users' type={intl.formatMessage(messages.local_title)} /></div>
  103. </div>
  104. <div>
  105. <div className='figure non-interactive' style={{ marginBottom: 0 }}><ColumnHeader icon='globe' type={intl.formatMessage(messages.federated_title)} /></div>
  106. </div>
  107. </div>
  108. <p><FormattedMessage id='onboarding.page_five.public_timelines' defaultMessage='The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.' values={{ domain }} /></p>
  109. </div>
  110. </div>
  111. );
  112. PageFour.propTypes = {
  113. domain: PropTypes.string.isRequired,
  114. intl: PropTypes.object.isRequired,
  115. };
  116. const PageSix = ({ admin, domain }) => {
  117. let adminSection = '';
  118. if (admin) {
  119. adminSection = (
  120. <p>
  121. <FormattedMessage id='onboarding.page_six.admin' defaultMessage="Your instance's admin is {admin}." values={{ admin: <Permalink href={admin.get('url')} to={`/accounts/${admin.get('id')}`}>@{admin.get('acct')}</Permalink> }} />
  122. <br />
  123. <FormattedMessage id='onboarding.page_six.read_guidelines' defaultMessage="Please read {domain}'s {guidelines}!" values={{ domain, guidelines: <a href='/about/more' target='_blank'><FormattedMessage id='onboarding.page_six.guidelines' defaultMessage='community guidelines' /></a> }} />
  124. </p>
  125. );
  126. }
  127. return (
  128. <div className='onboarding-modal__page onboarding-modal__page-six'>
  129. <h1><FormattedMessage id='onboarding.page_six.almost_done' defaultMessage='Almost done...' /></h1>
  130. {adminSection}
  131. <p><FormattedMessage id='onboarding.page_six.github' defaultMessage='Mastodon is free open-source software. You can report bugs, request features, or contribute to the code on {github}.' values={{ github: <a href='https://github.com/tootsuite/mastodon' target='_blank' rel='noopener'>GitHub</a> }} /></p>
  132. <p><FormattedMessage id='onboarding.page_six.apps_available' defaultMessage='There are {apps} available for iOS, Android and other platforms.' values={{ apps: <a href='https://github.com/tootsuite/documentation/blob/master/Using-Mastodon/Apps.md' target='_blank' rel='noopener'><FormattedMessage id='onboarding.page_six.various_app' defaultMessage='mobile apps' /></a> }} /></p>
  133. <p><em><FormattedMessage id='onboarding.page_six.appetoot' defaultMessage='Bon Appetoot!' /></em></p>
  134. </div>
  135. );
  136. };
  137. PageSix.propTypes = {
  138. admin: ImmutablePropTypes.map,
  139. domain: PropTypes.string.isRequired,
  140. };
  141. const mapStateToProps = state => ({
  142. me: state.getIn(['accounts', state.getIn(['meta', 'me'])]),
  143. admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]),
  144. domain: state.getIn(['meta', 'domain']),
  145. });
  146. class OnboardingModal extends React.PureComponent {
  147. static propTypes = {
  148. onClose: PropTypes.func.isRequired,
  149. intl: PropTypes.object.isRequired,
  150. me: ImmutablePropTypes.map.isRequired,
  151. domain: PropTypes.string.isRequired,
  152. admin: ImmutablePropTypes.map,
  153. };
  154. state = {
  155. currentIndex: 0,
  156. };
  157. componentWillMount() {
  158. const { me, admin, domain, intl } = this.props;
  159. this.pages = [
  160. <PageOne acct={me.get('acct')} domain={domain} />,
  161. <PageTwo me={me} />,
  162. <PageThree me={me} />,
  163. <PageFour domain={domain} intl={intl} />,
  164. <PageSix admin={admin} domain={domain} />,
  165. ];
  166. };
  167. componentDidMount() {
  168. window.addEventListener('keyup', this.handleKeyUp);
  169. }
  170. componentWillUnmount() {
  171. window.addEventListener('keyup', this.handleKeyUp);
  172. }
  173. handleSkip = (e) => {
  174. e.preventDefault();
  175. this.props.onClose();
  176. }
  177. handleDot = (e) => {
  178. const i = Number(e.currentTarget.getAttribute('data-index'));
  179. e.preventDefault();
  180. this.setState({ currentIndex: i });
  181. }
  182. handlePrev = () => {
  183. this.setState(({ currentIndex }) => ({
  184. currentIndex: Math.max(0, currentIndex - 1),
  185. }));
  186. }
  187. handleNext = () => {
  188. const { pages } = this;
  189. this.setState(({ currentIndex }) => ({
  190. currentIndex: Math.min(currentIndex + 1, pages.length - 1),
  191. }));
  192. }
  193. handleKeyUp = ({ key }) => {
  194. switch (key) {
  195. case 'ArrowLeft':
  196. this.handlePrev();
  197. break;
  198. case 'ArrowRight':
  199. this.handleNext();
  200. break;
  201. }
  202. }
  203. handleClose = () => {
  204. this.props.onClose();
  205. }
  206. render () {
  207. const { pages } = this;
  208. const { currentIndex } = this.state;
  209. const hasMore = currentIndex < pages.length - 1;
  210. const nextOrDoneBtn = hasMore ? (
  211. <button
  212. onClick={this.handleNext}
  213. className='onboarding-modal__nav onboarding-modal__next'
  214. >
  215. <FormattedMessage id='onboarding.next' defaultMessage='Next' />
  216. </button>
  217. ) : (
  218. <button
  219. onClick={this.handleClose}
  220. className='onboarding-modal__nav onboarding-modal__done'
  221. >
  222. <FormattedMessage id='onboarding.done' defaultMessage='Done' />
  223. </button>
  224. );
  225. const styles = pages.map((data, i) => ({
  226. key: `page-${i}`,
  227. data,
  228. style: {
  229. opacity: spring(i === currentIndex ? 1 : 0),
  230. },
  231. }));
  232. return (
  233. <div className='modal-root__modal onboarding-modal'>
  234. <TransitionMotion styles={styles}>
  235. {interpolatedStyles => (
  236. <div className='onboarding-modal__pager'>
  237. {interpolatedStyles.map(({ key, data, style }, i) => {
  238. const className = classNames('onboarding-modal__page__wrapper', {
  239. 'onboarding-modal__page__wrapper--active': i === currentIndex,
  240. });
  241. return (
  242. <div key={key} style={style} className={className}>{data}</div>
  243. );
  244. })}
  245. </div>
  246. )}
  247. </TransitionMotion>
  248. <div className='onboarding-modal__paginator'>
  249. <div>
  250. <button
  251. onClick={this.handleSkip}
  252. className='onboarding-modal__nav onboarding-modal__skip'
  253. >
  254. <FormattedMessage id='onboarding.skip' defaultMessage='Skip' />
  255. </button>
  256. </div>
  257. <div className='onboarding-modal__dots'>
  258. {pages.map((_, i) => {
  259. const className = classNames('onboarding-modal__dot', {
  260. active: i === currentIndex,
  261. });
  262. return (
  263. <div
  264. key={`dot-${i}`}
  265. role='button'
  266. tabIndex='0'
  267. data-index={i}
  268. onClick={this.handleDot}
  269. className={className}
  270. />
  271. );
  272. })}
  273. </div>
  274. <div>
  275. {nextOrDoneBtn}
  276. </div>
  277. </div>
  278. </div>
  279. );
  280. }
  281. }
  282. export default connect(mapStateToProps)(injectIntl(OnboardingModal));