on master help sign in
ops-view: new route, root component, and styles
commit29574a9f222f9d37361395eb79252ed7b40ead8b authortomholford <tomholford@users.noreply.github.com> dateTue 9 Nov 2021, 16:12 (5 years ago) parent31860d3
6 files changed+101−5
src/components/L2/Card.scss+4 src/components/L2/Window/HeaderPane.scss+4 src/lib/routeNames.js+1 src/lib/router.js+2 src/views/Ops/Ops.tsx+82 src/views/Point/Point.tsx+8−5
src/components/L2/Card.scss+4
@@ -12,6 +12,10 @@
1212 font-weight: bold;
1313 }
1414
15+ .card-subtitle {
16+ color: rgba(0, 0, 0, 0.6);
17+ }
18+
1519 svg {
1620 width: 16px;
1721 height: 16px;
src/components/L2/Window/HeaderPane.scss+4
@@ -36,6 +36,10 @@
3636 &:hover {
3737 opacity: 0.8;
3838 }
39+
40+ svg > path {
41+ fill: white;
42+ }
3943 }
4044 }
4145}
src/lib/routeNames.js+1
@@ -35,4 +35,5 @@ export const ROUTE_NAMES = {
3535 BITCOIN_SIGN_TRANSACTION: Symbol('BITCOIN_SIGN_TRANSACTION'),
3636 TRANSACTION_HISTORY: Symbol('TRANSACTION_HISTORY'),
3737 MIGRATE_L2: Symbol('MIGRATE_L2'),
38+ OPS: Symbol('OPS'),
3839};
src/lib/router.js+2
@@ -29,6 +29,7 @@ import SignTransaction from 'views/Bitcoin/SignTransaction';
2929import TransactionHistory from 'views/Transactions/TransactionHistory';
3030
3131import { ROUTE_NAMES } from './routeNames';
32+import { Ops } from 'views/Ops/Ops';
3233
3334export const ROUTES = {
3435 [ROUTE_NAMES.DISCLAIMER]: Disclaimer,
@@ -59,4 +60,5 @@ export const ROUTES = {
5960 [ROUTE_NAMES.BITCOIN_SIGN_TRANSACTION]: SignTransaction,
6061 [ROUTE_NAMES.TRANSACTION_HISTORY]: TransactionHistory,
6162 [ROUTE_NAMES.MIGRATE_L2]: MigrateL2,
63+ [ROUTE_NAMES.OPS]: Ops,
6264};
src/views/Ops/Ops.tsxnew file+82
@@ -0,0 +1,82 @@
1+import * as need from 'lib/need';
2+import { Box, Row, Button, Icon } from '@tlon/indigo-react';
3+
4+import Window from 'components/L2/Window/Window';
5+import HeaderPane from 'components/L2/Window/HeaderPane';
6+import BodyPane from 'components/L2/Window/BodyPane';
7+import { useCallback } from 'react';
8+import { useLocalRouter } from 'lib/LocalRouter';
9+import { isGalaxy } from 'lib/utils/point';
10+import { usePointCursor } from 'store/pointCursor';
11+import View from 'components/View';
12+import L2BackHeader from 'components/L2/Headers/L2BackHeader';
13+
14+export const Ops = () => {
15+ const { pop, push, names }: any = useLocalRouter();
16+ const { pointCursor }: any = usePointCursor();
17+ const point = need.point(pointCursor);
18+
19+ const goSenate = useCallback(() => push(names.SENATE), [push, names]);
20+ const goResidents = useCallback(() => push(names.RESIDENTS), [push, names]);
21+ const goIssuePoint = useCallback(() => push(names.ISSUE_CHILD), [
22+ names.ISSUE_CHILD,
23+ push,
24+ ]);
25+
26+ return (
27+ <View
28+ id="ops"
29+ pop={pop}
30+ inset
31+ hideBack
32+ className="urbit-id"
33+ header={<L2BackHeader hideBalance back={pop} />}>
34+ <Window className="id-ops">
35+ <HeaderPane>
36+ <Row className="header-row">
37+ <h5>{isGalaxy(point) ? 'Galaxy' : 'Star'} Ops</h5>
38+ <Button onClick={goIssuePoint} className="header-button">
39+ <Icon icon="Node" /> &nbsp;Spawn&nbsp;
40+ {isGalaxy(point) ? 'Stars' : 'Planets'}
41+ </Button>
42+ </Row>
43+ </HeaderPane>
44+ <BodyPane>
45+ <Row className="between-row management">
46+ <Box>
47+ <Box>Residents</Box>
48+ <Box className="subtitle">Planets that you route packets for</Box>
49+ </Box>
50+ <Button className="secondary" onClick={goResidents}>
51+ View
52+ </Button>
53+ </Row>
54+ <Row className="between-row management">
55+ <Box>
56+ <Box>Requests</Box>
57+ <Box className="subtitle">
58+ Planets requesting your sponsorship
59+ </Box>
60+ </Box>
61+ <Button className="secondary" onClick={goResidents}>
62+ View
63+ </Button>
64+ </Row>
65+ {isGalaxy(point) && (
66+ <Row className="between-row management">
67+ <Box>
68+ <Box>Proposals</Box>
69+ <Box className="subtitle">
70+ View or vote on proposals in the Senate
71+ </Box>
72+ </Box>
73+ <Button className="secondary" onClick={goSenate}>
74+ View
75+ </Button>
76+ </Row>
77+ )}
78+ </BodyPane>
79+ </Window>
80+ </View>
81+ );
82+};
src/views/Point/Point.tsx+8−5
@@ -141,6 +141,8 @@ export default function Point() {
141141
142142 const goResidents = useCallback(() => push(names.RESIDENTS), [push, names]);
143143
144+ const goOps = useCallback(() => push(names.OPS), [push, names]);
145+
144146 const planet = isPlanet(point);
145147
146148 const [showInviteForm, setShowInviteForm] = useState(false);
@@ -221,13 +223,14 @@ export default function Point() {
221223 {isParent && (
222224 <Grid.Item full as={Flex} justify="between">
223225 <Card
226+ icon={(<Icon icon="BootNode" />) as any}
224227 title={`${isStar(point) ? 'Star' : 'Galaxy'} Ops`}
225228 subtitle={
226229 isStar(point)
227− ? 'Manage planets you sponsor and spawn planets'
228− : 'Manage stars you sponsor, spawn stars, and vote'
230+ ? 'Residents, Requests, Spawn Planets'
231+ : 'Residents, Requests, Spawn Stars, Vote'
229232 }
230− onClick={goResidents}
233+ onClick={goOps}
231234 />
232235 </Grid.Item>
233236 )}
@@ -253,7 +256,7 @@ export default function Point() {
253256 <Grid.Item full as={Flex} justify="between">
254257 <Card
255258 title="ID"
256− subtitle="Identity and security settings"
259+ subtitle="Master Key, Passport, Proxy Addresses, etc"
257260 icon={(<Icon icon="User" />) as any}
258261 onClick={goUrbitID}
259262 disabled={!canManage}
@@ -262,7 +265,7 @@ export default function Point() {
262265 <Grid.Item full as={Flex} justify="between">
263266 <Card
264267 title="OS"
265− subtitle="Urbit OS Settings"
268+ subtitle="Sponsor, Network Keys, Access Key"
266269 icon={(<Icon icon="Server" />) as any}
267270 onClick={goUrbitOS}
268271 disabled={!canManage}