kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Simplify signup routing
rodzic
9f89c31bd3
commit
64cce966a2
|
@ -86,6 +86,7 @@ const SoapboxMount = () => {
|
||||||
const [isSystemDarkMode, setSystemDarkMode] = useState(colorSchemeQueryList.matches);
|
const [isSystemDarkMode, setSystemDarkMode] = useState(colorSchemeQueryList.matches);
|
||||||
const userTheme = settings.get('themeMode');
|
const userTheme = settings.get('themeMode');
|
||||||
const darkMode = userTheme === 'dark' || (userTheme === 'system' && isSystemDarkMode);
|
const darkMode = userTheme === 'dark' || (userTheme === 'system' && isSystemDarkMode);
|
||||||
|
const pepeEnabled = soapboxConfig.getIn(['extensions', 'pepe', 'enabled']) === true;
|
||||||
|
|
||||||
const themeCss = generateThemeCss(soapboxConfig);
|
const themeCss = generateThemeCss(soapboxConfig);
|
||||||
|
|
||||||
|
@ -171,20 +172,38 @@ const SoapboxMount = () => {
|
||||||
<Switch>
|
<Switch>
|
||||||
<Redirect from='/v1/verify_email/:token' to='/verify/email/:token' />
|
<Redirect from='/v1/verify_email/:token' to='/verify/email/:token' />
|
||||||
|
|
||||||
{waitlisted && <Route render={(props) => <WaitlistPage {...props} account={account} />} />}
|
{/* Redirect signup route depending on Pepe enablement. */}
|
||||||
|
{/* We should prefer using /signup in components. */}
|
||||||
|
{pepeEnabled ? (
|
||||||
|
<Redirect from='/signup' to='/verify' />
|
||||||
|
): (
|
||||||
|
<Redirect from='/verify' to='/signup' />
|
||||||
|
)}
|
||||||
|
|
||||||
|
{waitlisted && (
|
||||||
|
<Route render={(props) => <WaitlistPage {...props} account={account} />} />
|
||||||
|
)}
|
||||||
|
|
||||||
{!me && (singleUserMode
|
{!me && (singleUserMode
|
||||||
? <Redirect exact from='/' to={`/${singleUserMode}`} />
|
? <Redirect exact from='/' to={`/${singleUserMode}`} />
|
||||||
: <Route exact path='/' component={PublicLayout} />)}
|
: <Route exact path='/' component={PublicLayout} />)}
|
||||||
|
|
||||||
{!me && <Route exact path='/' component={PublicLayout} />}
|
{!me && (
|
||||||
|
<Route exact path='/' component={PublicLayout} />
|
||||||
|
)}
|
||||||
|
|
||||||
<Route exact path='/about/:slug?' component={PublicLayout} />
|
<Route exact path='/about/:slug?' component={PublicLayout} />
|
||||||
<Route exact path='/mobile/:slug?' component={PublicLayout} />
|
<Route exact path='/mobile/:slug?' component={PublicLayout} />
|
||||||
<Route path='/login' component={AuthLayout} />
|
<Route path='/login' component={AuthLayout} />
|
||||||
|
|
||||||
{(features.accountCreation && instance.registrations) && (
|
{(features.accountCreation && instance.registrations) && (
|
||||||
<Route exact path='/signup' component={AuthLayout} />
|
<Route exact path='/signup' component={AuthLayout} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{pepeEnabled && (
|
||||||
<Route path='/verify' component={AuthLayout} />
|
<Route path='/verify' component={AuthLayout} />
|
||||||
|
)}
|
||||||
|
|
||||||
<Route path='/reset-password' component={AuthLayout} />
|
<Route path='/reset-password' component={AuthLayout} />
|
||||||
<Route path='/edit-password' component={AuthLayout} />
|
<Route path='/edit-password' component={AuthLayout} />
|
||||||
<Route path='/invite/:token' component={AuthLayout} />
|
<Route path='/invite/:token' component={AuthLayout} />
|
||||||
|
|
|
@ -104,7 +104,7 @@ const Header = () => {
|
||||||
|
|
||||||
{(isOpen || pepeEnabled && pepeOpen) && (
|
{(isOpen || pepeEnabled && pepeOpen) && (
|
||||||
<Button
|
<Button
|
||||||
to={pepeEnabled ? '/verify' : '/signup'}
|
to='/signup'
|
||||||
theme='primary'
|
theme='primary'
|
||||||
>
|
>
|
||||||
{intl.formatMessage(messages.register)}
|
{intl.formatMessage(messages.register)}
|
||||||
|
|
|
@ -47,7 +47,7 @@ const LandingPageModal: React.FC<ILandingPageModal> = ({ onClose }) => {
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{(isOpen || pepeEnabled && pepeOpen) && (
|
{(isOpen || pepeEnabled && pepeOpen) && (
|
||||||
<Button to={pepeEnabled ? '/verify' : '/signup'} theme='primary' block>
|
<Button to='/signup' theme='primary' block>
|
||||||
{intl.formatMessage(messages.register)}
|
{intl.formatMessage(messages.register)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
Ładowanie…
Reference in New Issue