1import React, { useState, useEffect, useCallback } from 'react';
2import { Grid, H4 } from 'indigo-react';
3import { Nothing } from 'folktale/maybe';
4import * as ob from 'urbit-ob';
6import View from 'components/View';
7import Tabs from 'components/Tabs';
8import Crumbs from 'components/Crumbs';
9import Sigil from 'components/Sigil';
11import { useLocalRouter } from 'lib/LocalRouter';
12import useCurrentPointName from 'lib/useCurrentPointName';
13import { useResidents } from 'lib/useResidents';
14import * as need from 'lib/need';
16import { usePointCursor } from 'store/pointCursor';
24 { text: 'Requests', value: NAMES.REQUESTS },
25 { text: 'All', value: NAMES.ALL },
29 [NAMES.REQUESTS]: Requests,
30 [NAMES.ALL]: AllResidents,
33function Requests({ className }) {
34 const onThing = () => {};
35 const { pointCursor } = usePointCursor();
36 const point = need.point(pointCursor);
37 const { requests, syncRequests } = useResidents(point);
42 if (Nothing.hasInstance(requests)) {
44 <Grid className={className}>
45 <Grid.Item full>Loading...</Grid.Item>
50 const _requests = requests.getOrElse([]);
53 <Grid className={className}>
54 {_requests.map(point => (
66function Resident({ point, onAccept, onDecline }) {
67 const patp = ob.patp(point);
70 const isRequest = onAccept && onDecline;
74 <Grid.Item className="flex-row justify-center align-center" cols={[1, 3]}>
77 display: 'inline-block',
78 height: `${sigilSize}px`,
79 width: `${sigilSize}px`,
81 <Sigil patp={patp} size={25} colors={['#FFFFFF', '#000000']} />
84 <Grid.Item className="flex-row align-center" cols={[3, 6]}>
89 <Grid.Item className="flex-row align-center underline" cols={[7, 10]}>
93 className="flex-row align-center underline"
104function AllResidents({ className }) {
105 const { pointCursor } = usePointCursor();
106 const point = need.point(pointCursor);
107 const { syncResidents, residents } = useResidents(point);
112 if (Nothing.hasInstance(residents)) {
114 <Grid className={className}>
115 <Grid.Item full>Loading...</Grid.Item>
120 const _residents = residents.getOrElse([]);
123 <Grid className={className}>
124 {_residents.map(point => (
125 <Resident key={point} point={point} />
131export default function Residents() {
132 const { pop } = useLocalRouter();
133 const name = useCurrentPointName();
135 // const { pointCursor } = usePointCursor();
137 const [currentTab, setCurrentTab] = useState(NAMES.ALL);
139 const [req, selectRequest] = useState();
147 routes={[{ text: name, action: pop }, { text: 'Residents' }]}
149 <Grid.Item full as={H4} className="mt4">
158 currentTab={currentTab}
159 onTabChange={setCurrentTab}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list