refactor: invite view placeholder

pull/13/head
moonrailgun 4 years ago
parent ad98c8f50c
commit 9712c4a4a6

@ -13,6 +13,10 @@ const EntryRoute = Loadable(() =>
import('./routes/Entry').then((module) => module.EntryRoute)
);
const InviteRoute = Loadable(() =>
import('./routes/Invite').then((module) => module.InviteRoute)
);
const AppProvider: React.FC = React.memo((props) => {
const getPopupContainer = useCallback(
(triggerNode: HTMLElement): HTMLElement => {
@ -52,6 +56,7 @@ export const App: React.FC = React.memo(() => {
<Switch>
<Route path="/entry" component={EntryRoute} />
<Route path="/main" component={MainRoute} />
<Route path="/invite/:inviteCode" component={InviteRoute} />
<Redirect to="/entry" />
</Switch>
</AppProvider>

@ -0,0 +1,43 @@
import { Button, Divider } from 'antd';
import React, { useCallback } from 'react';
import { useHistory, useParams } from 'react-router';
/**
*
*/
export const InviteRoute: React.FC = React.memo(() => {
const history = useHistory();
const { inviteCode } = useParams<{ inviteCode: string }>();
const isLogin = true;
const handleRegister = useCallback(() => {
history.push(
`/entry/register?redirect=${encodeURIComponent(location.pathname)}`
);
}, []);
const handleJoinGroup = useCallback(() => {
// TODO
console.log('TODO');
}, []);
return (
<div className="h-full w-full">
<div className="w-96 h-72">
<div>{inviteCode}</div>
<div>xxx </div>
<div>[]</div>
<div>: </div>
<Divider />
{isLogin ? (
<Button onClick={handleJoinGroup}></Button>
) : (
<Button onClick={handleRegister}></Button>
)}
</div>
</div>
);
});
InviteRoute.displayName = 'InviteRoute';
Loading…
Cancel
Save