on master help sign in
proxy: show appropriate actions
e745a28Marcus
src/components/L2/Dropdowns/AccountsDropdown.tsx+1−1
@@ -77,7 +77,7 @@ const AccountsDropdown = ({ showMigrate = false }: AccountsDropdownProps) => {
77 point.value >= 0 ? point.patp : currentAddress.slice(0, 6);
77 point.value >= 0 ? point.patp : currentAddress.slice(0, 6);
78
78
79 const displayedPoints = useMemo(
79 const displayedPoints = useMemo(
80− () => pointList.filter(({ ownManageSpawn }) => ownManageSpawn),
80+ () => pointList.filter(({ ownManageSpawnVote }) => ownManageSpawnVote),
81 [pointList]
81 [pointList]
82 );
82 );
83
83
src/lib/types/Point.ts+4−4
@@ -123,7 +123,7 @@ export default class Point {
123 showInvites: boolean;
123 showInvites: boolean;
124 isDefault: boolean;
124 isDefault: boolean;
125 isPlaceholder: boolean;
125 isPlaceholder: boolean;
126− ownManageSpawn: boolean;
126+ ownManageSpawnVote: boolean;
127 shouldDisplay: boolean;
127 shouldDisplay: boolean;
128 isOutgoing: boolean;
128 isOutgoing: boolean;
129 permissionLevel: PermissionLevel;
129 permissionLevel: PermissionLevel;
@@ -206,11 +206,11 @@ export default class Point {
206 this.showInvites = this.canManage || this.canSpawn;
206 this.showInvites = this.canManage || this.canSpawn;
207 this.isDefault = value === -1;
207 this.isDefault = value === -1;
208 this.isPlaceholder = isPlaceholder;
208 this.isPlaceholder = isPlaceholder;
209− this.ownManageSpawn =
209+ this.ownManageSpawnVote =
210 !this.isPlaceholder &&
210 !this.isPlaceholder &&
211 !this.isDefault &&
211 !this.isDefault &&
212− (this.isOwner || this.isSpawnProxy || this.isManagementProxy);
212+ (this.isOwner || this.isSpawnProxy || this.isManagementProxy || this.isVotingProxy);
213− this.shouldDisplay = this.ownManageSpawn || this.isTransferProxy;
213+ this.shouldDisplay = this.ownManageSpawnVote || this.isTransferProxy;
214 this.isOutgoing =
214 this.isOutgoing =
215 this.isTransferProxySet &&
215 this.isTransferProxySet &&
216 !this.isTransferProxy &&
216 !this.isTransferProxy &&
src/views/Ops/Ops.scss+8−1
@@ -1,7 +1,14 @@
1.id-ops {
1.id-ops {
2 .between-row {
2 .between-row {
3+
3− .section-title, .subtitle {
4+ .section-title,
5+ .subtitle {
4 font-size: 14px;
6 font-size: 14px;
5 }
7 }
6 }
8 }
9+
10+ .disabled {
11+ opacity: 0.5;
12+ pointer-events: none;
13+ }
7}
14}
src/views/Ops/Ops.tsx+18−7
@@ -67,7 +67,9 @@ export const Ops = () => {
67 </Row>
67 </Row>
68 </HeaderPane>
68 </HeaderPane>
69 <BodyPane>
69 <BodyPane>
70− <Row className="between-row management">
70+ <Row className={"between-row management" +
71+ (point.canManage ? "" : " disabled")}
72+ >
71 <Box>
73 <Box>
72 <Box className="section-title">Residents</Box>
74 <Box className="section-title">Residents</Box>
73 <Box className="subtitle">
75 <Box className="subtitle">
@@ -75,11 +77,15 @@ export const Ops = () => {
75 for
77 for
76 </Box>
78 </Box>
77 </Box>
79 </Box>
78− <Button className="secondary" onClick={goResidents}>
80+ <Button className="secondary"
81+ onClick={point.canManage ? goResidents : undefined}
82+ >
79 View
83 View
80 </Button>
84 </Button>
81 </Row>
85 </Row>
82− <Row className="between-row management">
86+ <Row className={"between-row management" +
87+ (point.canManage ? "" : " disabled")}
88+ >
83 <Box>
89 <Box>
84 <Box className="section-title">Requests</Box>
90 <Box className="section-title">Requests</Box>
85 <Box className="subtitle">
91 <Box className="subtitle">
@@ -87,19 +93,24 @@ export const Ops = () => {
87 sponsorship
93 sponsorship
88 </Box>
94 </Box>
89 </Box>
95 </Box>
90− <Button className="secondary" onClick={goRequests}>
96+ <Button className="secondary"
97+ onClick={point.canManage ? goRequests : undefined}
98+ >
91 View
99 View
92 </Button>
100 </Button>
93 </Row>
101 </Row>
94 {point.isGalaxy && (
102 {point.isGalaxy && (
95− <Row className="between-row management">
103+ <Row className={"between-row management" +
104+ (point.canVote ? "" : " disabled")}
105+ >
96− <Box>
106+ <Box >
97 <Box className="section-title">Proposals</Box>
107 <Box className="section-title">Proposals</Box>
98 <Box className="subtitle">
108 <Box className="subtitle">
99 View or vote on proposals in the Senate
109 View or vote on proposals in the Senate
100 </Box>
110 </Box>
101 </Box>
111 </Box>
102− <Button className="secondary" onClick={goSenate}>
112+ <Button className="secondary"
113+ onClick={point.canVote ? goSenate : undefined}>
103 View
114 View
104 </Button>
115 </Button>
105 </Row>
116 </Row>
src/views/Point/Point.tsx+5−6
@@ -82,7 +82,7 @@ export default function Point() {
82 loadL2Info();
82 loadL2Info();
83 }, [point]); // eslint-disable-line react-hooks/exhaustive-deps
83 }, [point]); // eslint-disable-line react-hooks/exhaustive-deps
84
84
85− const { isParent, canManage, isSpawnProxy } = point;
85+ const { isParent, canManage, canVote, canSpawn } = point;
86
86
87 const goUrbitOS = useCallback(() => {
87 const goUrbitOS = useCallback(() => {
88 if (hideMessage) setSeenMissingKeys(hideMessage);
88 if (hideMessage) setSeenMissingKeys(hideMessage);
@@ -114,9 +114,8 @@ export default function Point() {
114 <PendingTransaction
114 <PendingTransaction
115 layer={2}
115 layer={2}
116 nextRoll={nextRoll}
116 nextRoll={nextRoll}
117− title={`${spawnedPending} Planet${
117+ title={`${spawnedPending} Planet${spawnedPending > 1 ? 's' : ''
118− spawnedPending > 1 ? 's' : ''
119− } Spawned`}
118+ } Spawned`}
120 />
119 />
121 )}
120 )}
122 {!!otherPending.length &&
121 {!!otherPending.length &&
@@ -163,14 +162,14 @@ export default function Point() {
163 />
162 />
164 </Grid.Item>
163 </Grid.Item>
165 )}
164 )}
166− {(canManage || isSpawnProxy) && (
165+ {(canManage || canSpawn || canVote) && (
167 <Grid.Item full as={Flex} justify="between">
166 <Grid.Item full as={Flex} justify="between">
168 <Card
167 <Card
169 title="ID"
168 title="ID"
170 subtitle="Master Key, Passport, Proxy Addresses, etc"
169 subtitle="Master Key, Passport, Proxy Addresses, etc"
171 icon={(<Icon icon="User" />) as any}
170 icon={(<Icon icon="User" />) as any}
172 onClick={goUrbitID}
171 onClick={goUrbitID}
173− disabled={!(canManage || isSpawnProxy)}
172+ disabled={!(canManage || canSpawn || canVote)}
174 />
173 />
175 </Grid.Item>
174 </Grid.Item>
176 )}
175 )}
src/views/UrbitID/Home.tsx+9−10
@@ -56,7 +56,6 @@ export default function UrbitIDHome() {
56 const goResetKeys = useCallback(() => push(names.RESET_KEYS), [push, names]);
56 const goResetKeys = useCallback(() => push(names.RESET_KEYS), [push, names]);
57
57
58 const isMasterTicket = Just.hasInstance(urbitWallet);
58 const isMasterTicket = Just.hasInstance(urbitWallet);
59− const { isOwner, canManage } = point;
60 const networkRevision = convertToInt(point.keyRevisionNumber, 10);
59 const networkRevision = convertToInt(point.keyRevisionNumber, 10);
61
60
62 const goSetProxy = useCallback(
61 const goSetProxy = useCallback(
@@ -75,20 +74,20 @@ export default function UrbitIDHome() {
75 <HeaderPane>
74 <HeaderPane>
76 <Row className="header-row">
75 <Row className="header-row">
77 <h5>ID</h5>
76 <h5>ID</h5>
78− {isMasterTicket && (
77+ {isMasterTicket && point.isOwner && (
79 <Button onClick={downloadKeys} className="header-button">
78 <Button onClick={downloadKeys} className="header-button">
80 {keysDownloaded
79 {keysDownloaded
81 ? 'Downloaded!'
80 ? 'Downloaded!'
82 : paper.matchWith({
81 : paper.matchWith({
83− Nothing: () => 'Printing and folding...',
82+ Nothing: () => 'Printing and folding...',
84− Just: (_: any) => 'Download Passport',
83+ Just: (_: any) => 'Download Passport',
85− })}
84+ })}
86 </Button>
85 </Button>
87 )}
86 )}
88 </Row>
87 </Row>
89 </HeaderPane>
88 </HeaderPane>
90 <BodyPane>
89 <BodyPane>
91− {isOwner && (
90+ {point.isOwner && (
92 <Row className="between-row owner">
91 <Row className="between-row owner">
93 <Box>
92 <Box>
94 <Box>Ownership Address</Box>
93 <Box>Ownership Address</Box>
@@ -105,7 +104,7 @@ export default function UrbitIDHome() {
105 </Row>
104 </Row>
106 )}
105 )}
107
106
108− {canManage && (
107+ {point.canManage && (
109 <Row className="between-row management">
108 <Row className="between-row management">
110 <Box>
109 <Box>
111 <Box>Management Address</Box>
110 <Box>Management Address</Box>
@@ -131,7 +130,7 @@ export default function UrbitIDHome() {
131 </Row>
130 </Row>
132 )}
131 )}
133
132
134− {point.isParent && (
133+ {point.canSpawn && (
135 <Row className="between-row management">
134 <Row className="between-row management">
136 <Box>
135 <Box>
137 <Box>Spawn Proxy Address</Box>
136 <Box>Spawn Proxy Address</Box>
@@ -156,7 +155,7 @@ export default function UrbitIDHome() {
156 </Row>
155 </Row>
157 )}
156 )}
158
157
159− {isOwner && (
158+ {point.isOwner && (
160 <Row className="between-row management">
159 <Row className="between-row management">
161 <WithTooltip content={MASTER_TICKET_TOOLTIP}>
160 <WithTooltip content={MASTER_TICKET_TOOLTIP}>
162 <Box>
161 <Box>
@@ -193,7 +192,7 @@ export default function UrbitIDHome() {
193 <Icon className="arrow-button" icon="ArrowEast" />
192 <Icon className="arrow-button" icon="ArrowEast" />
194 </Row>
193 </Row>
195
194
196− {point.isGalaxy && (
195+ {point.canVote && (
197 <Row className="between-row management">
196 <Row className="between-row management">
198 <Box>
197 <Box>
199 <Box>Edit Voting Key</Box>
198 <Box>Edit Voting Key</Box>