@@ -10,10 +10,10 @@ import Sigil from 'components/Sigil';
1010
1111import { useLocalRouter } from 'lib/LocalRouter';
1212import useCurrentPointName from 'lib/useCurrentPointName';
13−import { useResidents } from 'lib/useResidents';
1413import * as need from 'lib/need';
1514
1615import { usePointCursor } from 'store/pointCursor';
16+import { usePointCache } from 'store/pointCache';
1717
1818const NAMES = {
1919 REQUESTS: 'REQUESTS',
@@ -30,14 +30,8 @@ const VIEWS = {
3030 [NAMES.ALL]: AllResidents,
3131};
3232
33−function Requests({ className }) {
33+function Requests({ className, requests }) {
3434 const onThing = () => {};
35− const { pointCursor } = usePointCursor();
36− const point = need.point(pointCursor);
37− const { requests, syncRequests } = useResidents(point);
38− useEffect(() => {
39− syncRequests();
40− }, [syncRequests]);
4135
4236 if (Nothing.hasInstance(requests)) {
4337 return (
@@ -86,11 +80,13 @@ function Resident({ point, onAccept, onDecline }) {
8680 </Grid.Item>
8781 {isRequest && (
8882 <>
89− <Grid.Item className="flex-row align-center underline" cols={[7, 10]}>
83+ <Grid.Item
84+ className="flex-row-r align-center underline green3"
85+ cols={[7, 10]}>
9086 Accept
9187 </Grid.Item>
9288 <Grid.Item
93− className="flex-row align-center underline"
89+ className="flex-row-r align-center underline red4"
9490 cols={[10, 13]}>
9591 Decline
9692 </Grid.Item>
@@ -101,14 +97,7 @@ function Resident({ point, onAccept, onDecline }) {
10197 );
10298}
10399
104−function AllResidents({ className }) {
105− const { pointCursor } = usePointCursor();
106− const point = need.point(pointCursor);
107− const { syncResidents, residents } = useResidents(point);
108− useEffect(() => {
109− syncResidents();
110− }, [syncResidents]);
111−
100+function AllResidents({ className, residents }) {
112101 if (Nothing.hasInstance(residents)) {
113102 return (
114103 <Grid className={className}>
@@ -132,11 +121,17 @@ export default function Residents() {
132121 const { pop } = useLocalRouter();
133122 const name = useCurrentPointName();
134123
135− // const { pointCursor } = usePointCursor();
124+ const { pointCursor } = usePointCursor();
125+ const point = need.point(pointCursor);
126+ const { getResidents, syncResidents } = usePointCache();
136127
137− const [currentTab, setCurrentTab] = useState(NAMES.ALL);
128+ useEffect(() => {
129+ syncResidents(point);
130+ }, [syncResidents, point]);
131+
132+ const { residents, requests } = getResidents(point);
138133
139− const [req, selectRequest] = useState();
134+ const [currentTab, setCurrentTab] = useState(NAMES.ALL);
140135
141136 return (
142137 <View pop={pop}>
@@ -153,10 +148,14 @@ export default function Residents() {
153148 full
154149 className="mt1"
155150 as={Tabs}
151+ // Tabs
156152 views={VIEWS}
157153 options={OPTIONS}
158154 currentTab={currentTab}
159155 onTabChange={setCurrentTab}
156+ // Props for tab
157+ residents={residents}
158+ requests={requests}
160159 />
161160 </Grid>
162161 </View>