feat(web): add servers page

This commit is contained in:
41666 2021-03-13 03:15:31 -05:00
parent 2ab13f134e
commit 4b098db4f4
3 changed files with 18 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import { Router } from '@reach/router';
import * as React from 'react';
const LandingPage = React.lazy(() => import('../pages/landing'));
const ServersPage = React.lazy(() => import('../pages/servers'));
const DevToolsSetApi = React.lazy(() => import('../pages/dev-tools/set-api'));
const DevToolsSessionDebug = React.lazy(() => import('../pages/dev-tools/session-debug'));
const MachineryNewSession = React.lazy(() => import('../pages/machinery/new-session'));
@ -20,6 +21,7 @@ export const AppRouter = () => {
return (
<Router>
<RouteWrapper component={LandingPage} path="/" />
<RouteWrapper component={ServersPage} path="/servers" />
<RouteWrapper component={MachineryNewSession} path="/machinery/new-session" />
<RouteWrapper component={DevToolsSetApi} path="/x/dev-tools/set-api" />
<RouteWrapper

View file

@ -7,8 +7,7 @@ const Landing = () => {
const { isAuthenticated } = useSessionContext();
if (isAuthenticated) {
// return <Redirect to="/servers" />;
return <Redirect to="/x/dev-tools/session-debug" />;
return <Redirect to="/servers" />;
}
return <LandingTemplate />;

View file

@ -0,0 +1,15 @@
import { Redirect } from '@reach/router';
import { ServersTemplate } from '@roleypoly/design-system/templates/servers';
import * as React from 'react';
import { useSessionContext } from '../session-context/SessionContext';
const ServersPage = () => {
const { isAuthenticated, session } = useSessionContext();
if (!isAuthenticated || !session) {
return <Redirect to="/" />;
}
return <ServersTemplate guilds={session.guilds || []} user={session.user} />;
};
export default ServersPage;