2017-06-08_509bba0/509bba0_unpacked/discord_app/roots.js
2022-07-26 10:06:20 -07:00

85 lines
No EOL
3.8 KiB
JavaScript
Executable file

import React from 'react';
import {Router, Route, Redirect, IndexRedirect, IndexRoute} from 'react-router';
import platform from 'platform';
import {App, AppOverlay, AppTransition} from './components/App';
import Login from './components/Login';
import Register from './components/Register';
import Invite from './components/Invite';
import InviteMobile from './components/InviteMobile';
import VerifyConnectedAccount from './components/VerifyConnectedAccount';
import VerifyEmail from './components/VerifyEmail';
import DisableEmailNotifications from './components/DisableEmailNotifications';
import AuthorizeIPAddress from './components/AuthorizeIPAddress';
import ResetPassword from './components/ResetPassword';
import OAuth2Authorize, {OAuth2Authorized, OAuth2Error, OAuth2WhitelistAccept} from './components/OAuth2Authorize';
import UnsupportedBrowser from './components/UnsupportedBrowser';
import DownloadApps from './components/DownloadApps';
import Chat from './components/Chat';
import RouterUtils from './utils/RouterUtils';
import {userSettingsRedirector} from './utils/RedirectUtils';
import {routerOnUpdate} from './utils/AppUtils';
import NewUserOnboarding from './components/NewUserOnboarding';
const MainApp = () => {
const isMobile = platform.os.family === 'Android' || platform.os.family === 'iOS';
return (
<Router onUpdate={routerOnUpdate} history={RouterUtils.getHistory()}>
<Redirect from="/" to="/channels/@me" />
<Route path="/" component={App}>
<Route path="/channels" component={AppTransition} componentType="channels">
<IndexRedirect to="@me" />
<Route
path="welcome/:guildId/:channelId/:type"
component={NewUserOnboarding}
onEnter={NewUserOnboarding.Authenticate}
componentType="channels"
/>
<Route path="@me" component={Chat} onEnter={Chat.Authenticate} componentType="channels" />
<Route path=":guildId" component={Chat} onEnter={Chat.Authenticate} componentType="channels" />
<Route path=":guildId/:channelId" component={Chat} onEnter={Chat.Authenticate} componentType="channels" />
</Route>
<Route path="/login" component={Login} />
<Route path="/register" component={Register} />
<Route path="/invite/:code" component={isMobile ? InviteMobile : Invite} />
<Route path="/invite-proxy/:channelId" component={Invite.Proxy} onEnter={Invite.Proxy.onEnter} />
<Route path="/verify" component={VerifyEmail} />
<Route path="/disable-email-notifications" component={DisableEmailNotifications} />
<Route path="/authorize-ip" component={AuthorizeIPAddress} />
<Route path="/reset" component={ResetPassword} />
<Route path="/apps" component={DownloadApps} />
<Route path="/connections/:type" component={VerifyConnectedAccount} />
<Route path="/oauth2/authorize" component={OAuth2Authorize} onEnter={OAuth2Authorize.Authenticate} />
<Route path="/oauth2/authorized" component={OAuth2Authorized} />
<Route path="/oauth2/error" component={OAuth2Error} />
<Route path="/oauth2/whitelist/accept" component={OAuth2WhitelistAccept} />
<Route path="/settings">
<Route path=":section" onEnter={userSettingsRedirector} />
<Route path=":section/:subsection" onEnter={userSettingsRedirector} />
</Route>
</Route>
</Router>
);
};
const UnsupportedApp = () =>
<Router history={RouterUtils.getHistory()}>
<Route path="/" component={App}>
<IndexRoute component={UnsupportedBrowser} />
<Route path="/apps" component={DownloadApps} />
<Route path="*" component={UnsupportedBrowser} />
</Route>
</Router>;
const OverlayApp = AppOverlay;
export default {
MainApp,
UnsupportedApp,
OverlayApp,
};
// WEBPACK FOOTER //
// ./discord_app/roots.js