on master help sign in
refactor and remove debugging artifacts
commit777d700f98842e63fa43bd042f4952d60613fa46 authorLiam Fitzgerald <liam@urizen.co> dateThu 9 Jan 2020, 00:47 (7 years ago) parentc2ab9d2
9 files changed+32−47
src/form/BridgeForm.js−1 src/form/FormError.js−1 src/lib/inviteMail.js−2 src/lib/router.js+2−2 src/lib/useInviter.js−3 src/store/lib/useInvitesStore.js−2 src/views/Invite/Cohort.js+5 src/views/Invite/Email.js−1 src/views/Point.js+25−35
src/form/BridgeForm.js−1
@@ -25,7 +25,6 @@ export default function BridgeForm({
2525 async (...args) => {
2626 const errors = await onSubmit(...args);
2727 if (errors) {
28− console.log(errors);
2928 return errors;
3029 }
3130
src/form/FormError.js−1
@@ -25,7 +25,6 @@ export default function FormError(props) {
2525
2626 const warning = submitErrors && submitErrors[WARNING];
2727 const showWarning = !!warning && !dirtySinceLastSubmit;
28− console.log(dirtySinceLastSubmit);
2928
3029 return showSubmitError || showValidationError || showWarning ? (
3130 <ErrorText {...props}>
src/lib/inviteMail.js−2
@@ -37,8 +37,6 @@ function sendMail(recipient, ticket, sender, message, tx) {
3737 sender,
3838 message,
3939 tx,
40− }).then(() => {
41− throw new Error('test');
4240 });
4341}
4442
src/lib/router.js+2−2
@@ -12,7 +12,7 @@ import Invite from 'views/Invite';
1212import Activate from 'views/Activate';
1313
1414import PartySetPoolSize from 'views/Party/PartySetPoolSize';
15−import ShowParty from 'views/Party/ShowParty';
15+import InviteCohort from 'views/Invite/Cohort';
1616import AcceptTransfer from 'views/AcceptTransfer';
1717import CancelTransfer from 'views/CancelTransfer';
1818
@@ -34,6 +34,6 @@ export const ROUTES = {
3434 [ROUTE_NAMES.ACCEPT_TRANSFER]: AcceptTransfer,
3535 // TODO: replace this with deep link to AdminCancelTransfer
3636 [ROUTE_NAMES.CANCEL_TRANSFER]: CancelTransfer,
37− [ROUTE_NAMES.PARTY]: ShowParty,
37+ [ROUTE_NAMES.INVITE_COHORT]: InviteCohort,
3838 [ROUTE_NAMES.STAR_RELEASE]: StarRelease,
3939};
src/lib/useInviter.js−3
@@ -71,7 +71,6 @@ const useInviter = () => {
7171
7272 const nonce = await _web3.eth.getTransactionCount(_wallet.address);
7373 const chainId = await _web3.eth.net.getId();
74− debugger;
7574 const planets = await azimuth.delegatedSending.getPlanetsToSend(
7675 _contracts,
7776 point,
@@ -179,8 +178,6 @@ const useInviter = () => {
179178
180179 setTxStatus(STATUS.SUCCESS);
181180 setInvites(confirmedInvites);
182− console.log(unsentInvites);
183− console.log(confirmedInvites);
184181
185182 if (unsentInvites.length > 0) {
186183 return { errors: { [FORM_ERROR]: unsentInvites } };
src/store/lib/useInvitesStore.js−2
@@ -45,8 +45,6 @@ export default function useInvitesStore() {
4545 const sentInvites = invitedPoints.length;
4646 const acceptedInvites = activity.filter(i => !!i).length;
4747
48− console.log(invitedPoints);
49−
5048 const [acceptedPoints, pendingPoints] = chain(invitedPoints)
5149 .zipWith(activity, (point, active) => ({
5250 point,
src/views/Invite/Cohort.js+5
@@ -90,6 +90,11 @@ function CohortList({ points, className }) {
9090 <Grid.Item key={p} half={(idx % 2) + 1} as={CohortMember} point={p} />
9191 ))}
9292 </>
93+ {visiblePoints.length === 0 && (
94+ <Grid.Item full className="p4 t-center">
95+ No invites accepted yet.
96+ </Grid.Item>
97+ )}
9398 </Grid>
9499 );
95100}
src/views/Invite/Email.js−1
@@ -193,7 +193,6 @@ const InviteMail = () => {
193193 onSubmit={onSubmit}>
194194 {({ handleSubmit, values }) => (
195195 <>
196− {console.log(values) && null}
197196 <Grid.Item full as={EmailChipInput} name="emails" className="mt4" />
198197 {renderButton(handleSubmit)}
199198
src/views/Point.js+25−35
@@ -12,7 +12,7 @@ import Greeting from 'components/Greeting';
1212import Passport from 'components/Passport';
1313import { ForwardButton, BootUrbitOSButton } from 'components/Buttons';
1414import CopyButton from 'components/CopyButton';
15−import { matchBlinky } from 'components/Blinky';
15+import Blinky, { matchBlinky } from 'components/Blinky';
1616import DownloadSigilButton from 'components/DownloadSigilButton';
1717import BarGraph from 'components/BarGraph';
1818import Chip from 'components/Chip';
@@ -63,6 +63,8 @@ export default function Point() {
6363 const _totalInvites =
6464 sentInvites.getOrElse(0) + availableInvites.getOrElse(0);
6565 const _pendingInvites = pendingPoints.getOrElse([]).length;
66+
67+ const loadedInvites = Just.hasInstance(availableInvites);
6668 //
6769 // availableInvites.getOrElse(0) === 0
6870
@@ -72,7 +74,7 @@ export default function Point() {
7274
7375 const goInvite = useCallback(() => push(names.INVITE), [push, names]);
7476
75− const goParty = useCallback(() => push(names.PARTY), [push, names]);
77+ const goCohort = useCallback(() => push(names.INVITE_COHORT), [push, names]);
7678
7779 const goPartiesSetPoolSize = useCallback(
7880 () => push(names.PARTY_SET_POOL_SIZE),
@@ -89,39 +91,22 @@ export default function Point() {
8991 const [showInviteForm, setShowInviteForm] = useState(false);
9092
9193 const inviteButton = (() => {
92− switch (azimuth.getPointSize(point)) {
93− case azimuth.PointSize.Planet:
94− const availableInvitesText = matchBlinky(availableInvites);
95− return (
96− <>
97− <Grid.Item
98− full
99− as={ForwardButton}
100− disabled={!isActiveOwner}
101− onClick={goInvite}>
102− Invite <sup>{availableInvitesText}</sup>
103− </Grid.Item>
104− <Grid.Divider />
105− </>
106− );
107− //
108− case azimuth.PointSize.Star:
109− return (
110− <>
111− <Grid.Item
112− full
113− as={ForwardButton}
114− disabled={!isActiveOwner}
115− onClick={goPartiesSetPoolSize}>
116− Manage Invite Pools
117− </Grid.Item>
118− <Grid.Divider />
119− </>
120− );
121− //
122− default:
123− return null;
94+ if (azimuth.getPointSize(point) === azimuth.PointSize.Star) {
95+ return (
96+ <>
97+ <Grid.Item
98+ full
99+ as={ForwardButton}
100+ disabled={!isActiveOwner}
101+ onClick={goPartiesSetPoolSize}>
102+ Manage Invite Pools
103+ </Grid.Item>
104+ <Grid.Divider />
105+ </>
106+ );
124107 }
108+
109+ return null;
125110 })();
126111
127112 const senateButton = (() => {
@@ -167,7 +152,7 @@ export default function Point() {
167152 className={cn('t-right underline', {
168153 gray4: sentInvites.getOrElse(0) === 0,
169154 })}
170− onClick={goParty}
155+ onClick={goCohort}
171156 cols={[11, 13]}>
172157 View
173158 </Grid.Item>
@@ -223,6 +208,11 @@ export default function Point() {
223208 {showInviteForm && <Inviter />}
224209 </>
225210 )}
211+ {!loadedInvites && isPlanet && (
212+ <Grid.Item className="mv2" full>
213+ Invite Group <Blinky />
214+ </Grid.Item>
215+ )}
226216 </Grid>
227217 <Grid className="pt2">
228218 {inviteButton}