Removed Introduction/onboarding code from ui.js

Will be moving elsewhere...

• Removed:
- Introduction/onboarding code from ui.js
- /welcome route
This commit is contained in:
mgabdev 2020-07-14 18:48:48 -05:00
parent 5791a5225b
commit 0eb3ae2dfa

View File

@ -16,7 +16,6 @@ import {
} from '../../actions/notifications'
import LoadingBar from '../../components/loading_bar'
import { fetchFilters } from '../../actions/filters'
import { MIN_ACCOUNT_CREATED_AT_ONBOARDING } from '../../actions/onboarding'
import { clearHeight } from '../../actions/height_cache'
import { openModal } from '../../actions/modal'
import WrappedRoute from './util/wrapped_route'
@ -40,7 +39,6 @@ import ModalPage from '../../pages/modal_page'
import SettingsPage from '../../pages/settings_page'
import ProPage from '../../pages/pro_page'
import ExplorePage from '../../pages/explore_page'
import IntroductionPage from '../../pages/introduction_page'
import AboutPage from '../../pages/about_page'
// import AuthPage from '../../pages/auth_page'
@ -66,7 +64,6 @@ import {
GroupTimeline,
HashtagTimeline,
HomeTimeline,
Introduction,
Investors,
LikedStatuses,
ListCreate,
@ -97,8 +94,6 @@ const messages = defineMessages({
})
const mapStateToProps = (state) => ({
shownOnboarding: state.getIn(['settings', 'shownOnboarding'], false),
accountCreatedAt: state.getIn(['accounts', me, 'created_at']),
isComposing: state.getIn(['compose', 'is_composing']),
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
@ -134,7 +129,6 @@ class SwitchingArea extends PureComponent {
children: PropTypes.node,
location: PropTypes.object,
onLayoutChange: PropTypes.func.isRequired,
shownOnboarding: PropTypes.bool.isRequired,
}
componentDidMount() {
@ -166,7 +160,6 @@ class SwitchingArea extends PureComponent {
<Redirect from='/' to='/home' exact />
<WrappedRoute path='/home' exact page={HomePage} component={HomeTimeline} content={children} />
<WrappedRoute path='/welcome' exact page={IntroductionPage} component={Introduction} content={children} />
<WrappedRoute path='/about' publicRoute exact page={AboutPage} component={About} content={children} componentParams={{ title: 'About' }} />
<WrappedRoute path='/about/dmca' publicRoute exact page={AboutPage} component={DMCA} content={children} componentParams={{ title: 'DMCA' }} />
@ -269,8 +262,6 @@ class UI extends PureComponent {
hasMediaAttachments: PropTypes.bool,
location: PropTypes.object,
intl: PropTypes.object.isRequired,
shownOnboarding: PropTypes.bool.isRequired,
accountCreatedAt: PropTypes.string.isRequired,
}
state = {
@ -387,15 +378,6 @@ class UI extends PureComponent {
componentWillMount() {
if (!me) return
//If first time opening app, and is new user, show onboarding
const accountCreatedAtValue = moment(this.props.accountCreatedAt).valueOf()
const shouldShowOnboarding = !this.props.shownOnboarding && accountCreatedAtValue > MIN_ACCOUNT_CREATED_AT_ONBOARDING
if (shouldShowOnboarding) {
this.context.router.history.push('/welcome')
return
}
window.addEventListener('beforeunload', this.handleBeforeUnload, false)
document.addEventListener('dragenter', this.handleDragEnter, false)
@ -434,8 +416,6 @@ class UI extends PureComponent {
this.setState({ fetchedNotifications: true })
this.props.dispatch(expandNotifications())
} else if (pathname === '/welcome') {
this.context.router.history.push('/home')
}
this.props.dispatch(initializeNotifications())
@ -552,11 +532,7 @@ class UI extends PureComponent {
}
render() {
const {
children,
location,
shownOnboarding,
} = this.props
const { children, location } = this.props
const { draggingOver } = this.state
// : todo :
@ -580,11 +556,7 @@ class UI extends PureComponent {
<div ref={this.setRef} className={_s.gabsocial}>
<LoadingBar className={[_s.height1PX, _s.z3, _s.bgBrandLight].join(' ')} />
<SwitchingArea
location={location}
onLayoutChange={this.handleLayoutChange}
shownOnboarding={shownOnboarding}
>
<SwitchingArea location={location} onLayoutChange={this.handleLayoutChange}>
{children}
</SwitchingArea>