1import React, { useCallback } from 'react';
2import * as need from 'lib/need';
3import { Grid, H5, Text, Button } from 'indigo-react';
5import { usePointCursor } from 'store/pointCursor';
6// import { usePointCache } from 'store/pointCache';
8import View from 'components/View';
9import Crumbs from 'components/Crumbs';
11import useInvites from 'lib/useInvites';
12import useSyncPoint from 'lib/useSyncPoint';
13import useCurrentPointName from 'lib/useCurrentPointName';
15import { useHistory } from 'store/history';
16import { ForwardButton } from 'components/Buttons';
17import FooterButton from 'components/FooterButton';
18import useRouter from 'lib/useRouter';
19import InvitesSend from './InvitesSend';
31const valOrLoading = val =>
37function Highlighted(props) {
38 return <span className="red3" {...props} />;
41function InviteUrl({ names, push }) {
42 const pushEmail = useCallback(() => push(names.EMAIL), [push, names]);
46 <Grid className="mt3">
50 detail="Generate a URL to send to one guest"
59 detail="Send invitation to your guest's email"
64 <FooterButton detail="i.e. Ethereum Address, Text File" disabled>
71export default function Invite() {
72 const history = useHistory();
73 const { Route, ...routeProps } = useRouter({
76 initialRoutes: [{ key: kInviteNames.URL }],
78 const { pointCursor } = usePointCursor();
79 const point = need.pointCursor(pointCursor);
80 const name = useCurrentPointName();
82 // sync the current cursor
85 // fetch the invites for the current cursor
86 const { availableInvites, sentInvites, acceptedInvites } = useInvites(point);
87 const availableInvitesText = valOrLoading(availableInvites);
88 const sentInvitesText = valOrLoading(sentInvites);
89 const acceptedInvitesText = valOrLoading(acceptedInvites);
93 <Grid className="mb3">
99 action: () => history.pop(),
107 <Grid.Item as={H5} className="mv4" full>
110 <Grid.Item as={Text} full>
111 You currently have{' '}
112 <Highlighted>{availableInvitesText} invitations</Highlighted> left.
114 Out of the <Highlighted>{sentInvitesText}</Highlighted> invites you
115 sent, <Highlighted>{acceptedInvitesText}</Highlighted> have been
119 {/* TODO(shrugs): use context isntead of this routeProps nonsense */}
120 <Route {...routeProps} />
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list