mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 23:11:13 +00:00
1 line
20 KiB
Plaintext
1 line
20 KiB
Plaintext
{"version":3,"sources":["webpack:///./app/javascript/mastodon/features/ui/components/onboarding_modal.js"],"names":["noop","messages","Object","react_intl__WEBPACK_IMPORTED_MODULE_6__","home_title","id","defaultMessage","notifications_title","local_title","federated_title","PageOne","_ref","acct","domain","babel_runtime_helpers_jsx__WEBPACK_IMPORTED_MODULE_3___default","className","PageTwo","_ref2","myAccount","_compose_components_navigation_bar__WEBPACK_IMPORTED_MODULE_12__","account","_compose_components_compose_form__WEBPACK_IMPORTED_MODULE_10__","text","suggestions","immutable__WEBPACK_IMPORTED_MODULE_14__","mentionedDomains","spoiler","onChange","onSubmit","onPaste","onPickEmoji","onChangeSpoilerText","onClearSuggestions","onFetchSuggestions","onSuggestionSelected","showSearch","PageThree","_ref3","_compose_components_search__WEBPACK_IMPORTED_MODULE_11__","value","onClear","onShow","values","illustration","_components_permalink__WEBPACK_IMPORTED_MODULE_9__","to","href","introductions","PageFour","_ref4","intl","_column_header__WEBPACK_IMPORTED_MODULE_13__","icon","type","formatMessage","style","marginBottom","PageSix","_ref5","admin","adminSection","get","guidelines","target","github","rel","apps","OnboardingModal","react_redux__WEBPACK_IMPORTED_MODULE_5__","state","getIn","_initial_state__WEBPACK_IMPORTED_MODULE_15__","currentIndex","handleSkip","e","preventDefault","_this","props","onClose","handleDot","i","Number","currentTarget","getAttribute","setState","handlePrev","_ref6","Math","max","handleNext","pages","_ref7","min","length","handleSwipe","index","handleKeyUp","_ref8","key","handleClose","componentWillMount","_props","this","componentDidMount","window","addEventListener","componentWillUnmount","render","_this3","nextOrDoneBtn","hasMore","onClick","react_swipeable_views__WEBPACK_IMPORTED_MODULE_7___default","a","onChangeIndex","map","page","classnames__WEBPACK_IMPORTED_MODULE_8___default","onboarding-modal__page__wrapper--active","_","active","role","tabIndex","data-index","react__WEBPACK_IMPORTED_MODULE_4___default","PureComponent"],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EAAA,GApBXE,GAoB+B,kBApB/BC,eAoBgE,WApBhEQ,IAAA,OAAAC,UAwBqB,+BAxBrB,EAyBS2E,EAAMyB,IAAI,SAACI,EAAGvC,GACb,IAAMjE,EAAYsG,IAAW,yBAC3BG,OAAQxC,IAAMR,IAGhB,OAAA1D,IAAA,OAAA2G,KAGS,SAHTC,SAIa,IAJbC,aAKgB3C,EALhB+B,QAMaH,EAAK7B,UANlBhE,UAOeA,GAPf,OAEgBiE,MAhC1BlE,IAAA,gBA4CS+F,SAvIgCe,EAAAX,EAAMY","file":"modals/onboarding_modal.js","sourcesContent":["import React from 'react';\nimport { connect } from 'react-redux';\nimport PropTypes from 'prop-types';\nimport ImmutablePropTypes from 'react-immutable-proptypes';\nimport { defineMessages, injectIntl, FormattedMessage } from 'react-intl';\nimport ReactSwipeableViews from 'react-swipeable-views';\nimport classNames from 'classnames';\nimport Permalink from '../../../components/permalink';\nimport ComposeForm from '../../compose/components/compose_form';\nimport Search from '../../compose/components/search';\nimport NavigationBar from '../../compose/components/navigation_bar';\nimport ColumnHeader from './column_header';\nimport { List as ImmutableList } from 'immutable';\nimport { me } from '../../../initial_state';\n\nconst noop = () => { };\n\nconst messages = defineMessages({\n home_title: { id: 'column.home', defaultMessage: 'Home' },\n notifications_title: { id: 'column.notifications', defaultMessage: 'Notifications' },\n local_title: { id: 'column.community', defaultMessage: 'Local timeline' },\n federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' },\n});\n\nconst PageOne = ({ acct, domain }) => (\n <div className='onboarding-modal__page onboarding-modal__page-one'>\n <div className='onboarding-modal__page-one__lead'>\n <h1><FormattedMessage id='onboarding.page_one.welcome' defaultMessage='Welcome to Mastodon!' /></h1>\n <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>\n </div>\n\n <div className='onboarding-modal__page-one__extra'>\n <div className='display-case'>\n <div className='display-case__label'>\n <FormattedMessage id='onboarding.page_one.full_handle' defaultMessage='Your full handle' />\n </div>\n\n <div className='display-case__case'>\n @{acct}@{domain}\n </div>\n </div>\n\n <p><FormattedMessage id='onboarding.page_one.handle_hint' defaultMessage='This is what you would tell your friends to search for.' /></p>\n </div>\n </div>\n);\n\nPageOne.propTypes = {\n acct: PropTypes.string.isRequired,\n domain: PropTypes.string.isRequired,\n};\n\nconst PageTwo = ({ myAccount }) => (\n <div className='onboarding-modal__page onboarding-modal__page-two'>\n <div className='figure non-interactive'>\n <div className='pseudo-drawer'>\n <NavigationBar account={myAccount} />\n\n <ComposeForm\n text='Awoo! #introductions'\n suggestions={ImmutableList()}\n mentionedDomains={[]}\n spoiler={false}\n onChange={noop}\n onSubmit={noop}\n onPaste={noop}\n onPickEmoji={noop}\n onChangeSpoilerText={noop}\n onClearSuggestions={noop}\n onFetchSuggestions={noop}\n onSuggestionSelected={noop}\n showSearch\n />\n </div>\n </div>\n\n <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>\n </div>\n);\n\nPageTwo.propTypes = {\n myAccount: ImmutablePropTypes.map.isRequired,\n};\n\nconst PageThree = ({ myAccount }) => (\n <div className='onboarding-modal__page onboarding-modal__page-three'>\n <div className='figure non-interactive'>\n <Search\n value=''\n onChange={noop}\n onSubmit={noop}\n onClear={noop}\n onShow={noop}\n />\n\n <div className='pseudo-drawer'>\n <NavigationBar account={myAccount} />\n </div>\n </div>\n\n <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>\n <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>\n </div>\n);\n\nPageThree.propTypes = {\n myAccount: ImmutablePropTypes.map.isRequired,\n};\n\nconst PageFour = ({ domain, intl }) => (\n <div className='onboarding-modal__page onboarding-modal__page-four'>\n <div className='onboarding-modal__page-four__columns'>\n <div className='row'>\n <div>\n <div className='figure non-interactive'><ColumnHeader icon='home' type={intl.formatMessage(messages.home_title)} /></div>\n <p><FormattedMessage id='onboarding.page_four.home' defaultMessage='The home timeline shows posts from people you follow.' /></p>\n </div>\n\n <div>\n <div className='figure non-interactive'><ColumnHeader icon='bell' type={intl.formatMessage(messages.notifications_title)} /></div>\n <p><FormattedMessage id='onboarding.page_four.notifications' defaultMessage='The notifications column shows when someone interacts with you.' /></p>\n </div>\n </div>\n\n <div className='row'>\n <div>\n <div className='figure non-interactive' style={{ marginBottom: 0 }}><ColumnHeader icon='users' type={intl.formatMessage(messages.local_title)} /></div>\n </div>\n\n <div>\n <div className='figure non-interactive' style={{ marginBottom: 0 }}><ColumnHeader icon='globe' type={intl.formatMessage(messages.federated_title)} /></div>\n </div>\n </div>\n\n <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>\n </div>\n </div>\n);\n\nPageFour.propTypes = {\n domain: PropTypes.string.isRequired,\n intl: PropTypes.object.isRequired,\n};\n\nconst PageSix = ({ admin, domain }) => {\n let adminSection = '';\n\n if (admin) {\n adminSection = (\n <p>\n <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> }} />\n <br />\n <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> }} />\n </p>\n );\n }\n\n return (\n <div className='onboarding-modal__page onboarding-modal__page-six'>\n <h1><FormattedMessage id='onboarding.page_six.almost_done' defaultMessage='Almost done...' /></h1>\n {adminSection}\n <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>\n <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>\n <p><em><FormattedMessage id='onboarding.page_six.appetoot' defaultMessage='Bon Appetoot!' /></em></p>\n </div>\n );\n};\n\nPageSix.propTypes = {\n admin: ImmutablePropTypes.map,\n domain: PropTypes.string.isRequired,\n};\n\nconst mapStateToProps = state => ({\n myAccount: state.getIn(['accounts', me]),\n admin: state.getIn(['accounts', state.getIn(['meta', 'admin'])]),\n domain: state.getIn(['meta', 'domain']),\n});\n\n@connect(mapStateToProps)\n@injectIntl\nexport default class OnboardingModal extends React.PureComponent {\n\n static propTypes = {\n onClose: PropTypes.func.isRequired,\n intl: PropTypes.object.isRequired,\n myAccount: ImmutablePropTypes.map.isRequired,\n domain: PropTypes.string.isRequired,\n admin: ImmutablePropTypes.map,\n };\n\n state = {\n currentIndex: 0,\n };\n\n componentWillMount() {\n const { myAccount, admin, domain, intl } = this.props;\n this.pages = [\n <PageOne acct={myAccount.get('acct')} domain={domain} />,\n <PageTwo myAccount={myAccount} />,\n <PageThree myAccount={myAccount} />,\n <PageFour domain={domain} intl={intl} />,\n <PageSix admin={admin} domain={domain} />,\n ];\n };\n\n componentDidMount() {\n window.addEventListener('keyup', this.handleKeyUp);\n }\n\n componentWillUnmount() {\n window.addEventListener('keyup', this.handleKeyUp);\n }\n\n handleSkip = (e) => {\n e.preventDefault();\n this.props.onClose();\n }\n\n handleDot = (e) => {\n const i = Number(e.currentTarget.getAttribute('data-index'));\n e.preventDefault();\n this.setState({ currentIndex: i });\n }\n\n handlePrev = () => {\n this.setState(({ currentIndex }) => ({\n currentIndex: Math.max(0, currentIndex - 1),\n }));\n }\n\n handleNext = () => {\n const { pages } = this;\n this.setState(({ currentIndex }) => ({\n currentIndex: Math.min(currentIndex + 1, pages.length - 1),\n }));\n }\n\n handleSwipe = (index) => {\n this.setState({ currentIndex: index });\n }\n\n handleKeyUp = ({ key }) => {\n switch (key) {\n case 'ArrowLeft':\n this.handlePrev();\n break;\n case 'ArrowRight':\n this.handleNext();\n break;\n }\n }\n\n handleClose = () => {\n this.props.onClose();\n }\n\n render () {\n const { pages } = this;\n const { currentIndex } = this.state;\n const hasMore = currentIndex < pages.length - 1;\n\n const nextOrDoneBtn = hasMore ? (\n <button onClick={this.handleNext} className='onboarding-modal__nav onboarding-modal__next shake-bottom'>\n <FormattedMessage id='onboarding.next' defaultMessage='Next' /> <i className='fa fa-fw fa-chevron-right' />\n </button>\n ) : (\n <button onClick={this.handleClose} className='onboarding-modal__nav onboarding-modal__done shake-bottom'>\n <FormattedMessage id='onboarding.done' defaultMessage='Done' /> <i className='fa fa-fw fa-check' />\n </button>\n );\n\n return (\n <div className='modal-root__modal onboarding-modal'>\n <ReactSwipeableViews index={currentIndex} onChangeIndex={this.handleSwipe} className='onboarding-modal__pager'>\n {pages.map((page, i) => {\n const className = classNames('onboarding-modal__page__wrapper', `onboarding-modal__page__wrapper-${i}`, {\n 'onboarding-modal__page__wrapper--active': i === currentIndex,\n });\n\n return (\n <div key={i} className={className}>{page}</div>\n );\n })}\n </ReactSwipeableViews>\n\n <div className='onboarding-modal__paginator'>\n <div>\n <button\n onClick={this.handleSkip}\n className='onboarding-modal__nav onboarding-modal__skip'\n >\n <FormattedMessage id='onboarding.skip' defaultMessage='Skip' />\n </button>\n </div>\n\n <div className='onboarding-modal__dots'>\n {pages.map((_, i) => {\n const className = classNames('onboarding-modal__dot', {\n active: i === currentIndex,\n });\n\n return (\n <div\n key={`dot-${i}`}\n role='button'\n tabIndex='0'\n data-index={i}\n onClick={this.handleDot}\n className={className}\n />\n );\n })}\n </div>\n\n <div>\n {nextOrDoneBtn}\n </div>\n </div>\n </div>\n );\n }\n\n}\n"],"sourceRoot":""} |