|
|
@ -126,11 +126,11 @@ class SwitchingColumnsArea extends PureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
static propTypes = {
|
|
|
|
children: PropTypes.node,
|
|
|
|
children: PropTypes.node,
|
|
|
|
location: PropTypes.object,
|
|
|
|
location: PropTypes.object,
|
|
|
|
mobile: PropTypes.bool,
|
|
|
|
singleColumn: PropTypes.bool,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
UNSAFE_componentWillMount () {
|
|
|
|
UNSAFE_componentWillMount () {
|
|
|
|
if (this.props.mobile) {
|
|
|
|
if (this.props.singleColumn) {
|
|
|
|
document.body.classList.toggle('layout-single-column', true);
|
|
|
|
document.body.classList.toggle('layout-single-column', true);
|
|
|
|
document.body.classList.toggle('layout-multiple-columns', false);
|
|
|
|
document.body.classList.toggle('layout-multiple-columns', false);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -144,9 +144,9 @@ class SwitchingColumnsArea extends PureComponent {
|
|
|
|
this.node.handleChildrenContentChange();
|
|
|
|
this.node.handleChildrenContentChange();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (prevProps.mobile !== this.props.mobile) {
|
|
|
|
if (prevProps.singleColumn !== this.props.singleColumn) {
|
|
|
|
document.body.classList.toggle('layout-single-column', this.props.mobile);
|
|
|
|
document.body.classList.toggle('layout-single-column', this.props.singleColumn);
|
|
|
|
document.body.classList.toggle('layout-multiple-columns', !this.props.mobile);
|
|
|
|
document.body.classList.toggle('layout-multiple-columns', !this.props.singleColumn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -157,16 +157,17 @@ class SwitchingColumnsArea extends PureComponent {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
render () {
|
|
|
|
const { children, mobile } = this.props;
|
|
|
|
const { children, singleColumn } = this.props;
|
|
|
|
const { signedIn } = this.context.identity;
|
|
|
|
const { signedIn } = this.context.identity;
|
|
|
|
|
|
|
|
const pathName = this.props.location.pathname;
|
|
|
|
|
|
|
|
|
|
|
|
let redirect;
|
|
|
|
let redirect;
|
|
|
|
|
|
|
|
|
|
|
|
if (signedIn) {
|
|
|
|
if (signedIn) {
|
|
|
|
if (mobile) {
|
|
|
|
if (singleColumn) {
|
|
|
|
redirect = <Redirect from='/' to='/home' exact />;
|
|
|
|
redirect = <Redirect from='/' to='/home' exact />;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
redirect = <Redirect from='/' to='/getting-started' exact />;
|
|
|
|
redirect = <Redirect from='/' to='/deck/getting-started' exact />;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (singleUserMode && owner && initialState?.accounts[owner]) {
|
|
|
|
} else if (singleUserMode && owner && initialState?.accounts[owner]) {
|
|
|
|
redirect = <Redirect from='/' to={`/@${initialState.accounts[owner].username}`} exact />;
|
|
|
|
redirect = <Redirect from='/' to={`/@${initialState.accounts[owner].username}`} exact />;
|
|
|
@ -177,10 +178,13 @@ class SwitchingColumnsArea extends PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ColumnsAreaContainer ref={this.setRef} singleColumn={mobile}>
|
|
|
|
<ColumnsAreaContainer ref={this.setRef} singleColumn={singleColumn}>
|
|
|
|
<WrappedSwitch>
|
|
|
|
<WrappedSwitch>
|
|
|
|
{redirect}
|
|
|
|
{redirect}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{singleColumn ? <Redirect from='/deck' to='/home' exact /> : null}
|
|
|
|
|
|
|
|
{singleColumn && pathName.startsWith('/deck/') ? <Redirect from={pathName} to={pathName.slice(5)} /> : null}
|
|
|
|
|
|
|
|
|
|
|
|
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} />
|
|
|
|
<WrappedRoute path='/getting-started' component={GettingStarted} content={children} />
|
|
|
|
<WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} />
|
|
|
|
<WrappedRoute path='/keyboard-shortcuts' component={KeyboardShortcuts} content={children} />
|
|
|
|
<WrappedRoute path='/about' component={About} content={children} />
|
|
|
|
<WrappedRoute path='/about' component={About} content={children} />
|
|
|
@ -573,7 +577,7 @@ class UI extends PureComponent {
|
|
|
|
<div className={classNames('ui', { 'is-composing': isComposing })} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}>
|
|
|
|
<div className={classNames('ui', { 'is-composing': isComposing })} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}>
|
|
|
|
<Header />
|
|
|
|
<Header />
|
|
|
|
|
|
|
|
|
|
|
|
<SwitchingColumnsArea location={location} mobile={layout === 'mobile' || layout === 'single-column'}>
|
|
|
|
<SwitchingColumnsArea location={location} singleColumn={layout === 'mobile' || layout === 'single-column'}>
|
|
|
|
{children}
|
|
|
|
{children}
|
|
|
|
</SwitchingColumnsArea>
|
|
|
|
</SwitchingColumnsArea>
|
|
|
|
|
|
|
|
|
|
|
|