@@ -1,7 +1,8 @@
1−import React, { useCallback } from 'react';
1+import React, { useCallback, useMemo } from 'react';
22import { Just } from 'folktale/maybe';
33import * as need from 'lib/need';
44import { Grid } from 'indigo-react';
5+import { azimuth } from 'azimuth-js';
56
67import { usePointCursor } from 'store/pointCursor';
78import { useHistory } from 'store/history';
@@ -20,6 +21,9 @@ import Actions from './Point/Actions';
2021import { useWallet } from 'store/wallet';
2122import usePermissionsForPoint from 'lib/usePermissionsForPoint';
2223
24+const isPlanet = point =>
25+ azimuth.getPointSize(point) === azimuth.PointSize.Planet;
26+
2327export default function Point() {
2428 const history = useHistory();
2529 const { pointCursor } = usePointCursor();
@@ -27,7 +31,7 @@ export default function Point() {
2731
2832 const point = need.point(pointCursor);
2933
30− const { canManage } = usePermissionsForPoint(
34+ const { isOwner, canManage } = usePermissionsForPoint(
3135 // using empty string should be ok here
3236 wallet.matchWith({
3337 Nothing: () => '',
@@ -38,7 +42,6 @@ export default function Point() {
3842
3943 // fetch the invites for the current cursor
4044 const { availableInvites } = useInvites(point);
41− const availableInvitesText = matchBlinky(availableInvites);
4245
4346 const showActions = Just.hasInstance(wallet);
4447
@@ -48,6 +51,30 @@ export default function Point() {
4851 history,
4952 ]);
5053
54+ const inviteButton = useMemo(() => {
55+ switch (azimuth.getPointSize(point)) {
56+ case azimuth.PointSize.Planet:
57+ const availableInvitesText = matchBlinky(availableInvites);
58+ const goInvite = () => history.push(ROUTE_NAMES.INVITE);
59+ return (
60+ <FooterButton disabled={!isOwner} onClick={goInvite}>
61+ Invite <sup>{availableInvitesText} available</sup>
62+ </FooterButton>
63+ );
64+ //
65+ case azimuth.PointSize.Star:
66+ const goParties = () => history.push(ROUTE_NAMES.INVITES_MANAGE);
67+ return (
68+ <FooterButton disabled={!isOwner} onClick={goParties}>
69+ Manage parties
70+ </FooterButton>
71+ );
72+ //
73+ default:
74+ return null;
75+ }
76+ }, [point, history, isOwner, availableInvites]);
77+
5178 // sync the current cursor
5279 useSyncOwnedPoints([point]);
5380
@@ -73,9 +100,7 @@ export default function Point() {
73100 )}
74101 </Grid>
75102
76− <FooterButton disabled={!canManage} onClick={goInvite}>
77− Invite <sup>{availableInvitesText} available</sup>
78− </FooterButton>
103+ {inviteButton}
79104 </View>
80105 );
81106}