@@ -1,4 +1,4 @@
1−import React, { useCallback } from 'react';
1+import React, { useCallback, useEffect } from 'react';
2import { Just, Nothing } from 'folktale/maybe';
2import { Just, Nothing } from 'folktale/maybe';
3import { Grid, H5, H1, HelpText, LinkButton, Flex } from 'indigo-react';
3import { Grid, H5, H1, HelpText, LinkButton, Flex } from 'indigo-react';
4import { get } from 'lodash';
4import { get } from 'lodash';
@@ -79,7 +79,7 @@ function ActionButtons({ actions = [] }) {
80export default function Points() {
80export default function Points() {
81 const { wallet } = useWallet();
81 const { wallet } = useWallet();
82− const { pop, push, names } = useHistory();
82+ const { pop, push, popAndPush, names } = useHistory();
83 const { setPointCursor } = usePointCursor();
83 const { setPointCursor } = usePointCursor();
84 const { controlledPoints, getDetails } = usePointCache();
84 const { controlledPoints, getDetails } = usePointCache();
85 const isEclipticOwner = useIsEclipticOwner();
85 const isEclipticOwner = useIsEclipticOwner();
@@ -88,6 +88,37 @@ export default function Points() {
88 addRejectedPoint,
88 addRejectedPoint,
89 ] = useRejectedIncomingPointTransfers();
89 ] = useRejectedIncomingPointTransfers();
91+ // if we can only interact with a single point, forget about the existence
92+ // of this page and jump to the point page.
93+ // if there are any pending transfers, incoming or outgoing, stay on this
94+ // page, because those can only be completed/cancelled here.
96+ controlledPoints.matchWith({
103+ ...p.value.ownedPoints,
104+ ...p.value.votingPoints,
105+ ...p.value.managingPoints,
106+ ...p.value.spawningPoints,
108+ const incoming = p.value.incomingPoints.filter(
109+ p => !rejectedPoints.includes(p)
111+ //TODO && outgoing.length === 0
112+ if (all.length === 1 && incoming.length === 0) {
113+ setPointCursor(Just(all[0]));
114+ popAndPush(names.POINT);
120+ }, [controlledPoints, rejectedPoints, setPointCursor, popAndPush, names]);
91 const address = need.addressFromWallet(wallet);
122 const address = need.addressFromWallet(wallet);
93 const loading = Nothing.hasInstance(controlledPoints);
124 const loading = Nothing.hasInstance(controlledPoints);