on master help sign in
Merge pull request #1109 from urbit/proxy-actions
commitf68fd2ab8a65040fb5b70a3788d0c48b74248ea8 authorJosh Lehman <josh@urbit.org> dateTue 27 Jun 2023, 09:45 (3 years ago) parentdf0c310e745a28
6 files changed+45−29
src/components/L2/Dropdowns/AccountsDropdown.tsx+1−1 src/lib/types/Point.ts+4−4 src/views/Ops/Ops.scss+8−1 src/views/Ops/Ops.tsx+18−7 src/views/Point/Point.tsx+5−6 src/views/UrbitID/Home.tsx+9−10
src/components/L2/Dropdowns/AccountsDropdown.tsx+1−1
@@ -77,7 +77,7 @@ const AccountsDropdown = ({ showMigrate = false }: AccountsDropdownProps) => {
7777 point.value >= 0 ? point.patp : currentAddress.slice(0, 6);
7878
7979 const displayedPoints = useMemo(
80− () => pointList.filter(({ ownManageSpawn }) => ownManageSpawn),
80+ () => pointList.filter(({ ownManageSpawnVote }) => ownManageSpawnVote),
8181 [pointList]
8282 );
8383
src/lib/types/Point.ts+4−4
@@ -123,7 +123,7 @@ export default class Point {
123123 showInvites: boolean;
124124 isDefault: boolean;
125125 isPlaceholder: boolean;
126− ownManageSpawn: boolean;
126+ ownManageSpawnVote: boolean;
127127 shouldDisplay: boolean;
128128 isOutgoing: boolean;
129129 permissionLevel: PermissionLevel;
@@ -206,11 +206,11 @@ export default class Point {
206206 this.showInvites = this.canManage || this.canSpawn;
207207 this.isDefault = value === -1;
208208 this.isPlaceholder = isPlaceholder;
209− this.ownManageSpawn =
209+ this.ownManageSpawnVote =
210210 !this.isPlaceholder &&
211211 !this.isDefault &&
212− (this.isOwner || this.isSpawnProxy || this.isManagementProxy);
213− this.shouldDisplay = this.ownManageSpawn || this.isTransferProxy;
212+ (this.isOwner || this.isSpawnProxy || this.isManagementProxy || this.isVotingProxy);
213+ this.shouldDisplay = this.ownManageSpawnVote || this.isTransferProxy;
214214 this.isOutgoing =
215215 this.isTransferProxySet &&
216216 !this.isTransferProxy &&
src/views/Ops/Ops.scss+8−1
@@ -1,7 +1,14 @@
11.id-ops {
22 .between-row {
3− .section-title, .subtitle {
3+
4+ .section-title,
5+ .subtitle {
46 font-size: 14px;
57 }
68 }
9+
10+ .disabled {
11+ opacity: 0.5;
12+ pointer-events: none;
13+ }
714}
src/views/Ops/Ops.tsx+18−7
@@ -67,7 +67,9 @@ export const Ops = () => {
6767 </Row>
6868 </HeaderPane>
6969 <BodyPane>
70− <Row className="between-row management">
70+ <Row className={"between-row management" +
71+ (point.canManage ? "" : " disabled")}
72+ >
7173 <Box>
7274 <Box className="section-title">Residents</Box>
7375 <Box className="subtitle">
@@ -75,11 +77,15 @@ export const Ops = () => {
7577 for
7678 </Box>
7779 </Box>
78− <Button className="secondary" onClick={goResidents}>
80+ <Button className="secondary"
81+ onClick={point.canManage ? goResidents : undefined}
82+ >
7983 View
8084 </Button>
8185 </Row>
82− <Row className="between-row management">
86+ <Row className={"between-row management" +
87+ (point.canManage ? "" : " disabled")}
88+ >
8389 <Box>
8490 <Box className="section-title">Requests</Box>
8591 <Box className="subtitle">
@@ -87,19 +93,24 @@ export const Ops = () => {
8793 sponsorship
8894 </Box>
8995 </Box>
90− <Button className="secondary" onClick={goRequests}>
96+ <Button className="secondary"
97+ onClick={point.canManage ? goRequests : undefined}
98+ >
9199 View
92100 </Button>
93101 </Row>
94102 {point.isGalaxy && (
95− <Row className="between-row management">
96− <Box>
103+ <Row className={"between-row management" +
104+ (point.canVote ? "" : " disabled")}
105+ >
106+ <Box >
97107 <Box className="section-title">Proposals</Box>
98108 <Box className="subtitle">
99109 View or vote on proposals in the Senate
100110 </Box>
101111 </Box>
102− <Button className="secondary" onClick={goSenate}>
112+ <Button className="secondary"
113+ onClick={point.canVote ? goSenate : undefined}>
103114 View
104115 </Button>
105116 </Row>
src/views/Point/Point.tsx+5−6
@@ -82,7 +82,7 @@ export default function Point() {
8282 loadL2Info();
8383 }, [point]); // eslint-disable-line react-hooks/exhaustive-deps
8484
85− const { isParent, canManage, isSpawnProxy } = point;
85+ const { isParent, canManage, canVote, canSpawn } = point;
8686
8787 const goUrbitOS = useCallback(() => {
8888 if (hideMessage) setSeenMissingKeys(hideMessage);
@@ -114,9 +114,8 @@ export default function Point() {
114114 <PendingTransaction
115115 layer={2}
116116 nextRoll={nextRoll}
117− title={`${spawnedPending} Planet${
118− spawnedPending > 1 ? 's' : ''
119− } Spawned`}
117+ title={`${spawnedPending} Planet${spawnedPending > 1 ? 's' : ''
118+ } Spawned`}
120119 />
121120 )}
122121 {!!otherPending.length &&
@@ -163,14 +162,14 @@ export default function Point() {
163162 />
164163 </Grid.Item>
165164 )}
166− {(canManage || isSpawnProxy) && (
165+ {(canManage || canSpawn || canVote) && (
167166 <Grid.Item full as={Flex} justify="between">
168167 <Card
169168 title="ID"
170169 subtitle="Master Key, Passport, Proxy Addresses, etc"
171170 icon={(<Icon icon="User" />) as any}
172171 onClick={goUrbitID}
173− disabled={!(canManage || isSpawnProxy)}
172+ disabled={!(canManage || canSpawn || canVote)}
174173 />
175174 </Grid.Item>
176175 )}
src/views/UrbitID/Home.tsx+9−10
@@ -56,7 +56,6 @@ export default function UrbitIDHome() {
5656 const goResetKeys = useCallback(() => push(names.RESET_KEYS), [push, names]);
5757
5858 const isMasterTicket = Just.hasInstance(urbitWallet);
59− const { isOwner, canManage } = point;
6059 const networkRevision = convertToInt(point.keyRevisionNumber, 10);
6160
6261 const goSetProxy = useCallback(
@@ -75,20 +74,20 @@ export default function UrbitIDHome() {
7574 <HeaderPane>
7675 <Row className="header-row">
7776 <h5>ID</h5>
78− {isMasterTicket && (
77+ {isMasterTicket && point.isOwner && (
7978 <Button onClick={downloadKeys} className="header-button">
8079 {keysDownloaded
8180 ? 'Downloaded!'
8281 : paper.matchWith({
83− Nothing: () => 'Printing and folding...',
84− Just: (_: any) => 'Download Passport',
85− })}
82+ Nothing: () => 'Printing and folding...',
83+ Just: (_: any) => 'Download Passport',
84+ })}
8685 </Button>
8786 )}
8887 </Row>
8988 </HeaderPane>
9089 <BodyPane>
91− {isOwner && (
90+ {point.isOwner && (
9291 <Row className="between-row owner">
9392 <Box>
9493 <Box>Ownership Address</Box>
@@ -105,7 +104,7 @@ export default function UrbitIDHome() {
105104 </Row>
106105 )}
107106
108− {canManage && (
107+ {point.canManage && (
109108 <Row className="between-row management">
110109 <Box>
111110 <Box>Management Address</Box>
@@ -131,7 +130,7 @@ export default function UrbitIDHome() {
131130 </Row>
132131 )}
133132
134− {point.isParent && (
133+ {point.canSpawn && (
135134 <Row className="between-row management">
136135 <Box>
137136 <Box>Spawn Proxy Address</Box>
@@ -156,7 +155,7 @@ export default function UrbitIDHome() {
156155 </Row>
157156 )}
158157
159− {isOwner && (
158+ {point.isOwner && (
160159 <Row className="between-row management">
161160 <WithTooltip content={MASTER_TICKET_TOOLTIP}>
162161 <Box>
@@ -193,7 +192,7 @@ export default function UrbitIDHome() {
193192 <Icon className="arrow-button" icon="ArrowEast" />
194193 </Row>
195194
196− {point.isGalaxy && (
195+ {point.canVote && (
197196 <Row className="between-row management">
198197 <Box>
199198 <Box>Edit Voting Key</Box>