@@ -1,5 +1,5 @@
11import React, { useState, useEffect, useCallback } from 'react';
2−import { Grid, H4 } from 'indigo-react';
2+import { Grid, H4, HelpText } from 'indigo-react';
33import { Nothing } from 'folktale/maybe';
44import * as ob from 'urbit-ob';
55
@@ -7,6 +7,7 @@ import View from 'components/View';
77import Tabs from 'components/Tabs';
88import Crumbs from 'components/Crumbs';
99import Sigil from 'components/Sigil';
10+import Blinky from 'components/Blinky';
1011
1112import { useLocalRouter } from 'lib/LocalRouter';
1213import useCurrentPointName from 'lib/useCurrentPointName';
@@ -30,13 +31,13 @@ const VIEWS = {
3031 [NAMES.ALL]: AllResidents,
3132};
3233
33−function Requests({ className, requests }) {
34− const onThing = () => {};
35−
34+function Requests({ className, requests, onAccept, onDecline }) {
3635 if (Nothing.hasInstance(requests)) {
3736 return (
3837 <Grid className={className}>
39− <Grid.Item full>Loading...</Grid.Item>
38+ <Grid.Item full as={HelpText} className="mt8 t-center">
39+ <Blinky /> Loading...
40+ </Grid.Item>
4041 </Grid>
4142 );
4243 }
@@ -49,8 +50,8 @@ function Requests({ className, requests }) {
4950 <Resident
5051 key={point}
5152 point={point}
52− onAccept={onThing}
53− onDecline={onThing}
53+ onAccept={onAccept}
54+ onDecline={onDecline}
5455 />
5556 ))}
5657 </Grid>
@@ -81,13 +82,15 @@ function Resident({ point, onAccept, onDecline }) {
8182 {isRequest && (
8283 <>
8384 <Grid.Item
84− className="flex-row-r align-center underline green3"
85− cols={[7, 10]}>
85+ className="flex-row-r align-center underline green3 pointer"
86+ cols={[7, 10]}
87+ onClick={() => onAccept(point)}>
8688 Accept
8789 </Grid.Item>
8890 <Grid.Item
89− className="flex-row-r align-center underline red4"
90− cols={[10, 13]}>
91+ className="flex-row-r align-center underline red4 pointer"
92+ cols={[10, 13]}
93+ onClick={() => onDecline(point)}>
9194 Decline
9295 </Grid.Item>
9396 </>
@@ -118,7 +121,7 @@ function AllResidents({ className, residents }) {
118121}
119122
120123export default function Residents() {
121− const { pop } = useLocalRouter();
124+ const { pop, push, names } = useLocalRouter();
122125 const name = useCurrentPointName();
123126
124127 const { pointCursor } = usePointCursor();
@@ -133,8 +136,22 @@ export default function Residents() {
133136
134137 const [currentTab, setCurrentTab] = useState(NAMES.ALL);
135138
139+ const onAccept = useCallback(adoptee =>
140+ push(names.ADOPT, {
141+ adoptee,
142+ denied: false,
143+ })
144+ );
145+
146+ const onDecline = useCallback(adoptee =>
147+ push(names.ADOPT, {
148+ adoptee,
149+ denied: true,
150+ })
151+ );
152+
136153 return (
137− <View pop={pop}>
154+ <View pop={pop} inset>
138155 <Grid>
139156 <Grid.Item
140157 full
@@ -156,6 +173,8 @@ export default function Residents() {
156173 // Props for tab
157174 residents={residents}
158175 requests={requests}
176+ onAccept={onAccept}
177+ onDecline={onDecline}
159178 />
160179 </Grid>
161180 </View>